Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 138649

Summary: net-irc/xchat-2.6.2 reports wrong CPU speed
Product: Gentoo Linux Reporter: Mike Hlavac <mike>
Component: Current packagesAssignee: Packages in net-irc <net-irc>
Status: RESOLVED UPSTREAM    
Severity: trivial CC: alpha, tcort
Priority: Lowest    
Version: 2006.0   
Hardware: Alpha   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: xchat-2.4.5-alpha-cpu.patch
xchat-2.6.2-alpha-cpu.patch
xchat-2.6.4-alpha-cpu.patch
xchat-2.6.6-alpha-cpu.patch

Description Mike Hlavac 2006-06-30 19:52:26 UTC
Xchat 2.6.2 and 2.4.5 both report the wrong CPU speed for my Alpha.  cat /proc/cpuinfo says:

cpu                     : Alpha
cpu model               : EV56
cpu variation           : 7
cpu revision            : 0
cpu serial number       : 
system type             : Miata
system variation        : 0
system revision         : 0
system serial number    : 
cycle frequency [Hz]    : 633149635 est.
timer frequency [Hz]    : 1024.00
page size [bytes]       : 8192
phys. address bits      : 40
max. addr. space #      : 127
BogoMIPS                : 1254.88
kernel unaligned acc    : 0 (pc=0,va=0)
user unaligned acc      : 1 (pc=2000005e928,va=11fa750dc)
platform string         : Digital Personal WorkStation 633au
cpus detected           : 1
L1 Icache               : 8K, 1-way, 32b line
L1 Dcache               : 8K, 1-way, 32b line
L2 cache                : 96K, 3-way, 64b line
L3 cache                : 2048K, 1-way, 64b line

Help -> About XChat reports 603.33 mhz

This is because of the following in common/util.c:

if (!strncmp (buf, "cycle frequency [Hz]\t:", 22))      /* alpha */
{
     *mhz = atoi (buf + 23) / 1048576;
} 

It should be changed to the following since a MHz is defined as 1,000,000 HZ and not 1024 * 1024:

if (!strncmp (buf, "cycle frequency [Hz]\t:", 22))      /* alpha */
{
     *mhz = atoi (buf + 23) / 1000000;
}
Comment 1 Thomas Cort (RETIRED) gentoo-dev 2006-06-30 20:02:46 UTC
Created attachment 90583 [details, diff]
xchat-2.4.5-alpha-cpu.patch
Comment 2 Thomas Cort (RETIRED) gentoo-dev 2006-06-30 20:03:08 UTC
Created attachment 90584 [details, diff]
xchat-2.6.2-alpha-cpu.patch
Comment 3 Thomas Cort (RETIRED) gentoo-dev 2006-06-30 20:17:11 UTC
net-irc, this is a common problem for alpha. It is described in more detail here: http://alpha.gentoo.org/doc/alpha-porting-guide.xml#doc_chap7
The solution Mike proposed is correct. Please apply the patches.

It should be noted that xchat's cpuinfo reader doesn't work on all architectures. It only supports CPU frequency for alpha/i386/amd64/ia64/powerpc/powerpc64/arm. It only gets a proper CPU count for i386/amd64/ia64/hppa/mips/powerpc/powerpc64/sh/cris/m32r. I am currently developing a library for reading cpuinfo files from various architectures. (URL:
https://savannah.nongnu.org/projects/proccpuinfo/ ) It already supports frequency and cpu count on more architectures than are supported by Gentoo. I'll be contacting upstream about using the library.
Comment 4 Thomas Cort (RETIRED) gentoo-dev 2006-07-07 06:27:27 UTC
Created attachment 91125 [details, diff]
xchat-2.6.4-alpha-cpu.patch
Comment 5 Thomas Cort (RETIRED) gentoo-dev 2006-09-15 06:11:34 UTC
Created attachment 97046 [details, diff]
xchat-2.6.6-alpha-cpu.patch

Here's a patch for 2.6.6. I thought I sent this upstream, but I'll do it again to be sure.
Comment 6 Markus Ullmann (RETIRED) gentoo-dev 2006-10-19 16:37:14 UTC
Fixed in 2.6.8 upstream now which is in portage as well now.