perf stat: Add --per-node option
Jiri Olsa
reviewerv2 cover perf stat: Add --per-node option
hi,
adding --per-node option to aggregate stats per NUMA nodes, you can get now use stat command like:
# perf stat -a -I 1000 -e cycles --per-node
# time node cpus counts unit events
1.000542550 N0 20 6,202,097 cycles
1.000542550 N1 20 639,559 cycles
2.002040063 N0 20 7,412,495 cycles
2.002040063 N1 20 2,185,577 cycles
3.003451699 N0 20 6,508,917 cycles
3.003451699 N1 20 765,607 cycles
...v2 changes:
- use mallox instead of zalloc plus adding comment [Arnaldo]
- rename --per-numa to --per-node [Alexey]
- rename function names to have node instead of numa
Available also in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixes
thanks,
jirka
---
Jiri Olsa (3):
libperf: Add perf_cpu_map__max function perf tools: Add perf_env__numa_node function perf stat: Add --per-node agregation support
tools/perf/Documentation/perf-stat.txt | 5 +++++ tools/perf/builtin-stat.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- tools/perf/lib/cpumap.c | 12 ++++++++++++ tools/perf/lib/include/perf/cpumap.h | 1 + tools/perf/lib/libperf.map | 1 + tools/perf/util/cpumap.c | 18 ++++++++++++++++++ tools/perf/util/cpumap.h | 3 +++ tools/perf/util/env.c | 40 ++++++++++++++++++++++++++++++++++++++++ tools/perf/util/env.h | 6 ++++++ tools/perf/util/stat-display.c | 15 +++++++++++++++ tools/perf/util/stat.c | 1 + tools/perf/util/stat.h | 1 + 12 files changed, 153 insertions(+), 10 deletions(-)
Jiri Olsa
reviewerPATCH v2 1/3 libperf: Add perf_cpu_map__max function
So it can be used from multiple places.
--- tools/perf/builtin-stat.c | 14 +------------- tools/perf/lib/cpumap.c | 12 ++++++++++++ tools/perf/lib/include/perf/cpumap.h | 1 + tools/perf/lib/libperf.map | 1 + 4 files changed, 15 insertions(+), 13 deletions(-)
tools/perf/builtin-stat.c +1 -13
@@ -822,18 +822,6 @@ static int perf_stat__get_core(struct perf_stat_config *config __maybe_unused,return cpu_map__get_core (map, cpu,NULL ); } -static int cpu_map__get_max (struct perf_cpu_map *map) -{ -int i, max =-1 ; - -for (i =0 ; i < map->nr; i++) { -if (map->map[i] > max) - max = map->map[i]; - } - -return max; -} -static int perf_stat__get_aggr (struct perf_stat_config *config,aggr_get_id_t get_id,struct perf_cpu_map *map,int idx) {
@@ -928,7 +916,7 @@ static int perf_stat_init_aggr_mode(void)* taking the highest cpu number to be the size of * the aggregation translate cpumap. */ - nr =cpu_map__get_max (evsel_list->core.cpus); + nr =perf_cpu_map__max (evsel_list->core.cpus); stat_config.cpus_aggr_map =perf_cpu_map__empty_new (nr +1 );return stat_config.cpus_aggr_map ?0 : -ENOMEM ; }
tools/perf/lib/cpumap.c +12 -0
@@ -260,3 +260,15 @@ int perf_cpu_map__idx(struct perf_cpu_map *cpus, int cpu)return -1 ; } + +int perf_cpu_map__max (struct perf_cpu_map *map) +{ +int i, max =-1 ; + +for (i =0 ; i < map->nr; i++) { +if (map->map[i] > max) + max = map->map[i]; + } + +return max; +}
tools/perf/lib/include/perf/cpumap.h +1 -0
@@ -16,6 +16,7 @@ LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map); LIBPERF_API int perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx); LIBPERF_API int perf_cpu_map__nr(const struct perf_cpu_map *cpus); LIBPERF_API bool perf_cpu_map__empty(const struct perf_cpu_map *map); +LIBPERF_API int perf_cpu_map__max(struct perf_cpu_map *map);#define perf_cpu_map__for_each_cpu (cpu, idx, cpus) \ for ((idx) = 0, (cpu) = perf_cpu_map__cpu(cpus, idx); \
tools/perf/lib/libperf.map +1 -0
@@ -9,6 +9,7 @@ LIBPERF_0.0.1 { perf_cpu_map__nr; perf_cpu_map__cpu; perf_cpu_map__empty; + perf_cpu_map__max; perf_thread_map__new_dummy; perf_thread_map__set_pid; perf_thread_map__comm;
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH v2 2/3 perf tools: Add perf_env__numa_node function
In reply to Jiri OlsaTo speed up cpu to node lookup, adding perf_env__numa_node function, that creates cpu array on the first lookup, that holds numa nodes for each stored cpu.
--- tools/perf/util/env.c | 40 ++++++++++++++++++++++++++++++++++++++++ tools/perf/util/env.h | 6 ++++++ 2 files changed, 46 insertions(+)
tools/perf/util/env.c +40 -0
@@ -179,6 +179,7 @@ void perf_env__exit(struct perf_env *env)zfree (&env->sibling_threads);zfree (&env->pmu_mappings);zfree (&env->cpu); +zfree (&env->numa_map);for (i =0 ; i < env->nr_numa_nodes; i++)perf_cpu_map__put (env->numa_nodes[i].map);
@@ -338,3 +339,42 @@ const char *perf_env__arch(struct perf_env *env)return normalize_arch (arch_name); } + + +int perf_env__numa_node (struct perf_env *env,int cpu) +{ +if (!env->nr_numa_map) { +struct numa_node *nn; +int i, nr =0 ; + +for (i =0 ; i < env->nr_numa_nodes; i++) { + nn = &env->numa_nodes[i]; + nr =max (nr,perf_cpu_map__max (nn->map)); + } + + nr++; + +/* +* We initialize the numa_map array to prepare +* it for missing cpus, which return node -1. +*/ + env->numa_map =malloc (nr *sizeof (int )); +if (!env->numa_map) +return -1 ; + +for (i =0 ; i < nr; i++) + env->numa_map[i] =-1 ; + + env->nr_numa_map = nr; + +for (i =0 ; i < env->nr_numa_nodes; i++) { +int tmp, j; + + nn = &env->numa_nodes[i]; +perf_cpu_map__for_each_cpu (j, tmp, nn->map) + env->numa_map[j] = i; + } + } + +return cpu >=0 && cpu < env->nr_numa_map ? env->numa_map[cpu] :-1 ; +}
tools/perf/util/env.h +6 -0
@@ -86,6 +86,10 @@ struct perf_env {struct rb_root btfs;u32 btfs_cnt; } bpf_progs; + +/* For fast cpu to numa node lookup via perf_env__numa_node */ +int *numa_map; +int nr_numa_map; };enum perf_compress_type {
@@ -118,4 +122,6 @@ struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env, __u32 prog_id);void perf_env__insert_btf (struct perf_env *env,struct btf_node *btf_node);struct btf_node *perf_env__find_btf (struct perf_env *env,__u32 btf_id); + +int perf_env__numa_node (struct perf_env *env,int cpu);#endif /* __PERF_ENV_H */
Signature · 1 line
2.21.0
[tip: perf/core] perf env: Add perf_env__numa_node()
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 389799a7a1e86c55f38897e679762efadcc9dedd Gitweb: https://git.kernel.org/tip/389799a7a1e86c55f38897e679762efadcc9dedd Author: Jiri Olsa <[email protected]> AuthorDate: Thu, 29 Aug 2019 13:31:48 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Wed, 06 Nov 2019 15:49:39 -03:00
perf env: Add perf_env__numa_node()
To speed up cpu to node lookup, add perf_env__numa_node(), that creates cpu array on the first lookup, that holds numa nodes for each stored cpu.
--- tools/perf/util/env.c | 40 ++++++++++++++++++++++++++++++++++++++++ tools/perf/util/env.h | 6 ++++++ 2 files changed, 46 insertions(+)
tools/perf/util/env.c +40 -0
@@ -180,6 +180,7 @@ void perf_env__exit(struct perf_env *env)zfree (&env->sibling_threads);zfree (&env->pmu_mappings);zfree (&env->cpu); +zfree (&env->numa_map);for (i =0 ; i < env->nr_numa_nodes; i++)perf_cpu_map__put (env->numa_nodes[i].map);
@@ -354,3 +355,42 @@ const char *perf_env__arch(struct perf_env *env)return normalize_arch (arch_name); } + + +int perf_env__numa_node (struct perf_env *env,int cpu) +{ +if (!env->nr_numa_map) { +struct numa_node *nn; +int i, nr =0 ; + +for (i =0 ; i < env->nr_numa_nodes; i++) { + nn = &env->numa_nodes[i]; + nr =max (nr,perf_cpu_map__max (nn->map)); + } + + nr++; + +/* +* We initialize the numa_map array to prepare +* it for missing cpus, which return node -1 +*/ + env->numa_map =malloc (nr *sizeof (int )); +if (!env->numa_map) +return -1 ; + +for (i =0 ; i < nr; i++) + env->numa_map[i] =-1 ; + + env->nr_numa_map = nr; + +for (i =0 ; i < env->nr_numa_nodes; i++) { +int tmp, j; + + nn = &env->numa_nodes[i]; +perf_cpu_map__for_each_cpu (j, tmp, nn->map) + env->numa_map[j] = i; + } + } + +return cpu >=0 && cpu < env->nr_numa_map ? env->numa_map[cpu] :-1 ; +}
tools/perf/util/env.h +6 -0
@@ -87,6 +87,10 @@ struct perf_env {struct rb_root btfs;u32 btfs_cnt; } bpf_progs; + +/* For fast cpu to numa node lookup via perf_env__numa_node */ +int *numa_map; +int nr_numa_map; };enum perf_compress_type {
@@ -120,4 +124,6 @@ struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env, __u32 prog_id);void perf_env__insert_btf (struct perf_env *env,struct btf_node *btf_node);struct btf_node *perf_env__find_btf (struct perf_env *env,__u32 btf_id); + +int perf_env__numa_node (struct perf_env *env,int cpu);#endif /* __PERF_ENV_H */
Jiri Olsa
reviewerPATCH v2 3/3 perf stat: Add --per-node agregation support
In reply to Jiri OlsaAdding new --per-node option to aggregate counts per NUMA nodes for system-wide mode measurements.
You can specify --per-node in live mode:
# perf stat -a -I 1000 -e cycles --per-node
# time node cpus counts unit events
1.000542550 N0 20 6,202,097 cycles
1.000542550 N1 20 639,559 cycles
2.002040063 N0 20 7,412,495 cycles
2.002040063 N1 20 2,185,577 cycles
3.003451699 N0 20 6,508,917 cycles
3.003451699 N1 20 765,607 cycles
...Or in the record/report stat session:
# perf stat record -a -I 1000 -e cycles
# time counts unit events
1.000536937 10,008,468 cycles
2.002090152 9,578,539 cycles
3.003625233 7,647,869 cycles
4.005135036 7,032,086 cycles
^C 4.340902364 3,923,893 cycles # perf stat report --per-node
# time node cpus counts unit events
1.000536937 N0 20 9,355,086 cycles
1.000536937 N1 20 653,382 cycles
2.002090152 N0 20 7,712,838 cycles
2.002090152 N1 20 1,865,701 cycles
3.003625233 N0 20 6,604,441 cycles
3.003625233 N1 20 1,043,428 cycles
4.005135036 N0 20 6,350,522 cycles
4.005135036 N1 20 681,564 cycles
4.340902364 N0 20 3,403,188 cycles
4.340902364 N1 20 520,705 cycles--- tools/perf/Documentation/perf-stat.txt | 5 +++ tools/perf/builtin-stat.c | 52 ++++++++++++++++++++++++++ tools/perf/util/cpumap.c | 18 +++++++++ tools/perf/util/cpumap.h | 3 ++ tools/perf/util/stat-display.c | 15 ++++++++ tools/perf/util/stat.c | 1 + tools/perf/util/stat.h | 1 + 7 files changed, 95 insertions(+)
tools/perf/Documentation/perf-stat.txt +5 -0
@@ -217,6 +217,11 @@ core number and the number of online logical processors on that physical process Aggregate counts per monitored threads, when monitoring threads (-t option) or processes (-p option). +--per-node:: +Aggregate counts per NUMA nodes for system-wide mode measurements. This +is a useful mode to detect imbalance between NUMA nodes. To enable this +mode, use --per-node in addition to -a. (system-wide). + -D msecs:: --delay msecs:: After starting the program, wait msecs before measuring. This is useful to
tools/perf/builtin-stat.c +52 -0
112 lines not on this page · raw message
tools/perf/util/cpumap.c +18 -0
@@ -206,6 +206,11 @@ int cpu_map__get_core_id(int cpu)return ret ?: value; } +int cpu_map__get_node_id (int cpu) +{ +return cpu__get_node (cpu); +} +int cpu_map__get_core (struct perf_cpu_map *map,int idx,void *data) {int cpu, s_die;
@@ -235,6 +240,14 @@ int cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data)return (s_die <<16 ) | (cpu &0xffff ); } +int cpu_map__get_node (struct perf_cpu_map *map,int idx,void *data__maybe_unused ) +{ +if (idx <0 || idx >= map->nr) +return -1 ; + +return cpu_map__get_node_id (map->map[idx]); +} +int cpu_map__build_socket_map (struct perf_cpu_map *cpus,struct perf_cpu_map **sockp) {return cpu_map__build_map (cpus, sockp, cpu_map__get_socket,NULL );
@@ -250,6 +263,11 @@ int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **correturn cpu_map__build_map (cpus, corep, cpu_map__get_core,NULL ); } +int cpu_map__build_node_map (struct perf_cpu_map *cpus,struct perf_cpu_map **nodep) +{ +return cpu_map__build_map (cpus, nodep, cpu_map__get_node,NULL ); +} +/* setup simple routines to easily access node numbers given a cpu number */ static int get_max_num (char *path,int *max) {
tools/perf/util/cpumap.h +3 -0
@@ -20,9 +20,12 @@ int cpu_map__get_die_id(int cpu);int cpu_map__get_die (struct perf_cpu_map *map,int idx,void *data);int cpu_map__get_core_id (int cpu);int cpu_map__get_core (struct perf_cpu_map *map,int idx,void *data); +int cpu_map__get_node_id (int cpu); +int cpu_map__get_node (struct perf_cpu_map *map,int idx,void *data);int cpu_map__build_socket_map (struct perf_cpu_map *cpus,struct perf_cpu_map **sockp);int cpu_map__build_die_map (struct perf_cpu_map *cpus,struct perf_cpu_map **diep);int cpu_map__build_core_map (struct perf_cpu_map *cpus,struct perf_cpu_map **corep); +int cpu_map__build_node_map (struct perf_cpu_map *cpus,struct perf_cpu_map **nodep);const struct perf_cpu_map *cpu_map__online (void );/* thread unsafe */ static inline int cpu_map__socket (struct perf_cpu_map *sock,int s)
tools/perf/util/stat-display.c +15 -0
@@ -100,6 +100,15 @@ static void aggr_printout(struct perf_stat_config *config, nr, config->csv_sep);break ; +case AGGR_NODE : +fprintf (config->output,"N%*d%s%*d%s" , + config->csv_output ?0 :-5 , + id, + config->csv_sep, + config->csv_output ?0 :4 , + nr, + config->csv_sep); +break ;case AGGR_NONE :if (evsel->percore) { fprintf(config->output, "S%d-D%d-C%*d%s",
@@ -965,6 +974,11 @@ static void print_interval(struct perf_stat_config *config,if ((num_print_interval ==0 && !config->csv_output) || config->interval_clear) {switch (config->aggr_mode) { +case AGGR_NODE : +fprintf (output,"# time node cpus" ); +if (!metric_only) +fprintf (output," counts %*s events\n" , unit_width,"unit" ); +break ;case AGGR_SOCKET :fprintf (output,"# time socket cpus" );if (!metric_only)
@@ -1188,6 +1202,7 @@ perf_evlist__print_counters(struct evlist *evlist,case AGGR_CORE :case AGGR_DIE :case AGGR_SOCKET : +case AGGR_NODE :print_aggr (config, evlist, prefix);break ;case AGGR_THREAD :
tools/perf/util/stat.c +1 -0
@@ -281,6 +281,7 @@ process_counter_values(struct perf_stat_config *config, struct evsel *evsel,case AGGR_CORE :case AGGR_DIE :case AGGR_SOCKET : +case AGGR_NODE :case AGGR_NONE :if (!evsel->snapshot)perf_evsel__compute_deltas (evsel, cpu, thread, count);
tools/perf/util/stat.h +1 -0
@@ -46,6 +46,7 @@ enum aggr_mode {AGGR_CORE ,AGGR_THREAD ,AGGR_UNSET , + AGGR_NODE, }; enum {
Signature · 1 line
2.21.0
[tip: perf/core] perf stat: Add --per-node agregation support
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 86895b480a2f10c7c6659fc5312f84b93011ce2d Gitweb: https://git.kernel.org/tip/86895b480a2f10c7c6659fc5312f84b93011ce2d Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 28 Aug 2019 10:17:43 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Wed, 06 Nov 2019 15:49:39 -03:00
perf stat: Add --per-node agregation support
Adding new --per-node option to aggregate counts per NUMA nodes for system-wide mode measurements.
You can specify --per-node in live mode:
# perf stat -a -I 1000 -e cycles --per-node
# time node cpus counts unit events
1.000542550 N0 20 6,202,097 cycles
1.000542550 N1 20 639,559 cycles
2.002040063 N0 20 7,412,495 cycles
2.002040063 N1 20 2,185,577 cycles
3.003451699 N0 20 6,508,917 cycles
3.003451699 N1 20 765,607 cycles
...Or in the record/report stat session:
# perf stat record -a -I 1000 -e cycles
# time counts unit events
1.000536937 10,008,468 cycles
2.002090152 9,578,539 cycles
3.003625233 7,647,869 cycles
4.005135036 7,032,086 cycles
^C 4.340902364 3,923,893 cycles # perf stat report --per-node
# time node cpus counts unit events
1.000536937 N0 20 9,355,086 cycles
1.000536937 N1 20 653,382 cycles
2.002090152 N0 20 7,712,838 cycles
2.002090152 N1 20 1,865,701 cycles
3.003625233 N0 20 6,604,441 cycles
3.003625233 N1 20 1,043,428 cycles
4.005135036 N0 20 6,350,522 cycles
4.005135036 N1 20 681,564 cycles
4.340902364 N0 20 3,403,188 cycles
4.340902364 N1 20 520,705 cycles--- tools/perf/Documentation/perf-stat.txt | 5 ++- tools/perf/builtin-stat.c | 52 +++++++++++++++++++++++++- tools/perf/util/cpumap.c | 18 +++++++++- tools/perf/util/cpumap.h | 3 +- tools/perf/util/stat-display.c | 15 +++++++- tools/perf/util/stat.c | 1 +- tools/perf/util/stat.h | 1 +- 7 files changed, 95 insertions(+)
tools/perf/Documentation/perf-stat.txt +5 -0
@@ -217,6 +217,11 @@ core number and the number of online logical processors on that physical process Aggregate counts per monitored threads, when monitoring threads (-t option) or processes (-p option). +--per-node:: +Aggregate counts per NUMA nodes for system-wide mode measurements. This +is a useful mode to detect imbalance between NUMA nodes. To enable this +mode, use --per-node in addition to -a. (system-wide). + -D msecs:: --delay msecs:: After starting the program, wait msecs before measuring. This is useful to
tools/perf/builtin-stat.c +52 -0
112 lines not on this page · raw message
tools/perf/util/cpumap.c +18 -0
@@ -206,6 +206,11 @@ int cpu_map__get_core_id(int cpu)return ret ?: value; } +int cpu_map__get_node_id (int cpu) +{ +return cpu__get_node (cpu); +} +int cpu_map__get_core (struct perf_cpu_map *map,int idx,void *data) {int cpu, s_die;
@@ -235,6 +240,14 @@ int cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data)return (s_die <<16 ) | (cpu &0xffff ); } +int cpu_map__get_node (struct perf_cpu_map *map,int idx,void *data__maybe_unused ) +{ +if (idx <0 || idx >= map->nr) +return -1 ; + +return cpu_map__get_node_id (map->map[idx]); +} +int cpu_map__build_socket_map (struct perf_cpu_map *cpus,struct perf_cpu_map **sockp) {return cpu_map__build_map (cpus, sockp, cpu_map__get_socket,NULL );
@@ -250,6 +263,11 @@ int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **correturn cpu_map__build_map (cpus, corep, cpu_map__get_core,NULL ); } +int cpu_map__build_node_map (struct perf_cpu_map *cpus,struct perf_cpu_map **numap) +{ +return cpu_map__build_map (cpus, numap, cpu_map__get_node,NULL ); +} +/* setup simple routines to easily access node numbers given a cpu number */ static int get_max_num (char *path,int *max) {
tools/perf/util/cpumap.h +3 -0
@@ -20,9 +20,12 @@ int cpu_map__get_die_id(int cpu);int cpu_map__get_die (struct perf_cpu_map *map,int idx,void *data);int cpu_map__get_core_id (int cpu);int cpu_map__get_core (struct perf_cpu_map *map,int idx,void *data); +int cpu_map__get_node_id (int cpu); +int cpu_map__get_node (struct perf_cpu_map *map,int idx,void *data);int cpu_map__build_socket_map (struct perf_cpu_map *cpus,struct perf_cpu_map **sockp);int cpu_map__build_die_map (struct perf_cpu_map *cpus,struct perf_cpu_map **diep);int cpu_map__build_core_map (struct perf_cpu_map *cpus,struct perf_cpu_map **corep); +int cpu_map__build_node_map (struct perf_cpu_map *cpus,struct perf_cpu_map **nodep);const struct perf_cpu_map *cpu_map__online (void );/* thread unsafe */ static inline int cpu_map__socket (struct perf_cpu_map *sock,int s)
tools/perf/util/stat-display.c +15 -0
@@ -100,6 +100,15 @@ static void aggr_printout(struct perf_stat_config *config, nr, config->csv_sep);break ; +case AGGR_NODE : +fprintf (config->output,"N%*d%s%*d%s" , + config->csv_output ?0 :-5 , + id, + config->csv_sep, + config->csv_output ?0 :4 , + nr, + config->csv_sep); +break ;case AGGR_NONE :if (evsel->percore) { fprintf(config->output, "S%d-D%d-C%*d%s",
@@ -965,6 +974,11 @@ static void print_interval(struct perf_stat_config *config,if ((num_print_interval ==0 && !config->csv_output) || config->interval_clear) {switch (config->aggr_mode) { +case AGGR_NODE : +fprintf (output,"# time node cpus" ); +if (!metric_only) +fprintf (output," counts %*s events\n" , unit_width,"unit" ); +break ;case AGGR_SOCKET :fprintf (output,"# time socket cpus" );if (!metric_only)
@@ -1188,6 +1202,7 @@ perf_evlist__print_counters(struct evlist *evlist,case AGGR_CORE :case AGGR_DIE :case AGGR_SOCKET : +case AGGR_NODE :print_aggr (config, evlist, prefix);break ;case AGGR_THREAD :
tools/perf/util/stat.c +1 -0
@@ -299,6 +299,7 @@ process_counter_values(struct perf_stat_config *config, struct evsel *evsel,case AGGR_CORE :case AGGR_DIE :case AGGR_SOCKET : +case AGGR_NODE :case AGGR_NONE :if (!evsel->snapshot)perf_evsel__compute_deltas (evsel, cpu, thread, count);
tools/perf/util/stat.h +1 -0
@@ -47,6 +47,7 @@ enum aggr_mode {AGGR_CORE ,AGGR_THREAD ,AGGR_UNSET , + AGGR_NODE, }; enum {
Quoted 14 lines · Jiri Olsa
hi,
adding --per-node option to aggregate stats per NUMA nodes, you can get now use stat command like:# perf stat -a -I 1000 -e cycles --per-node # time node cpus counts unit events 1.000542550 N0 20 6,202,097 cycles 1.000542550 N1 20 639,559 cycles 2.002040063 N0 20 7,412,495 cycles 2.002040063 N1 20 2,185,577 cycles 3.003451699 N0 20 6,508,917 cycles 3.003451699 N1 20 765,607 cycles ...
Quoted 8 lines
v2 changes:
- use mallox instead of zalloc plus adding comment [Arnaldo]
- rename --per-numa to --per-node [Alexey]
- rename function names to have node instead of numaAvailable also in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixes
I forgot about this one ;-) rebased the latest perf/core and pushed out..
thanks,
jirka
Quoted 24 lines
thanks,
jirka---
Jiri Olsa (3):
libperf: Addperf_cpu_map__maxfunction perf tools: Addperf_env__numa_nodefunction perf stat: Add --per-node agregation supporttools/perf/Documentation/perf-stat.txt | 5 +++++ tools/perf/builtin-stat.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- tools/perf/lib/cpumap.c | 12 ++++++++++++ tools/perf/lib/include/perf/cpumap.h | 1 + tools/perf/lib/libperf.map | 1 + tools/perf/util/cpumap.c | 18 ++++++++++++++++++ tools/perf/util/cpumap.h | 3 +++ tools/perf/util/env.c | 40 ++++++++++++++++++++++++++++++++++++++++ tools/perf/util/env.h | 6 ++++++ tools/perf/util/stat-display.c | 15 +++++++++++++++ tools/perf/util/stat.c | 1 + tools/perf/util/stat.h | 1 + 12 files changed, 153 insertions(+), 10 deletions(-)
Arnaldo Carvalho de Melo
AppliedEm Tue, Nov 05, 2019 at 02:03:54PM +0100, Jiri Olsa escreveu:
Quoted 20 lines · Jiri Olsa
Quoted 19 lines
hi,
adding --per-node option to aggregate stats per NUMA nodes, you can get now use stat command like:# perf stat -a -I 1000 -e cycles --per-node # time node cpus counts unit events 1.000542550 N0 20 6,202,097 cycles 1.000542550 N1 20 639,559 cycles 2.002040063 N0 20 7,412,495 cycles 2.002040063 N1 20 2,185,577 cycles 3.003451699 N0 20 6,508,917 cycles 3.003451699 N1 20 765,607 cycles ...v2 changes:
- use mallox instead of zalloc plus adding comment [Arnaldo]
- rename --per-numa to --per-node [Alexey]
- rename function names to have node instead of numa
Quoted 6 lines
Quoted 3 lines
Available also in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixesI forgot about this one ;-) rebased the latest perf/core and pushed out..
Thanks, applied.
- Arnaldo