aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-04-16 02:14:00 -0400
committerIngo Molnar <mingo@kernel.org>2018-04-16 02:15:22 -0400
commitaacd188a2deea4e0886e43641cdae6b47b540b7f (patch)
tree7896329830230b757348867ec1d3536405c2e982 /tools/perf/util
parent60cc43fc888428bb2f18f08997432d426a243338 (diff)
parentb0d5c81e872ed21de1e56feb0fa6e4161da7be61 (diff)
Merge tag 'perf-core-for-mingo-4.17-20180413' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull tooling improvements and fixes from Arnaldo Carvalho de Melo: perf annotate fixes and improvements: - Allow showing offsets in more than just jump targets, use the new 'O' hotkey in the TUI, config ~/.perfconfig annotate.offset_level for it and for --stdio2 (Arnaldo Carvalho de Melo) - Use the resolved variable names from objdump disassembled lines to make them more compact, just like was already done for some instructions, like "mov", this eventually will be done more generally, but lets now add some more to the existing mechanism (Arnaldo Carvalho de Melo) perf record fixes: - Change warning for missing topology sysfs entry to debug, as not all architectures have those files, s390 being one of those (Thomas Richter) perf sched fixes: - Fix -g/--call-graph documentation (Takuya Yamamoto) perf stat: - Enable 1ms interval for printing event counters values in (Alexey Budankov) perf test fixes: - Run dwarf unwind on arm32 (Kim Phillips) - Remove unused ptrace.h include from LLVM test, sidesteping older clang's lack of support for some asm constructs (Arnaldo Carvalho de Melo) perf version fixes: - Do not print info about HAVE_LIBAUDIT_SUPPORT in 'perf version --build-options' when HAVE_SYSCALL_TABLE_SUPPORT is true, as libaudit won't be used in that case, print info about syscall_table support instead (Jin Yao) Build system fixes: - Use HAVE_..._SUPPORT used consistently (Jin Yao) - Restore READ_ONCE() C++ compatibility in tools/include (Mark Rutland) - Give hints about package names needed to build jvmti (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/annotate.c26
-rw-r--r--tools/perf/util/annotate.h9
-rwxr-xr-xtools/perf/util/generate-cmdlist.sh2
-rw-r--r--tools/perf/util/header.c3
-rw-r--r--tools/perf/util/symbol.c8
-rw-r--r--tools/perf/util/syscalltbl.c6
-rw-r--r--tools/perf/util/trace-event-scripting.c4
7 files changed, 41 insertions, 17 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
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index db8d09bea07e..f28a9e43421d 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -70,8 +70,17 @@ struct annotation_options {
70 show_nr_jumps, 70 show_nr_jumps,
71 show_nr_samples, 71 show_nr_samples,
72 show_total_period; 72 show_total_period;
73 u8 offset_level;
73}; 74};
74 75
76enum {
77 ANNOTATION__OFFSET_JUMP_TARGETS = 1,
78 ANNOTATION__OFFSET_CALL,
79 ANNOTATION__MAX_OFFSET_LEVEL,
80};
81
82#define ANNOTATION__MIN_OFFSET_LEVEL ANNOTATION__OFFSET_JUMP_TARGETS
83
75extern struct annotation_options annotation__default_options; 84extern struct annotation_options annotation__default_options;
76 85
77struct annotation; 86struct annotation;
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index ff17920a5ebc..c3cef36d4176 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -38,7 +38,7 @@ do
38done 38done
39echo "#endif /* HAVE_LIBELF_SUPPORT */" 39echo "#endif /* HAVE_LIBELF_SUPPORT */"
40 40
41echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)" 41echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT)"
42sed -n -e 's/^perf-\([^ ]*\)[ ].* audit*/\1/p' command-list.txt | 42sed -n -e 's/^perf-\([^ ]*\)[ ].* audit*/\1/p' command-list.txt |
43sort | 43sort |
44while read cmd 44while read cmd
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 121df1683c36..a8bff2178fbc 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1320,7 +1320,8 @@ static int build_mem_topology(struct memory_node *nodes, u64 size, u64 *cntp)
1320 1320
1321 dir = opendir(path); 1321 dir = opendir(path);
1322 if (!dir) { 1322 if (!dir) {
1323 pr_warning("failed: can't open node sysfs data\n"); 1323 pr_debug2("%s: could't read %s, does this arch have topology information?\n",
1324 __func__, path);
1324 return -1; 1325 return -1;
1325 } 1326 }
1326 1327
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 62b2dd2253eb..1466814ebada 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2091,16 +2091,14 @@ static bool symbol__read_kptr_restrict(void)
2091 2091
2092int symbol__annotation_init(void) 2092int symbol__annotation_init(void)
2093{ 2093{
2094 if (symbol_conf.init_annotation)
2095 return 0;
2096
2094 if (symbol_conf.initialized) { 2097 if (symbol_conf.initialized) {
2095 pr_err("Annotation needs to be init before symbol__init()\n"); 2098 pr_err("Annotation needs to be init before symbol__init()\n");
2096 return -1; 2099 return -1;
2097 } 2100 }
2098 2101
2099 if (symbol_conf.init_annotation) {
2100 pr_warning("Annotation being initialized multiple times\n");
2101 return 0;
2102 }
2103
2104 symbol_conf.priv_size += sizeof(struct annotation); 2102 symbol_conf.priv_size += sizeof(struct annotation);
2105 symbol_conf.init_annotation = true; 2103 symbol_conf.init_annotation = true;
2106 return 0; 2104 return 0;
diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c
index 895122d638dd..0ee7f568d60c 100644
--- a/tools/perf/util/syscalltbl.c
+++ b/tools/perf/util/syscalltbl.c
@@ -17,7 +17,7 @@
17#include <stdlib.h> 17#include <stdlib.h>
18#include <linux/compiler.h> 18#include <linux/compiler.h>
19 19
20#ifdef HAVE_SYSCALL_TABLE 20#ifdef HAVE_SYSCALL_TABLE_SUPPORT
21#include <string.h> 21#include <string.h>
22#include "string2.h" 22#include "string2.h"
23#include "util.h" 23#include "util.h"
@@ -139,7 +139,7 @@ int syscalltbl__strglobmatch_first(struct syscalltbl *tbl, const char *syscall_g
139 return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx); 139 return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx);
140} 140}
141 141
142#else /* HAVE_SYSCALL_TABLE */ 142#else /* HAVE_SYSCALL_TABLE_SUPPORT */
143 143
144#include <libaudit.h> 144#include <libaudit.h>
145 145
@@ -176,4 +176,4 @@ int syscalltbl__strglobmatch_first(struct syscalltbl *tbl, const char *syscall_g
176{ 176{
177 return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx); 177 return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx);
178} 178}
179#endif /* HAVE_SYSCALL_TABLE */ 179#endif /* HAVE_SYSCALL_TABLE_SUPPORT */
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 0ac9077f62a2..b1e5c3a2b8e3 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -98,7 +98,7 @@ static void register_python_scripting(struct scripting_ops *scripting_ops)
98 } 98 }
99} 99}
100 100
101#ifdef NO_LIBPYTHON 101#ifndef HAVE_LIBPYTHON_SUPPORT
102void setup_python_scripting(void) 102void setup_python_scripting(void)
103{ 103{
104 register_python_scripting(&python_scripting_unsupported_ops); 104 register_python_scripting(&python_scripting_unsupported_ops);
@@ -161,7 +161,7 @@ static void register_perl_scripting(struct scripting_ops *scripting_ops)
161 } 161 }
162} 162}
163 163
164#ifdef NO_LIBPERL 164#ifndef HAVE_LIBPERL_SUPPORT
165void setup_perl_scripting(void) 165void setup_perl_scripting(void)
166{ 166{
167 register_perl_scripting(&perl_scripting_unsupported_ops); 167 register_perl_scripting(&perl_scripting_unsupported_ops);