diff options
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 36 |
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)) |