diff options
author | Leandro Pereira <leandro@hardinfo.org> | 2021-02-25 18:42:55 -0800 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2021-02-25 18:42:55 -0800 |
commit | dd35567b8063cdf179bce5c45108aa9b637d3898 (patch) | |
tree | a0025244ecdf102c23e510670938bdadc4ebec3d /modules | |
parent | 51ec888d834eeadae60c9b73e78d1672cadba796 (diff) |
Consider number of NUMA nodes while counting cores
Diffstat (limited to 'modules')
-rw-r--r-- | modules/devices.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/devices.c b/modules/devices.c index d6f30aef..73c18a90 100644 --- a/modules/devices.c +++ b/modules/devices.c @@ -177,9 +177,14 @@ gchar *processor_describe_default(GSList * processors) packs_fmt = ngettext("%d physical processor", "%d physical processors", packs); cores_fmt = ngettext("%d core", "%d cores", cores); threads_fmt = ngettext("%d thread", "%d threads", threads); - nodes_fmt = ngettext("%d NUMA node", "%d NUMA nodes", nodes); - full_fmt = g_strdup_printf(_(/*/NP procs; NC cores; NN nodes; NT threads*/ "%s; %s, %s; %s"), packs_fmt, cores_fmt, nodes_fmt, threads_fmt); - ret = g_strdup_printf(full_fmt, packs, cores, nodes, threads); + if (nodes > 1) { + nodes_fmt = ngettext("%d NUMA node", "%d NUMA nodes", nodes); + full_fmt = g_strdup_printf(_(/*/NP procs; NC cores across NN nodes; NT threads*/ "%s; %s across %s; %s"), packs_fmt, cores_fmt, nodes_fmt, threads_fmt); + ret = g_strdup_printf(full_fmt, packs, cores * nodes, nodes, threads); + } else { + full_fmt = g_strdup_printf(_(/*/NP procs; NC cores; NT threads*/ "%s; %s; %s"), packs_fmt, cores_fmt, threads_fmt); + ret = g_strdup_printf(full_fmt, packs, cores, nodes, threads); + } g_free(full_fmt); return ret; } else { |