top: reduce function call overhead in the NUMA support

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2013-05-13 00:00:00 -05:00 committed by Craig Small
parent a6c7923106
commit ae102f359f
2 changed files with 5 additions and 1 deletions

View File

@ -2406,6 +2406,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus) {
#ifndef NUMA_DISABLE #ifndef NUMA_DISABLE
if (Numa_node_tot if (Numa_node_tot
&& -1 < (node = Numa_node_of_cpu(cpus[i].id))) { && -1 < (node = Numa_node_of_cpu(cpus[i].id))) {
cpus[i].node = node;
node += (sumSLOT + 1); node += (sumSLOT + 1);
cpus[node].cur.u += cpus[i].cur.u; cpus[node].cur.u += cpus[i].cur.u;
cpus[node].cur.n += cpus[i].cur.n; 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); summary_hlp(&smpcpu[1 + smp_num_cpus + Numa_node_sel], tmp);
Msg_row += 1; Msg_row += 1;
for (i = 0; i < Cpu_faux_tot; i++) { 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; if (!isROOM(anyFLG, 1)) break;
snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), smpcpu[i].id); snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), smpcpu[i].id);
summary_hlp(&smpcpu[i], tmp); summary_hlp(&smpcpu[i], tmp);

View File

@ -276,6 +276,9 @@ typedef struct CPU_t {
SIC_t edge; // tics adjustment threshold boundary SIC_t edge; // tics adjustment threshold boundary
#endif #endif
int id; // the cpu id number (0 - nn) int id; // the cpu id number (0 - nn)
#ifndef NUMA_DISABLE
int node; // the numa node it belongs to
#endif
} CPU_t; } CPU_t;
/* /////////////////////////////////////////////////////////////// */ /* /////////////////////////////////////////////////////////////// */