aboutsummaryrefslogtreecommitdiff
path: root/modules/devices/x86/processor.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-11-28 20:51:06 -0600
committerLeandro A. F. Pereira <leandro@hardinfo.org>2017-11-29 07:50:11 -0800
commit44c925eb1a04ff5a5c63e70c427e644690557bb9 (patch)
treebd83a5e7e9c6754992471bba400ba7b81c06e480 /modules/devices/x86/processor.c
parent9ea63eb6b2cc7a880c0e93168777600067e8551f (diff)
x86 CPU flags fix; show socket:core and thread in proc list
* Bug fix: Some flags are just an index, for example power management might have "[13] [14]" as flags. This looks like a new section to hardinfo shell and it truncates the CPU information there. * Show the Socket:Core and thread in the processor list, for x86 only right now. In the future, the idea is to show only one line for each core, and list the threads on that core, where currently, there is one line for each thread. Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/devices/x86/processor.c')
-rw-r--r--modules/devices/x86/processor.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/modules/devices/x86/processor.c b/modules/devices/x86/processor.c
index ad3c7ca4..605c9dbf 100644
--- a/modules/devices/x86/processor.c
+++ b/modules/devices/x86/processor.c
@@ -351,19 +351,27 @@ gchar *processor_get_capabilities_from_flags(gchar *strflags, gchar *lookup_pref
gchar tmp_flag[64] = "";
const gchar *meaning;
gchar *tmp = NULL;
- gint j = 0;
+ gint j = 0, i = 0;
flags = g_strsplit(strflags, " ", 0);
old = flags;
while (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 ( sscanf(flags[j], "[%d]", &i) ) {
+ /* Some flags are indexes, like [13], and that looks like
+ * a new section to hardinfo shell */
+ tmp = h_strdup_cprintf("(%s%d)=\n", tmp,
+ (lookup_prefix) ? lookup_prefix : "",
+ i );
} else {
- tmp = h_strdup_cprintf("%s=\n", tmp, 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);
+ } else {
+ tmp = h_strdup_cprintf("%s=\n", tmp, flags[j]);
+ }
}
j++;
}
@@ -473,10 +481,13 @@ gchar *processor_get_info(GSList * processors)
for (l = processors; l; l = l->next) {
processor = (Processor *) l->data;
- tmp = g_strdup_printf("%s$CPU%d$%s=%.2f %s\n",
+ tmp = g_strdup_printf("%s$CPU%d$%s=%.2f %s|%d:%d|%d\n",
tmp, processor->id,
processor->model_name,
- processor->cpu_mhz, _("MHz"));
+ processor->cpu_mhz, _("MHz"),
+ processor->cputopo->socket_id,
+ processor->cputopo->core_id,
+ processor->cputopo->id );
hashkey = g_strdup_printf("CPU%d", processor->id);
moreinfo_add_with_prefix("DEV", hashkey,
@@ -486,8 +497,10 @@ gchar *processor_get_info(GSList * processors)
ret = g_strdup_printf("[$ShellParam$]\n"
"ViewType=1\n"
+ "ColumnTitle$Extra1=%s\n"
+ "ColumnTitle$Extra2=%s\n"
"[Processors]\n"
- "%s", tmp);
+ "%s", _("Socket:Core"), _("Thread" /*TODO: +s*/), tmp);
g_free(tmp);
return ret;