aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-04-14 16:45:51 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-04-14 18:46:56 -0400
commit6f736735e30f51805f6be31d20a4bf5b0ae91bae (patch)
treebc26c54ba215e4891ee6fa60e881074aa543d744 /tools/perf/builtin-script.c
parentbfbba189b681c86b9ae380358e5f50ce1e33d240 (diff)
perf evsel: Require that callchains be resolved before calling fprintf_{sym,callchain}
This way the print routine merely does printing, not requiring access to the resolving machinery, which helps disentangling the object files and easing creating subsets with a limited functionality set. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-2ti2jbra8fypdfawwwm3aee3@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r--tools/perf/builtin-script.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 717ba0215234..875d84e7ba5b 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -569,19 +569,23 @@ static void print_sample_bts(struct perf_sample *sample,
569 /* print branch_from information */ 569 /* print branch_from information */
570 if (PRINT_FIELD(IP)) { 570 if (PRINT_FIELD(IP)) {
571 unsigned int print_opts = output[attr->type].print_ip_opts; 571 unsigned int print_opts = output[attr->type].print_ip_opts;
572 struct callchain_cursor *cursor = NULL, cursor_callchain;
572 573
573 if (symbol_conf.use_callchain && sample->callchain) { 574 if (symbol_conf.use_callchain && sample->callchain &&
574 printf("\n"); 575 thread__resolve_callchain(al->thread, &cursor_callchain, evsel,
575 } else { 576 sample, NULL, NULL, scripting_max_stack) == 0)
576 printf(" "); 577 cursor = &cursor_callchain;
578
579 if (cursor == NULL) {
580 putchar(' ');
577 if (print_opts & EVSEL__PRINT_SRCLINE) { 581 if (print_opts & EVSEL__PRINT_SRCLINE) {
578 print_srcline_last = true; 582 print_srcline_last = true;
579 print_opts &= ~EVSEL__PRINT_SRCLINE; 583 print_opts &= ~EVSEL__PRINT_SRCLINE;
580 } 584 }
581 } 585 } else
582 perf_evsel__fprintf_sym(evsel, sample, al, 0, print_opts, 586 putchar('\n');
583 symbol_conf.use_callchain, 587
584 scripting_max_stack, stdout); 588 sample__fprintf_sym(sample, al, 0, print_opts, cursor, stdout);
585 } 589 }
586 590
587 /* print branch_to information */ 591 /* print branch_to information */
@@ -784,15 +788,15 @@ static void process_event(struct perf_script *script,
784 printf("%16" PRIu64, sample->weight); 788 printf("%16" PRIu64, sample->weight);
785 789
786 if (PRINT_FIELD(IP)) { 790 if (PRINT_FIELD(IP)) {
787 if (!symbol_conf.use_callchain) 791 struct callchain_cursor *cursor = NULL, cursor_callchain;
788 printf(" "); 792
789 else 793 if (symbol_conf.use_callchain &&
790 printf("\n"); 794 thread__resolve_callchain(al->thread, &cursor_callchain, evsel,
795 sample, NULL, NULL, scripting_max_stack) == 0)
796 cursor = &cursor_callchain;
791 797
792 perf_evsel__fprintf_sym(evsel, sample, al, 0, 798 putchar(cursor ? '\n' : ' ');
793 output[attr->type].print_ip_opts, 799 sample__fprintf_sym(sample, al, 0, output[attr->type].print_ip_opts, cursor, stdout);
794 symbol_conf.use_callchain,
795 scripting_max_stack, stdout);
796 } 800 }
797 801
798 if (PRINT_FIELD(IREGS)) 802 if (PRINT_FIELD(IREGS))