Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77a6f014 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo
Browse files

perf stat: Use perf_evlist__create_maps



Use same function with perf record and top to share the code checks
combinations of different switches.

Signed-off-by: default avatarNamhyung Kim <namhyung.kim@lge.com>
Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1336367344-28071-8-git-send-email-namhyung.kim@lge.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent d67356e7
Loading
Loading
Loading
Loading
+8 −14
Original line number Original line Diff line number Diff line
@@ -175,7 +175,9 @@ static struct perf_event_attr very_very_detailed_attrs[] = {


static struct perf_evlist	*evsel_list;
static struct perf_evlist	*evsel_list;


static struct perf_target	target;
static struct perf_target	target = {
	.uid	= UINT_MAX,
};


static int			run_idx				=  0;
static int			run_idx				=  0;
static int			run_count			=  1;
static int			run_count			=  1;
@@ -1205,20 +1207,12 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)


	perf_target__validate(&target);
	perf_target__validate(&target);


	evsel_list->threads = thread_map__new_str(target.pid,
	if (perf_evlist__create_maps(evsel_list, &target) < 0) {
						  target.tid, UINT_MAX);
		if (!perf_target__no_task(&target))
	if (evsel_list->threads == NULL) {
			pr_err("Problems finding threads of monitor\n");
			pr_err("Problems finding threads of monitor\n");
		usage_with_options(stat_usage, options);
		if (!perf_target__no_cpu(&target))
	}

	if (target.system_wide)
		evsel_list->cpus = cpu_map__new(target.cpu_list);
	else
		evsel_list->cpus = cpu_map__dummy_new();

	if (evsel_list->cpus == NULL) {
			perror("failed to parse CPUs map");
			perror("failed to parse CPUs map");

		usage_with_options(stat_usage, options);
		usage_with_options(stat_usage, options);
		return -1;
		return -1;
	}
	}