summaryrefslogtreecommitdiff
path: root/modules/devices/x86/processor.c
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2017-08-16 04:32:39 -0500
committerSimon Quigley <tsimonq2@ubuntu.com>2017-08-16 04:32:39 -0500
commit9a9db98089717990cd5e0eef529f6bb0819ebe46 (patch)
treea9afaabce984d5fe552fa8bf1a9405db9bdd2699 /modules/devices/x86/processor.c
parent69a2124e9a081518297951256eb5c8d72d93361f (diff)
New upstream version 0.5.1+git20170815
Diffstat (limited to 'modules/devices/x86/processor.c')
-rw-r--r--modules/devices/x86/processor.c506
1 files changed, 137 insertions, 369 deletions
diff --git a/modules/devices/x86/processor.c b/modules/devices/x86/processor.c
index 25dc6c4a..ad3c7ca4 100644
--- a/modules/devices/x86/processor.c
+++ b/modules/devices/x86/processor.c
@@ -18,6 +18,10 @@
#include "hardinfo.h"
#include "devices.h"
+#include "cpu_util.h"
+
+#include "x86_data.h"
+#include "x86_data.c"
/*
* This function is partly based on x86cpucaps
@@ -148,10 +152,10 @@ static gchar *__cache_get_info_as_string(Processor *processor)
for (cache_list = processor->cache; cache_list; cache_list = cache_list->next) {
cache = (ProcessorCache *)cache_list->data;
- result = h_strdup_cprintf("Level %d (%s)=%d-way set-associative, %d sets, %dKB size\n",
+ result = h_strdup_cprintf(_("Level %d (%s)=%d-way set-associative, %d sets, %dKB size\n"),
result,
cache->level,
- cache->type,
+ C_("cache-type", cache->type),
cache->ways_of_associativity,
cache->number_of_sets,
cache->size);
@@ -160,6 +164,14 @@ static gchar *__cache_get_info_as_string(Processor *processor)
return result;
}
+/* This is not used directly, but creates translatable strings for
+ * the type string returned from /sys/.../cache */
+static const char* cache_types[] = {
+ NC_("cache-type", /*/cache type, as appears in: Level 1 (Data)*/ "Data"),
+ NC_("cache-type", /*/cache type, as appears in: Level 1 (Instruction)*/ "Instruction"),
+ NC_("cache-type", /*/cache type, as appears in: Level 2 (Unified)*/ "Unified")
+};
+
static void __cache_obtain_info(Processor *processor)
{
ProcessorCache *cache;
@@ -214,33 +226,6 @@ fail:
g_free(endpoint);
}
-int processor_has_flag(gchar * strflags, gchar * strflag)
-{
- gchar **flags;
- gint ret = 0;
- if (strflags == NULL || strflag == NULL)
- return 0;
- flags = g_strsplit(strflags, " ", 0);
- ret = g_strv_contains((const gchar * const *)flags, strflag);
- g_strfreev(flags);
- return ret;
-}
-
-static gint get_cpu_int(const gchar* file, gint cpuid) {
- gchar *tmp0 = NULL;
- gchar *tmp1 = NULL;
- gint ret = 0;
-
- tmp0 = g_strdup_printf("/sys/devices/system/cpu/cpu%d/%s", cpuid, file);
- g_file_get_contents(tmp0, &tmp1, NULL, NULL);
- if (tmp1)
- ret = atol(tmp1);
-
- g_free(tmp0);
- g_free(tmp1);
- return ret;
-}
-
GSList *processor_scan(void)
{
GSList *procs = NULL, *l = NULL;
@@ -248,7 +233,7 @@ GSList *processor_scan(void)
FILE *cpuinfo;
gchar buffer[512];
- cpuinfo = fopen("/proc/cpuinfo", "r");
+ cpuinfo = fopen(PROC_CPUINFO, "r");
if (!cpuinfo)
return NULL;
@@ -280,6 +265,7 @@ GSList *processor_scan(void)
get_str("flags", processor->flags);
get_str("bugs", processor->bugs);
get_str("power management", processor->pm);
+ get_str("microcode", processor->microcode);
get_int("cache size", processor->cache_size);
get_float("cpu MHz", processor->cpu_mhz);
get_float("bogomips", processor->bogomips);
@@ -290,6 +276,7 @@ GSList *processor_scan(void)
get_str("hlt_bug", processor->bug_hlt);
get_str("f00f_bug", processor->bug_f00f);
get_str("coma_bug", processor->bug_coma);
+ /* sep_bug? */
get_int("model", processor->model);
get_int("cpu family", processor->family);
@@ -298,6 +285,8 @@ GSList *processor_scan(void)
g_strfreev(tmp);
}
+ fclose(cpuinfo);
+
/* finish last */
if (processor)
procs = g_slist_append(procs, processor);
@@ -305,9 +294,17 @@ GSList *processor_scan(void)
for (l = procs; l; l = l->next) {
processor = (Processor *) l->data;
+ STRIFNULL(processor->microcode, _("(Not Available)") );
+
get_processor_strfamily(processor);
__cache_obtain_info(processor);
+#define NULLIFNOTYES(f) if (processor->f) if (strcmp(processor->f, "yes") != 0) { g_free(processor->f); processor->f = NULL; }
+ NULLIFNOTYES(bug_fdiv);
+ NULLIFNOTYES(bug_hlt);
+ NULLIFNOTYES(bug_f00f);
+ NULLIFNOTYES(bug_coma);
+
if (processor->bugs == NULL || g_strcmp0(processor->bugs, "") == 0) {
g_free(processor->bugs);
/* make bugs list on old kernels that don't offer one */
@@ -337,291 +334,38 @@ GSList *processor_scan(void)
g_strchug(processor->pm);
}
- /* freq */
- processor->cpukhz_cur = get_cpu_int("cpufreq/scaling_cur_freq", processor->id);
- processor->cpukhz_min = get_cpu_int("cpufreq/scaling_min_freq", processor->id);
- processor->cpukhz_max = get_cpu_int("cpufreq/scaling_max_freq", processor->id);
- if (processor->cpukhz_max)
- processor->cpu_mhz = processor->cpukhz_max / 1000;
- }
-
- fclose(cpuinfo);
-
- return procs;
-}
-
-/*
- * Sources:
- * - Linux' cpufeature.h
- * - http://gentoo-wiki.com/Cpuinfo
- * - Intel IA-32 Architecture Software Development Manual
- * - https://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean
- */
-static struct {
- char *name, *meaning;
-} flag_meaning[] = {
- { "3dnow", "3DNow! Technology" },
- { "3dnowext", "Extended 3DNow! Technology" },
- { "fpu", "Floating Point Unit" },
- { "vme", "Virtual 86 Mode Extension" },
- { "de", "Debug Extensions - I/O breakpoints" },
- { "pse", "Page Size Extensions (4MB pages)" },
- { "tsc", "Time Stamp Counter and RDTSC instruction" },
- { "msr", "Model Specific Registers" },
- { "pae", "Physical Address Extensions" },
- { "mce", "Machine Check Architecture" },
- { "cx8", "CMPXCHG8 instruction" },
- { "apic", "Advanced Programmable Interrupt Controller" },
- { "sep", "Fast System Call (SYSENTER/SYSEXIT)" },
- { "mtrr", "Memory Type Range Registers" },
- { "pge", "Page Global Enable" },
- { "mca", "Machine Check Architecture" },
- { "cmov", "Conditional Move instruction" },
- { "pat", "Page Attribute Table" },
- { "pse36", "36bit Page Size Extensions" },
- { "psn", "96 bit Processor Serial Number" },
- { "mmx", "MMX technology" },
- { "mmxext", "Extended MMX Technology" },
- { "cflush", "Cache Flush" },
- { "dtes", "Debug Trace Store" },
- { "fxsr", "FXSAVE and FXRSTOR instructions" },
- { "kni", "Streaming SIMD instructions" },
- { "xmm", "Streaming SIMD instructions" },
- { "ht", "HyperThreading" },
- { "mp", "Multiprocessing Capable" },
- { "sse", "SSE instructions" },
- { "sse2", "SSE2 (WNI) instructions" },
- { "acc", "Automatic Clock Control" },
- { "ia64", "IA64 Instructions" },
- { "syscall", "SYSCALL and SYSEXIT instructions" },
- { "nx", "No-execute Page Protection" },
- { "xd", "Execute Disable" },
- { "clflush", "Cache Line Flush instruction" },
- { "acpi", "Thermal Monitor and Software Controlled Clock" },
- { "dts", "Debug Store" },
- { "ss", "Self Snoop" },
- { "tm", "Thermal Monitor" },
- { "pbe", "Pending Break Enable" },
- { "pb", "Pending Break Enable" },
- { "pn", "Processor serial number" },
- { "ds", "Debug Store" },
- { "xmm2", "Streaming SIMD Extensions-2" },
- { "xmm3", "Streaming SIMD Extensions-3" },
- { "selfsnoop", "CPU self snoop" },
- { "rdtscp", "RDTSCP" },
- { "recovery", "CPU in recovery mode" },
- { "longrun", "Longrun power control" },
- { "lrti", "LongRun table interface" },
- { "cxmmx", "Cyrix MMX extensions" },
- { "k6_mtrr", "AMD K6 nonstandard MTRRs" },
- { "cyrix_arr", "Cyrix ARRs (= MTRRs)" },
- { "centaur_mcr","Centaur MCRs (= MTRRs)" },
- { "constant_tsc","TSC ticks at a constant rate" },
- { "up", "smp kernel running on up" },
- { "fxsave_leak","FXSAVE leaks FOP/FIP/FOP" },
- { "arch_perfmon","Intel Architectural PerfMon" },
- { "pebs", "Precise-Event Based Sampling" },
- { "bts", "Branch Trace Store" },
- { "sync_rdtsc", "RDTSC synchronizes the CPU" },
- { "rep_good", "rep microcode works well on this CPU" },
- { "mwait", "Monitor/Mwait support" },
- { "ds_cpl", "CPL Qualified Debug Store" },
- { "est", "Enhanced SpeedStep" },
- { "tm2", "Thermal Monitor 2" },
- { "cid", "Context ID" },
- { "xtpr", "Send Task Priority Messages" },
- { "xstore", "on-CPU RNG present (xstore insn)" },
- { "xstore_en", "on-CPU RNG enabled" },
- { "xcrypt", "on-CPU crypto (xcrypt insn)" },
- { "xcrypt_en", "on-CPU crypto enabled" },
- { "ace2", "Advanced Cryptography Engine v2" },
- { "ace2_en", "ACE v2 enabled" },
- { "phe", "PadLock Hash Engine" },
- { "phe_en", "PHE enabled" },
- { "pmm", "PadLock Montgomery Multiplier" },
- { "pmm_en", "PMM enabled" },
- { "lahf_lm", "LAHF/SAHF in long mode" },
- { "cmp_legacy", "HyperThreading not valid" },
- { "lm", "LAHF/SAHF in long mode" },
- { "ds_cpl", "CPL Qualified Debug Store" },
- { "vmx", "Virtualization support (Intel)" },
- { "svm", "Virtualization support (AMD)" },
- { "est", "Enhanced SpeedStep" },
- { "tm2", "Thermal Monitor 2" },
- { "ssse3", "Supplemental Streaming SIMD Extension 3" },
- { "cx16", "CMPXCHG16B instruction" },
- { "xptr", "Send Task Priority Messages" },
- { "pebs", "Precise Event Based Sampling" },
- { "bts", "Branch Trace Store" },
- { "ida", "Intel Dynamic Acceleration" },
- { "arch_perfmon","Intel Architectural PerfMon" },
- { "pni", "Streaming SIMD Extension 3 (Prescott New Instruction)" },
- { "rep_good", "rep microcode works well on this CPU" },
- { "ts", "Thermal Sensor" },
- { "sse3", "Streaming SIMD Extension 3" },
- { "sse4", "Streaming SIMD Extension 4" },
- { "tni", "Tejas New Instruction" },
- { "nni", "Nehalem New Instruction" },
- { "tpr", "Task Priority Register" },
- { "vid", "Voltage Identifier" },
- { "fid", "Frequency Identifier" },
- { "dtes64", "64-bit Debug Store" },
- { "monitor", "Monitor/Mwait support" },
- { "sse4_1", "Streaming SIMD Extension 4.1" },
- { "sse4_2", "Streaming SIMD Extension 4.2" },
- { "nopl", "NOPL instructions" },
- { "cxmmx", "Cyrix MMX extensions" },
- { "xtopology", "CPU topology enum extensions" },
- { "nonstop_tsc", "TSC does not stop in C states" },
- { "eagerfpu", "Non lazy FPU restor" },
- { "pclmulqdq", "Perform a Carry-Less Multiplication of Quadword instruction" },
- { "smx", "Safer mode: TXT (TPM support)" },
- { "pdcm", "Performance capabilities" },
- { "pcid", "Process Context Identifiers" },
- { "x2apic", "x2APIC" },
- { "popcnt", "Set bit count instructions" },
- { "aes", "Advanced Encryption Standard" },
- { "aes-ni", "Advanced Encryption Standard (New Instructions)" },
- { "xsave", "Save Processor Extended States" },
- { "avx", "Advanced Vector Instructions" },
- { NULL, NULL },
-};
-
-static struct {
- char *name, *meaning;
-} bug_meaning[] = {
- { "f00f", "Intel F00F bug" },
- { "fdiv", "FPU FDIV" },
- { "coma", "Cyrix 6x86 coma" },
- { "tlb_mmatch", "AMD Erratum 383" },
- { "apic_c1e", "AMD Erratum 400" },
- { "11ap", "Bad local APIC aka 11AP" },
- { "fxsave_leak", "FXSAVE leaks FOP/FIP/FOP" },
- { "clflush_monitor", "AAI65, CLFLUSH required before MONITOR" },
- { "sysret_ss_attrs", "SYSRET doesn't fix up SS attrs" },
- { "espfix", "IRET to 16-bit SS corrupts ESP/RSP high bits" },
- { "null_seg", "Nulling a selector preserves the base" }, /* see: detect_null_seg_behavior() */
- { "swapgs_fence","SWAPGS without input dep on GS" },
- { "monitor", "IPI required to wake up remote CPU" },
- { "amd_e400", "AMD Erratum 400" },
- { NULL, NULL },
-};
-
-/* from arch/x86/kernel/cpu/powerflags.h */
-static struct {
- char *name, *meaning;
-} pm_meaning[] = {
- { "ts", "temperature sensor" },
- { "fid", "frequency id control" },
- { "vid", "voltage id control" },
- { "ttp", "thermal trip" },
- { "tm", "hardware thermal control" },
- { "stc", "software thermal control" },
- { "100mhzsteps", "100 MHz multiplier control" },
- { "hwpstate", "hardware P-state control" },
-/* { "", "tsc invariant mapped to constant_tsc" }, */
- { "cpb", "core performance boost" },
- { "eff_freq_ro", "Readonly aperf/mperf" },
- { "proc_feedback", "processor feedback interface" },
- { "acc_power", "accumulated power mechanism" },
- { NULL, NULL },
-};
-
-GHashTable *cpu_flags = NULL;
-
-static void
-populate_cpu_flags_list_internal()
-{
- int i;
-
- DEBUG("using internal CPU flags database");
+ /* topo & freq */
+ processor->cpufreq = cpufreq_new(processor->id);
+ processor->cputopo = cputopo_new(processor->id);
- for (i = 0; flag_meaning[i].name != NULL; i++) {
- g_hash_table_insert(cpu_flags, flag_meaning[i].name,
- flag_meaning[i].meaning);
+ if (processor->cpufreq->cpukhz_max)
+ processor->cpu_mhz = processor->cpufreq->cpukhz_max / 1000;
}
- for (i = 0; bug_meaning[i].name != NULL; i++) {
- g_hash_table_insert(cpu_flags, bug_meaning[i].name,
- bug_meaning[i].meaning);
- }
- for (i = 0; pm_meaning[i].name != NULL; i++) {
- g_hash_table_insert(cpu_flags, pm_meaning[i].name,
- pm_meaning[i].meaning);
- }
-}
-
-void cpu_flags_init(void)
-{
- gint i;
- gchar *path;
-
- cpu_flags = g_hash_table_new(g_str_hash, g_str_equal);
-
- path = g_build_filename(g_get_home_dir(), ".hardinfo", "cpuflags.conf", NULL);
- if (!g_file_test(path, G_FILE_TEST_EXISTS)) {
- populate_cpu_flags_list_internal();
- } else {
- GKeyFile *flags_file;
- DEBUG("using %s as CPU flags database", path);
-
- flags_file = g_key_file_new();
- if (g_key_file_load_from_file(flags_file, path, 0, NULL)) {
- gchar **flag_keys;
-
- flag_keys = g_key_file_get_keys(flags_file, "flags",
- NULL, NULL);
- if (!flag_keys) {
- DEBUG("error while using %s as CPU flags database, falling back to internal",
- path);
- populate_cpu_flags_list_internal();
- } else {
- for (i = 0; flag_keys[i]; i++) {
- gchar *meaning;
-
- meaning = g_key_file_get_string(flags_file, "flags",
- flag_keys[i], NULL);
-
- g_hash_table_insert(cpu_flags, g_strdup(flag_keys[i]), meaning);
-
- /* can't free meaning */
- }
-
- g_strfreev(flag_keys);
- }
- }
-
- g_key_file_free(flags_file);
- }
-
- g_free(path);
+ return procs;
}
-gchar *processor_get_capabilities_from_flags(gchar * strflags)
+gchar *processor_get_capabilities_from_flags(gchar *strflags, gchar *lookup_prefix)
{
- /* FIXME:
- * - Separate between processor capabilities, additional instructions and whatnot.
- */
gchar **flags, **old;
+ gchar tmp_flag[64] = "";
+ const gchar *meaning;
gchar *tmp = NULL;
gint j = 0;
- if (!cpu_flags) {
- cpu_flags_init();
- }
-
flags = g_strsplit(strflags, " ", 0);
old = flags;
while (flags[j]) {
- gchar *meaning = g_hash_table_lookup(cpu_flags, flags[j]);
+ sprintf(tmp_flag, "%s%s", lookup_prefix, flags[j]);
+ meaning = x86_flag_meaning(tmp_flag);
- if (meaning) {
- tmp = h_strdup_cprintf("%s=%s\n", tmp, flags[j], meaning);
+ if (meaning) {
+ tmp = h_strdup_cprintf("%s=%s\n", tmp, flags[j], meaning);
} else {
- tmp = h_strdup_cprintf("%s=\n", tmp, flags[j]);
+ tmp = h_strdup_cprintf("%s=\n", tmp, flags[j]);
}
- j++;
+ j++;
}
if (tmp == NULL || g_strcmp0(tmp, "") == 0)
tmp = g_strdup_printf("%s=%s\n", "empty", _("Empty List"));
@@ -632,96 +376,120 @@ gchar *processor_get_capabilities_from_flags(gchar * strflags)
gchar *processor_get_detailed_info(Processor * processor)
{
- gchar *tmp_flags, *tmp_bugs, *tmp_pm, *ret, *cache_info;
+ gchar *tmp_flags, *tmp_bugs, *tmp_pm, *tmp_cpufreq, *tmp_topology, *ret, *cache_info;
- tmp_flags = processor_get_capabilities_from_flags(processor->flags);
- tmp_bugs = processor_get_capabilities_from_flags(processor->bugs);
- tmp_pm = processor_get_capabilities_from_flags(processor->pm);
+ tmp_flags = processor_get_capabilities_from_flags(processor->flags, "");
+ tmp_bugs = processor_get_capabilities_from_flags(processor->bugs, "bug:");
+ tmp_pm = processor_get_capabilities_from_flags(processor->pm, "pm:");
cache_info = __cache_get_info_as_string(processor);
- ret = g_strdup_printf(_("[Processor]\n"
- "Name=%s\n"
- "Family, model, stepping=%d, %d, %d (%s)\n"
- "Vendor=%s\n"
- "[Configuration]\n"
- "Cache Size=%dkb\n"
- "Frequency=%.2fMHz\n"
- "BogoMIPS=%.2f\n"
- "Byte Order=%s\n"
- "[Frequency Scaling]\n"
- "Minimum=%d kHz\n"
- "Maximum=%d kHz\n"
- "Current=%d kHz\n"
- "[Features]\n"
- "Has FPU=%s\n"
- "[Cache]\n"
- "%s\n"
- "[Power Management]\n"
- "%s"
- "[Bugs]\n"
- "%s"
- "[Capabilities]\n"
- "%s"),
- processor->model_name,
- processor->family,
- processor->model,
- processor->stepping,
- processor->strmodel,
- vendor_get_name(processor->vendor_id),
- processor->cache_size,
- processor->cpu_mhz, processor->bogomips,
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- "Little Endian",
-#else
- "Big Endian",
-#endif
- processor->cpukhz_min,
- processor->cpukhz_max,
- processor->cpukhz_cur,
- processor->has_fpu ? processor->has_fpu : "no",
- cache_info,
- tmp_pm, tmp_bugs, tmp_flags);
+ tmp_topology = cputopo_section_str(processor->cputopo);
+ tmp_cpufreq = cpufreq_section_str(processor->cpufreq);
+
+ ret = g_strdup_printf("[%s]\n"
+ "%s=%s\n"
+ "%s=%d, %d, %d (%s)\n" /* family, model, stepping (decoded name) */
+ "%s=%s\n" /* vendor */
+ "%s=%s\n" /* microcode */
+ "[%s]\n" /* configuration */
+ "%s=%d %s\n" /* cache size (from cpuinfo) */
+ "%s=%.2f %s\n" /* frequency */
+ "%s=%.2f\n" /* bogomips */
+ "%s=%s\n" /* byte order */
+ "%s" /* topology */
+ "%s" /* frequency scaling */
+ "[%s]\n" /* cache */
+ "%s\n"
+ "[%s]\n" /* pm */
+ "%s"
+ "[%s]\n" /* bugs */
+ "%s"
+ "[%s]\n" /* flags */
+ "%s",
+ _("Processor"),
+ _("Model Name"), processor->model_name,
+ _("Family, model, stepping"),
+ processor->family,
+ processor->model,
+ processor->stepping,
+ processor->strmodel,
+ _("Vendor"), vendor_get_name(processor->vendor_id),
+ _("Microcode Version"), processor->microcode,
+ _("Configuration"),
+ _("Cache Size"), processor->cache_size, _("kb"),
+ _("Frequency"), processor->cpu_mhz, _("MHz"),
+ _("BogoMips"), processor->bogomips,
+ _("Byte Order"), byte_order_str(),
+ tmp_topology,
+ tmp_cpufreq,
+ _("Cache"), cache_info,
+ _("Power Management"), tmp_pm,
+ _("Bug Workarounds"), tmp_bugs,
+ _("Capabilities"), tmp_flags );
g_free(tmp_flags);
g_free(tmp_bugs);
g_free(tmp_pm);
g_free(cache_info);
+ g_free(tmp_cpufreq);
+ g_free(tmp_topology);
+ return ret;
+}
+
+gchar *processor_name(GSList * processors) {
+ return processor_name_default(processors);
+}
+gchar *processor_describe(GSList * processors) {
+ return processor_describe_default(processors);
+}
+
+gchar *processor_meta(GSList * processors) {
+ gchar *meta_cpu_name = processor_name(processors);
+ gchar *meta_cpu_desc = processor_describe(processors);
+ gchar *ret = NULL;
+ UNKIFNULL(meta_cpu_desc);
+ ret = g_strdup_printf("[%s]\n"
+ "%s=%s\n"
+ "%s=%s\n",
+ _("Package Information"),
+ _("Name"), meta_cpu_name,
+ _("Description"), meta_cpu_desc);
+ g_free(meta_cpu_desc);
return ret;
}
gchar *processor_get_info(GSList * processors)
{
Processor *processor;
+ gchar *ret, *tmp, *hashkey;
+ gchar *meta; /* becomes owned by more_info? no need to free? */
+ GSList *l;
- if (g_slist_length(processors) > 1) {
- gchar *ret, *tmp, *hashkey;
- GSList *l;
-
- tmp = g_strdup("");
+ tmp = g_strdup_printf("$CPU_META$%s=\n", _("Package Information") );
- for (l = processors; l; l = l->next) {
- processor = (Processor *) l->data;
+ meta = processor_meta(processors);
+ moreinfo_add_with_prefix("DEV", "CPU_META", meta);
- tmp = g_strdup_printf(_("%s$CPU%d$%s=%.2fMHz\n"),
- tmp, processor->id,
- processor->model_name,
- processor->cpu_mhz);
-
- hashkey = g_strdup_printf("CPU%d", processor->id);
- moreinfo_add_with_prefix("DEV", hashkey,
- processor_get_detailed_info(processor));
- g_free(hashkey);
- }
+ for (l = processors; l; l = l->next) {
+ processor = (Processor *) l->data;
- ret = g_strdup_printf("[$ShellParam$]\n"
- "ViewType=1\n"
- "[Processors]\n"
- "%s", tmp);
- g_free(tmp);
+ tmp = g_strdup_printf("%s$CPU%d$%s=%.2f %s\n",
+ tmp, processor->id,
+ processor->model_name,
+ processor->cpu_mhz, _("MHz"));
- return ret;
+ hashkey = g_strdup_printf("CPU%d", processor->id);
+ moreinfo_add_with_prefix("DEV", hashkey,
+ processor_get_detailed_info(processor));
+ g_free(hashkey);
}
- processor = (Processor *) processors->data;
- return processor_get_detailed_info(processor);
+ ret = g_strdup_printf("[$ShellParam$]\n"
+ "ViewType=1\n"
+ "[Processors]\n"
+ "%s", tmp);
+ g_free(tmp);
+
+ return ret;
}
+