gnome-system-monitor does not show CPU speed on ppc64



Hello,

I am looking at problem reported by one of our test teams. Below is
their recreation steps and what they reported:

1. Launch System Monitor Tool (gnome-system-monitor-2.28.0)
2. Look at "Hardware" item of "System" tabbed section like following sentence:
Precessor 0: POWER6 (architected), altivec supported ===> no processor speed
3. In System Monitor Tool window, open help manual via
Help->Contents->Introduction and you could see "Processors and speeds"
description in "Hardware" item of "System" tabbed section

Here is my analysis:

I took a look at the source for gnome-system-monitor and determined where the
strings that are displayed came from. Looking at src/sysinfo.cpp there is this
method:

    void load_processors_info()
    {
      const glibtop_sysinfo *info = glibtop_get_sysinfo();

      for (guint i = 0; i != info->ncpu; ++i) {
        const char * const keys[] = { "model name", "cpu" };
        gchar *model = 0;

        for (guint j = 0; !model && j != G_N_ELEMENTS(keys); ++j)
          model =
static_cast<char*>(g_hash_table_lookup(info->cpuinfo[i].values,
                                                         keys[j]));

        if (!model)
          model = _("Unknown CPU model");

        this->processors.push_back(model);
      }
    }

It first invokes the glibtop_get_sysinfo() call which comes from the external
libgtop to retrieve the system info (I will explain where from shortly) and
then uses the keys "model name" and "cpu" to retrieve the corresponding strings
in a hash table that correspond to those keys. What is retrieved is what ends
up being displayed under the Hardware section.

In the libgtop source we find a file called  sysdeps/linux/sysinfo.c which
contains the source for the glibtop_get_sysinfo() which almost wholly contained
in the function init_sysinfo() which essentially reads the contents of
/proc/cpuinfo into a buffer then parses each line and uses the label before the
":" as the key and the remaining as the value and the labels/keys are loaded
into string array and the string values are added into a hash table with the
label as the key.

So, looking at the /proc/cpuinfo of a x86_64 system I get the following:

model name      : Intel(R) Xeon(TM) CPU 3.40GHz

as well as ...

cpu MHz         : 3400.000

but on the test system we get

cpu             : POWER6 (architected), altivec supported
clock           : 4204.000000MHz

So, as you can see  both do offer separate sysinfo records for the processor
speed ("cpu MHz" and "clock") but since only "model name" and "cpu" are looked
at and only "model name" contains that extra info, this is why for the ppc64
system, it is not displayed though it is separately available from the "clock"
record.

I am considering creating a patch for the case when "model name" is not
available but "cpu" is which will simply append the "clock" text (if
available) to the "cpu" text. Anyone suggest a better or alternative
solution?

regards,
-- 
Luciano Chavez <lnx1138 linux vnet ibm com>
IBM Linux Technology Center



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]