Re: [PATCH 09/11] perf stat: Use perf_evlist__create_maps

From: Arnaldo Carvalho de Melo
Date: Mon Feb 13 2012 - 13:40:17 EST


Em Mon, Feb 13, 2012 at 04:27:41PM +0900, Namhyung Kim escreveu:
> Use same function with perf record and top to share the code
> checks combinations of different switches.

Haven't fully checked, but if equivalent, nice cleanup!

- Arnaldo

> Signed-off-by: Namhyung Kim <namhyung.kim@xxxxxxx>
> ---
> tools/perf/builtin-stat.c | 16 ++--------------
> 1 files changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index d080254a2d0c..be2667236bea 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -196,6 +196,7 @@ static int output_fd;
> static struct perf_maps_opts maps = {
> .target_pid = -1,
> .target_tid = -1,
> + .uid = UINT_MAX,
> };
>
> static volatile int done = 0;
> @@ -1208,20 +1209,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
>
> check_target_maps(&maps);
>
> - evsel_list->threads = thread_map__new(maps.target_pid, maps.target_tid,
> - UINT_MAX);
> - if (evsel_list->threads == NULL) {
> - pr_err("Problems finding threads of monitor\n");
> - usage_with_options(stat_usage, options);
> - }
> -
> - if (maps.system_wide)
> - evsel_list->cpus = cpu_map__new(maps.cpu_list);
> - else
> - evsel_list->cpus = cpu_map__dummy_new();
> -
> - if (evsel_list->cpus == NULL) {
> - perror("failed to parse CPUs map");
> + if (perf_evlist__create_maps(evsel_list, &maps) < 0) {
> usage_with_options(stat_usage, options);
> return -1;
> }
> --
> 1.7.9
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/