From ae102f359f3f433008674dc19f445438b4ee55fd Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Mon, 13 May 2013 00:00:00 -0500 Subject: [PATCH] top: reduce function call overhead in the NUMA support Signed-off-by: Jim Warner --- top/top.c | 3 ++- top/top.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/top/top.c b/top/top.c index 01ea3835..042e5fe7 100644 --- a/top/top.c +++ b/top/top.c @@ -2406,6 +2406,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus) { #ifndef NUMA_DISABLE if (Numa_node_tot && -1 < (node = Numa_node_of_cpu(cpus[i].id))) { + cpus[i].node = node; node += (sumSLOT + 1); cpus[node].cur.u += cpus[i].cur.u; cpus[node].cur.n += cpus[i].cur.n; @@ -5037,7 +5038,7 @@ static void summary_show (void) { summary_hlp(&smpcpu[1 + smp_num_cpus + Numa_node_sel], tmp); Msg_row += 1; for (i = 0; i < Cpu_faux_tot; i++) { - if (Numa_node_sel == Numa_node_of_cpu(smpcpu[i].id)) { + if (Numa_node_sel == smpcpu[i].node) { if (!isROOM(anyFLG, 1)) break; snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), smpcpu[i].id); summary_hlp(&smpcpu[i], tmp); diff --git a/top/top.h b/top/top.h index 7c595348..01434ed0 100644 --- a/top/top.h +++ b/top/top.h @@ -276,6 +276,9 @@ typedef struct CPU_t { SIC_t edge; // tics adjustment threshold boundary #endif int id; // the cpu id number (0 - nn) +#ifndef NUMA_DISABLE + int node; // the numa node it belongs to +#endif } CPU_t; /* /////////////////////////////////////////////////////////////// */