diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-03-11 11:43:14 +0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-03-15 20:06:02 +0400 |
commit | b3a319d528fd57ef600731ee1b84d00b7204881d (patch) | |
tree | fadbcc4a692d5a4e841af9823c527eca7c5dc7dc /tools/perf/builtin-stat.c | |
parent | 85397956de304106e2fdace2db8f69ab4e966bc5 (diff) | |
download | linux-b3a319d528fd57ef600731ee1b84d00b7204881d.tar.xz |
perf evlist: Add thread_map__nr() helper
Introduce and use the thread_map__nr() function to protect a possible
NULL pointer dereference and cleanup the code a bit.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1362987798-24969-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r-- | tools/perf/builtin-stat.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 020329dca005..20ffaf98782e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -249,7 +249,7 @@ static int read_counter_aggr(struct perf_evsel *counter) int i; if (__perf_evsel__read(counter, perf_evsel__nr_cpus(counter), - evsel_list->threads->nr, scale) < 0) + thread_map__nr(evsel_list->threads), scale) < 0) return -1; for (i = 0; i < 3; i++) @@ -488,7 +488,7 @@ static int __run_perf_stat(int argc __maybe_unused, const char **argv) list_for_each_entry(counter, &evsel_list->entries, node) { read_counter_aggr(counter); perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter), - evsel_list->threads->nr); + thread_map__nr(evsel_list->threads)); } } |