PDA

View Full Version : Single-Core CPUs reported as 'Unknown'


Marox
07-25-2008, 06:23 AM
Hello,
I found out, on Systems with Single-Core CPUs information about the processor are not shown (Processor: Unknown (Total Cores: 1). At least for AMD-Athlon 1000MHz, AthlonXP 2200+ and a mobile Intel Celeron 540.

This is because there is no 'physical id' listed in /proc/cpuinfo, at least for the processors listed above.

In regard to the corresponding file (pts-functions-system-cpu.php)

$physical_cpu_ids = read_cpuinfo("physical id");
$physical_cpu_count = count(array_unique($physical_cpu_ids));
...
...
if($physical_cpu_count == 1)
{
//just one processor
$info = append_processor_fr...
}

will allways fail and $info stays empty and it will be reported 'Unknown'.
A simple code change corrects this:

if($physical_cpu_count == 1 || empty($physical_cpu_count))

not sure if this is the desired code quality ;) , but i hope it helps in some way. At least on my systems with CPUs not reporting an physical id it works.
phoronix-test-suite system-info

======================================
Phoronix Test Suite v1.0.4 (TRONDHEIM)
System Information
======================================

Hardware:
Processor: Intel Celeron CPU 540 @ 1.86GHz (Total Cores: 1), Motherboard: Unknown, Chipset: Intel Mobile PM965/GM965/GL960, System Memory: 2018MB, Disk Space: 70GB, Graphics: Intel Mobile GM965/GL960, Screen Resolution: 1280x800

Marox

Michael
07-25-2008, 08:09 AM
Thanks, I'll commit it to git.

Michael
08-03-2008, 11:00 PM
Fix found in PTS 1.0.5 release today.