From dd35567b8063cdf179bce5c45108aa9b637d3898 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Thu, 25 Feb 2021 18:42:55 -0800 Subject: Consider number of NUMA nodes while counting cores --- modules/devices.c | 11 ++++++++--- 1 file 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 { -- cgit v1.2.3