lkml.org 
[lkml]   [2014]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 10/21] perf, c2c: Add stats to track data source bits and cpu to node maps
On Mon, Feb 10, 2014 at 12:29:05PM -0500, Don Zickus wrote:
> This patch adds a bunch of stats that will be used later in post-processing
> to determine where and with what frequency the HITMs are coming from.
>
> Most of the stats are decoded from the data source response. Another
> piece of the stats is tracking which cpu the record came in on.
>
> In order to properly build a cpu map to map where interesting events are coming
> from, I shamelessly copy-n-pasted the cpu->NUMA node code from builtin-kmem.c.
>
> As HITMs are most expensive when going across NUMA nodes, it only made sense
> to create a quick cpu->NUMA lookup for when processing the records.
>
> Credit to Dick Fowles for determining which bits are important and how to
> properly track them. Ported to perf by me.
>
> Original-by: Dick Fowles <rfowles@redhat.com>
> Signed-off-by: Don Zickus <dzickus@redhat.com>
> ---

SNIP

> +
> +static int setup_cpunode_map(void)
> +{
> + struct dirent *dent1, *dent2;
> + DIR *dir1, *dir2;
> + unsigned int cpu, mem;
> + char buf[PATH_MAX];
> +
> + /* initialize globals */
> + if (init_cpunode_map())
> + return -1;
> +
> + dir1 = opendir(PATH_SYS_NODE);
> + if (!dir1)
> + return 0;
> +
> + /* walk tree and setup map */
> + while ((dent1 = readdir(dir1)) != NULL) {
> + if (dent1->d_type != DT_DIR ||
> + sscanf(dent1->d_name, "node%u", &mem) < 1)
> + continue;
> +
> + snprintf(buf, PATH_MAX, "%s/%s", PATH_SYS_NODE, dent1->d_name);
> + dir2 = opendir(buf);
> + if (!dir2)
> + continue;
> + while ((dent2 = readdir(dir2)) != NULL) {
> + if (dent2->d_type != DT_LNK ||
> + sscanf(dent2->d_name, "cpu%u", &cpu) < 1)
> + continue;
> + cpunode_map[cpu] = mem;
> + }
> + closedir(dir2);
> + }
> + closedir(dir1);
> + return 0;
> +}


There's already setup_cpunode_map interface in builtin-kmem.c
Please make it global (maybe place in separate object?)
and use this one.

jirka


\
 
 \ /
  Last update: 2014-02-18 15:21    [W:0.375 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site