aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index fbad8dfbb186..536ee148bff8 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -46,6 +46,7 @@
46struct annotation_options annotation__default_options = { 46struct annotation_options annotation__default_options = {
47 .use_offset = true, 47 .use_offset = true,
48 .jump_arrows = true, 48 .jump_arrows = true,
49 .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS,
49}; 50};
50 51
51const char *disassembler_style; 52const char *disassembler_style;
@@ -2512,7 +2513,8 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
2512 if (!notes->options->use_offset) { 2513 if (!notes->options->use_offset) {
2513 printed = scnprintf(bf, sizeof(bf), "%" PRIx64 ": ", addr); 2514 printed = scnprintf(bf, sizeof(bf), "%" PRIx64 ": ", addr);
2514 } else { 2515 } else {
2515 if (al->jump_sources) { 2516 if (al->jump_sources &&
2517 notes->options->offset_level >= ANNOTATION__OFFSET_JUMP_TARGETS) {
2516 if (notes->options->show_nr_jumps) { 2518 if (notes->options->show_nr_jumps) {
2517 int prev; 2519 int prev;
2518 printed = scnprintf(bf, sizeof(bf), "%*d ", 2520 printed = scnprintf(bf, sizeof(bf), "%*d ",
@@ -2523,9 +2525,14 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
2523 obj__printf(obj, bf); 2525 obj__printf(obj, bf);
2524 obj__set_color(obj, prev); 2526 obj__set_color(obj, prev);
2525 } 2527 }
2526 2528print_addr:
2527 printed = scnprintf(bf, sizeof(bf), "%*" PRIx64 ": ", 2529 printed = scnprintf(bf, sizeof(bf), "%*" PRIx64 ": ",
2528 notes->widths.target, addr); 2530 notes->widths.target, addr);
2531 } else if (ins__is_call(&disasm_line(al)->ins) &&
2532 notes->options->offset_level >= ANNOTATION__OFFSET_CALL) {
2533 goto print_addr;
2534 } else if (notes->options->offset_level == ANNOTATION__MAX_OFFSET_LEVEL) {
2535 goto print_addr;
2529 } else { 2536 } else {
2530 printed = scnprintf(bf, sizeof(bf), "%-*s ", 2537 printed = scnprintf(bf, sizeof(bf), "%-*s ",
2531 notes->widths.addr, " "); 2538 notes->widths.addr, " ");
@@ -2642,10 +2649,11 @@ int __annotation__scnprintf_samples_period(struct annotation *notes,
2642 */ 2649 */
2643static struct annotation_config { 2650static struct annotation_config {
2644 const char *name; 2651 const char *name;
2645 bool *value; 2652 void *value;
2646} annotation__configs[] = { 2653} annotation__configs[] = {
2647 ANNOTATION__CFG(hide_src_code), 2654 ANNOTATION__CFG(hide_src_code),
2648 ANNOTATION__CFG(jump_arrows), 2655 ANNOTATION__CFG(jump_arrows),
2656 ANNOTATION__CFG(offset_level),
2649 ANNOTATION__CFG(show_linenr), 2657 ANNOTATION__CFG(show_linenr),
2650 ANNOTATION__CFG(show_nr_jumps), 2658 ANNOTATION__CFG(show_nr_jumps),
2651 ANNOTATION__CFG(show_nr_samples), 2659 ANNOTATION__CFG(show_nr_samples),
@@ -2677,8 +2685,16 @@ static int annotation__config(const char *var, const char *value,
2677 2685
2678 if (cfg == NULL) 2686 if (cfg == NULL)
2679 pr_debug("%s variable unknown, ignoring...", var); 2687 pr_debug("%s variable unknown, ignoring...", var);
2680 else 2688 else if (strcmp(var, "annotate.offset_level") == 0) {
2681 *cfg->value = perf_config_bool(name, value); 2689 perf_config_int(cfg->value, name, value);
2690
2691 if (*(int *)cfg->value > ANNOTATION__MAX_OFFSET_LEVEL)
2692 *(int *)cfg->value = ANNOTATION__MAX_OFFSET_LEVEL;
2693 else if (*(int *)cfg->value < ANNOTATION__MIN_OFFSET_LEVEL)
2694 *(int *)cfg->value = ANNOTATION__MIN_OFFSET_LEVEL;
2695 } else {
2696 *(bool *)cfg->value = perf_config_bool(name, value);
2697 }
2682 return 0; 2698 return 0;
2683} 2699}
2684 2700