aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2013-05-13 22:09:02 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-05-28 09:24:00 -0400
commit27a0dcb7adb52473dd98d285a46b764b9219d303 (patch)
tree52deb89bf5ef67e3749b2e2a026837a76f93d3f2 /tools/perf/builtin-report.c
parent3a5714f8b58913ded4d9e90abdd30e7e5993f863 (diff)
perf hists: Move locking to its call-sites
It's a preparation patch to eliminate unneeded locking in the perf report path. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> 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> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1368497347-9628-5-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d45bf9b0361d..63febd24e912 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -297,6 +297,7 @@ static int process_sample_event(struct perf_tool *tool,
297{ 297{
298 struct perf_report *rep = container_of(tool, struct perf_report, tool); 298 struct perf_report *rep = container_of(tool, struct perf_report, tool);
299 struct addr_location al; 299 struct addr_location al;
300 int ret;
300 301
301 if (perf_event__preprocess_sample(event, machine, &al, sample, 302 if (perf_event__preprocess_sample(event, machine, &al, sample,
302 rep->annotate_init) < 0) { 303 rep->annotate_init) < 0) {
@@ -311,28 +312,29 @@ static int process_sample_event(struct perf_tool *tool,
311 if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap)) 312 if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap))
312 return 0; 313 return 0;
313 314
315 pthread_mutex_lock(&evsel->hists.lock);
316
314 if (sort__mode == SORT_MODE__BRANCH) { 317 if (sort__mode == SORT_MODE__BRANCH) {
315 if (perf_report__add_branch_hist_entry(tool, &al, sample, 318 ret = perf_report__add_branch_hist_entry(tool, &al, sample,
316 evsel, machine)) { 319 evsel, machine);
320 if (ret < 0)
317 pr_debug("problem adding lbr entry, skipping event\n"); 321 pr_debug("problem adding lbr entry, skipping event\n");
318 return -1;
319 }
320 } else if (rep->mem_mode == 1) { 322 } else if (rep->mem_mode == 1) {
321 if (perf_report__add_mem_hist_entry(tool, &al, sample, 323 ret = perf_report__add_mem_hist_entry(tool, &al, sample,
322 evsel, machine, event)) { 324 evsel, machine, event);
325 if (ret < 0)
323 pr_debug("problem adding mem entry, skipping event\n"); 326 pr_debug("problem adding mem entry, skipping event\n");
324 return -1;
325 }
326 } else { 327 } else {
327 if (al.map != NULL) 328 if (al.map != NULL)
328 al.map->dso->hit = 1; 329 al.map->dso->hit = 1;
329 330
330 if (perf_evsel__add_hist_entry(evsel, &al, sample, machine)) { 331 ret = perf_evsel__add_hist_entry(evsel, &al, sample, machine);
332 if (ret < 0)
331 pr_debug("problem incrementing symbol period, skipping event\n"); 333 pr_debug("problem incrementing symbol period, skipping event\n");
332 return -1;
333 }
334 } 334 }
335 return 0; 335 pthread_mutex_unlock(&evsel->hists.lock);
336
337 return ret;
336} 338}
337 339
338static int process_read_event(struct perf_tool *tool, 340static int process_read_event(struct perf_tool *tool,