diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-12 21:20:11 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-12 21:20:11 -0400 |
| commit | ade0899b298ba2c43bfd6abd8cbc2545944cde0c (patch) | |
| tree | a448dfb440b3b958b6306bb43620cd5d76f504bf /tools/perf/util | |
| parent | 871a0596cb2f51b57dc583d1a7c4be0186582fe7 (diff) | |
| parent | 95cf59ea72331d0093010543b8951bb43f262cac (diff) | |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar:
"This tree includes some late late perf items that missed the first
round:
tools:
- Bash auto completion improvements, now we can auto complete the
tools long options, tracepoint event names, etc, from Namhyung Kim.
- Look up thread using tid instead of pid in 'perf sched'.
- Move global variables into a perf_kvm struct, from David Ahern.
- Hists refactorings, preparatory for improved 'diff' command, from
Jiri Olsa.
- Hists refactorings, preparatory for event group viewieng work, from
Namhyung Kim.
- Remove double negation on optional feature macro definitions, from
Namhyung Kim.
- Remove several cases of needless global variables, on most
builtins.
- misc fixes
kernel:
- sysfs support for IBS on AMD CPUs, from Robert Richter.
- Support for an upcoming Intel CPU, the Xeon-Phi / Knights Corner
HPC blade PMU, from Vince Weaver.
- misc fixes"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits)
perf: Fix perf_cgroup_switch for sw-events
perf: Clarify perf_cpu_context::active_pmu usage by renaming it to ::unique_pmu
perf/AMD/IBS: Add sysfs support
perf hists: Add more helpers for hist entry stat
perf hists: Move he->stat.nr_events initialization to a template
perf hists: Introduce struct he_stat
perf diff: Removing the total_period argument from output code
perf tool: Add hpp interface to enable/disable hpp column
perf tools: Removing hists pair argument from output path
perf hists: Separate overhead and baseline columns
perf diff: Refactor diff displacement possition info
perf hists: Add struct hists pointer to struct hist_entry
perf tools: Complete tracepoint event names
perf/x86: Add support for Intel Xeon-Phi Knights Corner PMU
perf evlist: Remove some unused methods
perf evlist: Introduce add_newtp method
perf kvm: Move global variables into a perf_kvm struct
perf tools: Convert to BACKTRACE_SUPPORT
perf tools: Long option completion support for each subcommands
perf tools: Complete long option names of perf command
...
Diffstat (limited to 'tools/perf/util')
| -rw-r--r-- | tools/perf/util/annotate.h | 8 | ||||
| -rw-r--r-- | tools/perf/util/cache.h | 38 | ||||
| -rw-r--r-- | tools/perf/util/debug.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/debug.h | 17 | ||||
| -rw-r--r-- | tools/perf/util/evlist.c | 88 | ||||
| -rw-r--r-- | tools/perf/util/evlist.h | 18 | ||||
| -rwxr-xr-x | tools/perf/util/generate-cmdlist.sh | 4 | ||||
| -rw-r--r-- | tools/perf/util/hist.c | 66 | ||||
| -rw-r--r-- | tools/perf/util/hist.h | 38 | ||||
| -rw-r--r-- | tools/perf/util/map.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/parse-options.c | 8 | ||||
| -rw-r--r-- | tools/perf/util/parse-options.h | 1 | ||||
| -rw-r--r-- | tools/perf/util/path.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/perf_regs.h | 4 | ||||
| -rw-r--r-- | tools/perf/util/sort.h | 19 | ||||
| -rw-r--r-- | tools/perf/util/symbol.h | 10 | ||||
| -rw-r--r-- | tools/perf/util/unwind.h | 4 | ||||
| -rw-r--r-- | tools/perf/util/util.c | 4 |
18 files changed, 143 insertions, 190 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 9b5b21e7b032..39242dcee8f2 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
| @@ -138,7 +138,10 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx, | |||
| 138 | bool print_lines, bool full_paths, int min_pcnt, | 138 | bool print_lines, bool full_paths, int min_pcnt, |
| 139 | int max_lines); | 139 | int max_lines); |
| 140 | 140 | ||
| 141 | #ifdef NO_NEWT_SUPPORT | 141 | #ifdef NEWT_SUPPORT |
| 142 | int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | ||
| 143 | void(*timer)(void *arg), void *arg, int delay_secs); | ||
| 144 | #else | ||
| 142 | static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, | 145 | static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, |
| 143 | struct map *map __maybe_unused, | 146 | struct map *map __maybe_unused, |
| 144 | int evidx __maybe_unused, | 147 | int evidx __maybe_unused, |
| @@ -148,9 +151,6 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, | |||
| 148 | { | 151 | { |
| 149 | return 0; | 152 | return 0; |
| 150 | } | 153 | } |
| 151 | #else | ||
| 152 | int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | ||
| 153 | void(*timer)(void *arg), void *arg, int delay_secs); | ||
| 154 | #endif | 154 | #endif |
| 155 | 155 | ||
| 156 | extern const char *disassembler_style; | 156 | extern const char *disassembler_style; |
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h index ab1769426541..2bd51370ad28 100644 --- a/tools/perf/util/cache.h +++ b/tools/perf/util/cache.h | |||
| @@ -33,39 +33,41 @@ extern int pager_use_color; | |||
| 33 | 33 | ||
| 34 | extern int use_browser; | 34 | extern int use_browser; |
| 35 | 35 | ||
| 36 | #if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) | 36 | #if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT) |
| 37 | static inline void setup_browser(bool fallback_to_pager) | ||
| 38 | { | ||
| 39 | if (fallback_to_pager) | ||
| 40 | setup_pager(); | ||
| 41 | } | ||
| 42 | static inline void exit_browser(bool wait_for_ok __maybe_unused) {} | ||
| 43 | #else | ||
| 44 | void setup_browser(bool fallback_to_pager); | 37 | void setup_browser(bool fallback_to_pager); |
| 45 | void exit_browser(bool wait_for_ok); | 38 | void exit_browser(bool wait_for_ok); |
| 46 | 39 | ||
| 47 | #ifdef NO_NEWT_SUPPORT | 40 | #ifdef NEWT_SUPPORT |
| 41 | int ui__init(void); | ||
| 42 | void ui__exit(bool wait_for_ok); | ||
| 43 | #else | ||
| 48 | static inline int ui__init(void) | 44 | static inline int ui__init(void) |
| 49 | { | 45 | { |
| 50 | return -1; | 46 | return -1; |
| 51 | } | 47 | } |
| 52 | static inline void ui__exit(bool wait_for_ok __maybe_unused) {} | 48 | static inline void ui__exit(bool wait_for_ok __maybe_unused) {} |
| 53 | #else | ||
| 54 | int ui__init(void); | ||
| 55 | void ui__exit(bool wait_for_ok); | ||
| 56 | #endif | 49 | #endif |
| 57 | 50 | ||
| 58 | #ifdef NO_GTK2_SUPPORT | 51 | #ifdef GTK2_SUPPORT |
| 52 | int perf_gtk__init(void); | ||
| 53 | void perf_gtk__exit(bool wait_for_ok); | ||
| 54 | #else | ||
| 59 | static inline int perf_gtk__init(void) | 55 | static inline int perf_gtk__init(void) |
| 60 | { | 56 | { |
| 61 | return -1; | 57 | return -1; |
| 62 | } | 58 | } |
| 63 | static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {} | 59 | static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {} |
| 64 | #else | ||
| 65 | int perf_gtk__init(void); | ||
| 66 | void perf_gtk__exit(bool wait_for_ok); | ||
| 67 | #endif | 60 | #endif |
| 68 | #endif /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ | 61 | |
| 62 | #else /* NEWT_SUPPORT || GTK2_SUPPORT */ | ||
| 63 | |||
| 64 | static inline void setup_browser(bool fallback_to_pager) | ||
| 65 | { | ||
| 66 | if (fallback_to_pager) | ||
| 67 | setup_pager(); | ||
| 68 | } | ||
| 69 | static inline void exit_browser(bool wait_for_ok __maybe_unused) {} | ||
| 70 | #endif /* NEWT_SUPPORT || GTK2_SUPPORT */ | ||
| 69 | 71 | ||
| 70 | char *alias_lookup(const char *alias); | 72 | char *alias_lookup(const char *alias); |
| 71 | int split_cmdline(char *cmdline, const char ***argv); | 73 | int split_cmdline(char *cmdline, const char ***argv); |
| @@ -105,7 +107,7 @@ extern char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2 | |||
| 105 | extern char *perf_pathdup(const char *fmt, ...) | 107 | extern char *perf_pathdup(const char *fmt, ...) |
| 106 | __attribute__((format (printf, 1, 2))); | 108 | __attribute__((format (printf, 1, 2))); |
| 107 | 109 | ||
| 108 | #ifdef NO_STRLCPY | 110 | #ifndef HAVE_STRLCPY |
| 109 | extern size_t strlcpy(char *dest, const char *src, size_t size); | 111 | extern size_t strlcpy(char *dest, const char *src, size_t size); |
| 110 | #endif | 112 | #endif |
| 111 | 113 | ||
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 66eb3828ceb5..03f830b48148 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
| @@ -49,7 +49,7 @@ int dump_printf(const char *fmt, ...) | |||
| 49 | return ret; | 49 | return ret; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | #if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) | 52 | #if !defined(NEWT_SUPPORT) && !defined(GTK2_SUPPORT) |
| 53 | int ui__warning(const char *format, ...) | 53 | int ui__warning(const char *format, ...) |
| 54 | { | 54 | { |
| 55 | va_list args; | 55 | va_list args; |
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index bb2e7d1007ab..dec98750b484 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h | |||
| @@ -15,7 +15,14 @@ void trace_event(union perf_event *event); | |||
| 15 | struct ui_progress; | 15 | struct ui_progress; |
| 16 | struct perf_error_ops; | 16 | struct perf_error_ops; |
| 17 | 17 | ||
| 18 | #if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) | 18 | #if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT) |
| 19 | |||
| 20 | #include "../ui/progress.h" | ||
| 21 | int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); | ||
| 22 | #include "../ui/util.h" | ||
| 23 | |||
| 24 | #else | ||
| 25 | |||
| 19 | static inline void ui_progress__update(u64 curr __maybe_unused, | 26 | static inline void ui_progress__update(u64 curr __maybe_unused, |
| 20 | u64 total __maybe_unused, | 27 | u64 total __maybe_unused, |
| 21 | const char *title __maybe_unused) {} | 28 | const char *title __maybe_unused) {} |
| @@ -34,13 +41,7 @@ perf_error__unregister(struct perf_error_ops *eops __maybe_unused) | |||
| 34 | return 0; | 41 | return 0; |
| 35 | } | 42 | } |
| 36 | 43 | ||
| 37 | #else /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ | 44 | #endif /* NEWT_SUPPORT || GTK2_SUPPORT */ |
| 38 | |||
| 39 | #include "../ui/progress.h" | ||
| 40 | int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); | ||
| 41 | #include "../ui/util.h" | ||
| 42 | |||
| 43 | #endif /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ | ||
| 44 | 45 | ||
| 45 | int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); | 46 | int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); |
| 46 | int ui__error_paranoid(void); | 47 | int ui__error_paranoid(void); |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index ae89686102f4..186b87730396 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
| @@ -154,8 +154,8 @@ error: | |||
| 154 | return -ENOMEM; | 154 | return -ENOMEM; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | int perf_evlist__add_attrs(struct perf_evlist *evlist, | 157 | static int perf_evlist__add_attrs(struct perf_evlist *evlist, |
| 158 | struct perf_event_attr *attrs, size_t nr_attrs) | 158 | struct perf_event_attr *attrs, size_t nr_attrs) |
| 159 | { | 159 | { |
| 160 | struct perf_evsel *evsel, *n; | 160 | struct perf_evsel *evsel, *n; |
| 161 | LIST_HEAD(head); | 161 | LIST_HEAD(head); |
| @@ -189,60 +189,6 @@ int __perf_evlist__add_default_attrs(struct perf_evlist *evlist, | |||
| 189 | return perf_evlist__add_attrs(evlist, attrs, nr_attrs); | 189 | return perf_evlist__add_attrs(evlist, attrs, nr_attrs); |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | static int trace_event__id(const char *evname) | ||
| 193 | { | ||
| 194 | char *filename, *colon; | ||
| 195 | int err = -1, fd; | ||
| 196 | |||
| 197 | if (asprintf(&filename, "%s/%s/id", tracing_events_path, evname) < 0) | ||
| 198 | return -1; | ||
| 199 | |||
| 200 | colon = strrchr(filename, ':'); | ||
| 201 | if (colon != NULL) | ||
| 202 | *colon = '/'; | ||
| 203 | |||
| 204 | fd = open(filename, O_RDONLY); | ||
| 205 | if (fd >= 0) { | ||
| 206 | char id[16]; | ||
| 207 | if (read(fd, id, sizeof(id)) > 0) | ||
| 208 | err = atoi(id); | ||
| 209 | close(fd); | ||
| 210 | } | ||
| 211 | |||
| 212 | free(filename); | ||
| 213 | return err; | ||
| 214 | } | ||
| 215 | |||
| 216 | int perf_evlist__add_tracepoints(struct perf_evlist *evlist, | ||
| 217 | const char *tracepoints[], | ||
| 218 | size_t nr_tracepoints) | ||
| 219 | { | ||
| 220 | int err; | ||
| 221 | size_t i; | ||
| 222 | struct perf_event_attr *attrs = zalloc(nr_tracepoints * sizeof(*attrs)); | ||
| 223 | |||
| 224 | if (attrs == NULL) | ||
| 225 | return -1; | ||
| 226 | |||
| 227 | for (i = 0; i < nr_tracepoints; i++) { | ||
| 228 | err = trace_event__id(tracepoints[i]); | ||
| 229 | |||
| 230 | if (err < 0) | ||
| 231 | goto out_free_attrs; | ||
| 232 | |||
| 233 | attrs[i].type = PERF_TYPE_TRACEPOINT; | ||
| 234 | attrs[i].config = err; | ||
| 235 | attrs[i].sample_type = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | | ||
| 236 | PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD); | ||
| 237 | attrs[i].sample_period = 1; | ||
| 238 | } | ||
| 239 | |||
| 240 | err = perf_evlist__add_attrs(evlist, attrs, nr_tracepoints); | ||
| 241 | out_free_attrs: | ||
| 242 | free(attrs); | ||
| 243 | return err; | ||
| 244 | } | ||
| 245 | |||
| 246 | struct perf_evsel * | 192 | struct perf_evsel * |
| 247 | perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) | 193 | perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) |
| 248 | { | 194 | { |
| @@ -257,32 +203,18 @@ perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) | |||
| 257 | return NULL; | 203 | return NULL; |
| 258 | } | 204 | } |
| 259 | 205 | ||
| 260 | int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist, | 206 | int perf_evlist__add_newtp(struct perf_evlist *evlist, |
| 261 | const struct perf_evsel_str_handler *assocs, | 207 | const char *sys, const char *name, void *handler) |
| 262 | size_t nr_assocs) | ||
| 263 | { | 208 | { |
| 264 | struct perf_evsel *evsel; | 209 | struct perf_evsel *evsel; |
| 265 | int err; | ||
| 266 | size_t i; | ||
| 267 | |||
| 268 | for (i = 0; i < nr_assocs; i++) { | ||
| 269 | err = trace_event__id(assocs[i].name); | ||
| 270 | if (err < 0) | ||
| 271 | goto out; | ||
| 272 | |||
| 273 | evsel = perf_evlist__find_tracepoint_by_id(evlist, err); | ||
| 274 | if (evsel == NULL) | ||
| 275 | continue; | ||
| 276 | 210 | ||
| 277 | err = -EEXIST; | 211 | evsel = perf_evsel__newtp(sys, name, evlist->nr_entries); |
| 278 | if (evsel->handler.func != NULL) | 212 | if (evsel == NULL) |
| 279 | goto out; | 213 | return -1; |
| 280 | evsel->handler.func = assocs[i].handler; | ||
| 281 | } | ||
| 282 | 214 | ||
| 283 | err = 0; | 215 | evsel->handler.func = handler; |
| 284 | out: | 216 | perf_evlist__add(evlist, evsel); |
| 285 | return err; | 217 | return 0; |
| 286 | } | 218 | } |
| 287 | 219 | ||
| 288 | void perf_evlist__disable(struct perf_evlist *evlist) | 220 | void perf_evlist__disable(struct perf_evlist *evlist) |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 3f1fb66be022..56003f779e60 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
| @@ -51,26 +51,14 @@ void perf_evlist__delete(struct perf_evlist *evlist); | |||
| 51 | 51 | ||
| 52 | void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry); | 52 | void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry); |
| 53 | int perf_evlist__add_default(struct perf_evlist *evlist); | 53 | int perf_evlist__add_default(struct perf_evlist *evlist); |
| 54 | int perf_evlist__add_attrs(struct perf_evlist *evlist, | ||
| 55 | struct perf_event_attr *attrs, size_t nr_attrs); | ||
| 56 | int __perf_evlist__add_default_attrs(struct perf_evlist *evlist, | 54 | int __perf_evlist__add_default_attrs(struct perf_evlist *evlist, |
| 57 | struct perf_event_attr *attrs, size_t nr_attrs); | 55 | struct perf_event_attr *attrs, size_t nr_attrs); |
| 58 | int perf_evlist__add_tracepoints(struct perf_evlist *evlist, | 56 | |
| 59 | const char *tracepoints[], size_t nr_tracepoints); | ||
| 60 | int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist, | ||
| 61 | const struct perf_evsel_str_handler *assocs, | ||
| 62 | size_t nr_assocs); | ||
| 63 | |||
| 64 | #define perf_evlist__add_attrs_array(evlist, array) \ | ||
| 65 | perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array)) | ||
| 66 | #define perf_evlist__add_default_attrs(evlist, array) \ | 57 | #define perf_evlist__add_default_attrs(evlist, array) \ |
| 67 | __perf_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array)) | 58 | __perf_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array)) |
| 68 | 59 | ||
| 69 | #define perf_evlist__add_tracepoints_array(evlist, array) \ | 60 | int perf_evlist__add_newtp(struct perf_evlist *evlist, |
| 70 | perf_evlist__add_tracepoints(evlist, array, ARRAY_SIZE(array)) | 61 | const char *sys, const char *name, void *handler); |
| 71 | |||
| 72 | #define perf_evlist__set_tracepoints_handlers_array(evlist, array) \ | ||
| 73 | perf_evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array)) | ||
| 74 | 62 | ||
| 75 | int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter); | 63 | int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter); |
| 76 | 64 | ||
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh index 389590c1ad21..3ac38031d534 100755 --- a/tools/perf/util/generate-cmdlist.sh +++ b/tools/perf/util/generate-cmdlist.sh | |||
| @@ -22,7 +22,7 @@ do | |||
| 22 | }' "Documentation/perf-$cmd.txt" | 22 | }' "Documentation/perf-$cmd.txt" |
| 23 | done | 23 | done |
| 24 | 24 | ||
| 25 | echo "#ifndef NO_LIBELF_SUPPORT" | 25 | echo "#ifdef LIBELF_SUPPORT" |
| 26 | sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt | | 26 | sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt | |
| 27 | sort | | 27 | sort | |
| 28 | while read cmd | 28 | while read cmd |
| @@ -35,5 +35,5 @@ do | |||
| 35 | p | 35 | p |
| 36 | }' "Documentation/perf-$cmd.txt" | 36 | }' "Documentation/perf-$cmd.txt" |
| 37 | done | 37 | done |
| 38 | echo "#endif /* NO_LIBELF_SUPPORT */" | 38 | echo "#endif /* LIBELF_SUPPORT */" |
| 39 | echo "};" | 39 | echo "};" |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 236bc9d98ff2..277947a669b2 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
| @@ -135,31 +135,47 @@ static void hist_entry__add_cpumode_period(struct hist_entry *he, | |||
| 135 | { | 135 | { |
| 136 | switch (cpumode) { | 136 | switch (cpumode) { |
| 137 | case PERF_RECORD_MISC_KERNEL: | 137 | case PERF_RECORD_MISC_KERNEL: |
| 138 | he->period_sys += period; | 138 | he->stat.period_sys += period; |
| 139 | break; | 139 | break; |
| 140 | case PERF_RECORD_MISC_USER: | 140 | case PERF_RECORD_MISC_USER: |
| 141 | he->period_us += period; | 141 | he->stat.period_us += period; |
| 142 | break; | 142 | break; |
| 143 | case PERF_RECORD_MISC_GUEST_KERNEL: | 143 | case PERF_RECORD_MISC_GUEST_KERNEL: |
| 144 | he->period_guest_sys += period; | 144 | he->stat.period_guest_sys += period; |
| 145 | break; | 145 | break; |
| 146 | case PERF_RECORD_MISC_GUEST_USER: | 146 | case PERF_RECORD_MISC_GUEST_USER: |
| 147 | he->period_guest_us += period; | 147 | he->stat.period_guest_us += period; |
| 148 | break; | 148 | break; |
| 149 | default: | 149 | default: |
| 150 | break; | 150 | break; |
| 151 | } | 151 | } |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static void he_stat__add_period(struct he_stat *he_stat, u64 period) | ||
| 155 | { | ||
| 156 | he_stat->period += period; | ||
| 157 | he_stat->nr_events += 1; | ||
| 158 | } | ||
| 159 | |||
| 160 | static void he_stat__add_stat(struct he_stat *dest, struct he_stat *src) | ||
| 161 | { | ||
| 162 | dest->period += src->period; | ||
| 163 | dest->period_sys += src->period_sys; | ||
| 164 | dest->period_us += src->period_us; | ||
| 165 | dest->period_guest_sys += src->period_guest_sys; | ||
| 166 | dest->period_guest_us += src->period_guest_us; | ||
| 167 | dest->nr_events += src->nr_events; | ||
| 168 | } | ||
| 169 | |||
| 154 | static void hist_entry__decay(struct hist_entry *he) | 170 | static void hist_entry__decay(struct hist_entry *he) |
| 155 | { | 171 | { |
| 156 | he->period = (he->period * 7) / 8; | 172 | he->stat.period = (he->stat.period * 7) / 8; |
| 157 | he->nr_events = (he->nr_events * 7) / 8; | 173 | he->stat.nr_events = (he->stat.nr_events * 7) / 8; |
| 158 | } | 174 | } |
| 159 | 175 | ||
| 160 | static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) | 176 | static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) |
| 161 | { | 177 | { |
| 162 | u64 prev_period = he->period; | 178 | u64 prev_period = he->stat.period; |
| 163 | 179 | ||
| 164 | if (prev_period == 0) | 180 | if (prev_period == 0) |
| 165 | return true; | 181 | return true; |
| @@ -167,9 +183,9 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) | |||
| 167 | hist_entry__decay(he); | 183 | hist_entry__decay(he); |
| 168 | 184 | ||
| 169 | if (!he->filtered) | 185 | if (!he->filtered) |
| 170 | hists->stats.total_period -= prev_period - he->period; | 186 | hists->stats.total_period -= prev_period - he->stat.period; |
| 171 | 187 | ||
| 172 | return he->period == 0; | 188 | return he->stat.period == 0; |
| 173 | } | 189 | } |
| 174 | 190 | ||
| 175 | static void __hists__decay_entries(struct hists *hists, bool zap_user, | 191 | static void __hists__decay_entries(struct hists *hists, bool zap_user, |
| @@ -223,7 +239,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template) | |||
| 223 | 239 | ||
| 224 | if (he != NULL) { | 240 | if (he != NULL) { |
| 225 | *he = *template; | 241 | *he = *template; |
| 226 | he->nr_events = 1; | 242 | |
| 227 | if (he->ms.map) | 243 | if (he->ms.map) |
| 228 | he->ms.map->referenced = true; | 244 | he->ms.map->referenced = true; |
| 229 | if (symbol_conf.use_callchain) | 245 | if (symbol_conf.use_callchain) |
| @@ -238,7 +254,7 @@ static void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h) | |||
| 238 | if (!h->filtered) { | 254 | if (!h->filtered) { |
| 239 | hists__calc_col_len(hists, h); | 255 | hists__calc_col_len(hists, h); |
| 240 | ++hists->nr_entries; | 256 | ++hists->nr_entries; |
| 241 | hists->stats.total_period += h->period; | 257 | hists->stats.total_period += h->stat.period; |
| 242 | } | 258 | } |
| 243 | } | 259 | } |
| 244 | 260 | ||
| @@ -270,8 +286,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists, | |||
| 270 | cmp = hist_entry__cmp(entry, he); | 286 | cmp = hist_entry__cmp(entry, he); |
| 271 | 287 | ||
| 272 | if (!cmp) { | 288 | if (!cmp) { |
| 273 | he->period += period; | 289 | he_stat__add_period(&he->stat, period); |
| 274 | ++he->nr_events; | ||
| 275 | 290 | ||
| 276 | /* If the map of an existing hist_entry has | 291 | /* If the map of an existing hist_entry has |
| 277 | * become out-of-date due to an exec() or | 292 | * become out-of-date due to an exec() or |
| @@ -321,10 +336,14 @@ struct hist_entry *__hists__add_branch_entry(struct hists *self, | |||
| 321 | .cpu = al->cpu, | 336 | .cpu = al->cpu, |
| 322 | .ip = bi->to.addr, | 337 | .ip = bi->to.addr, |
| 323 | .level = al->level, | 338 | .level = al->level, |
| 324 | .period = period, | 339 | .stat = { |
| 340 | .period = period, | ||
| 341 | .nr_events = 1, | ||
| 342 | }, | ||
| 325 | .parent = sym_parent, | 343 | .parent = sym_parent, |
| 326 | .filtered = symbol__parent_filter(sym_parent), | 344 | .filtered = symbol__parent_filter(sym_parent), |
| 327 | .branch_info = bi, | 345 | .branch_info = bi, |
| 346 | .hists = self, | ||
| 328 | }; | 347 | }; |
| 329 | 348 | ||
| 330 | return add_hist_entry(self, &entry, al, period); | 349 | return add_hist_entry(self, &entry, al, period); |
| @@ -343,9 +362,13 @@ struct hist_entry *__hists__add_entry(struct hists *self, | |||
| 343 | .cpu = al->cpu, | 362 | .cpu = al->cpu, |
| 344 | .ip = al->addr, | 363 | .ip = al->addr, |
| 345 | .level = al->level, | 364 | .level = al->level, |
| 346 | .period = period, | 365 | .stat = { |
| 366 | .period = period, | ||
| 367 | .nr_events = 1, | ||
| 368 | }, | ||
| 347 | .parent = sym_parent, | 369 | .parent = sym_parent, |
| 348 | .filtered = symbol__parent_filter(sym_parent), | 370 | .filtered = symbol__parent_filter(sym_parent), |
| 371 | .hists = self, | ||
| 349 | }; | 372 | }; |
| 350 | 373 | ||
| 351 | return add_hist_entry(self, &entry, al, period); | 374 | return add_hist_entry(self, &entry, al, period); |
| @@ -410,12 +433,7 @@ static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, | |||
| 410 | cmp = hist_entry__collapse(iter, he); | 433 | cmp = hist_entry__collapse(iter, he); |
| 411 | 434 | ||
| 412 | if (!cmp) { | 435 | if (!cmp) { |
| 413 | iter->period += he->period; | 436 | he_stat__add_stat(&iter->stat, &he->stat); |
| 414 | iter->period_sys += he->period_sys; | ||
| 415 | iter->period_us += he->period_us; | ||
| 416 | iter->period_guest_sys += he->period_guest_sys; | ||
| 417 | iter->period_guest_us += he->period_guest_us; | ||
| 418 | iter->nr_events += he->nr_events; | ||
| 419 | 437 | ||
| 420 | if (symbol_conf.use_callchain) { | 438 | if (symbol_conf.use_callchain) { |
| 421 | callchain_cursor_reset(&callchain_cursor); | 439 | callchain_cursor_reset(&callchain_cursor); |
| @@ -518,7 +536,7 @@ static void __hists__insert_output_entry(struct rb_root *entries, | |||
| 518 | parent = *p; | 536 | parent = *p; |
| 519 | iter = rb_entry(parent, struct hist_entry, rb_node); | 537 | iter = rb_entry(parent, struct hist_entry, rb_node); |
| 520 | 538 | ||
| 521 | if (he->period > iter->period) | 539 | if (he->stat.period > iter->stat.period) |
| 522 | p = &(*p)->rb_left; | 540 | p = &(*p)->rb_left; |
| 523 | else | 541 | else |
| 524 | p = &(*p)->rb_right; | 542 | p = &(*p)->rb_right; |
| @@ -579,8 +597,8 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h | |||
| 579 | if (h->ms.unfolded) | 597 | if (h->ms.unfolded) |
| 580 | hists->nr_entries += h->nr_rows; | 598 | hists->nr_entries += h->nr_rows; |
| 581 | h->row_offset = 0; | 599 | h->row_offset = 0; |
| 582 | hists->stats.total_period += h->period; | 600 | hists->stats.total_period += h->stat.period; |
| 583 | hists->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events; | 601 | hists->stats.nr_events[PERF_RECORD_SAMPLE] += h->stat.nr_events; |
| 584 | 602 | ||
| 585 | hists__calc_col_len(hists, h); | 603 | hists__calc_col_len(hists, h); |
| 586 | } | 604 | } |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index f011ad4756e8..66cb31fe81d2 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
| @@ -98,9 +98,8 @@ void hists__output_recalc_col_len(struct hists *hists, int max_rows); | |||
| 98 | void hists__inc_nr_events(struct hists *self, u32 type); | 98 | void hists__inc_nr_events(struct hists *self, u32 type); |
| 99 | size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); | 99 | size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); |
| 100 | 100 | ||
| 101 | size_t hists__fprintf(struct hists *self, struct hists *pair, | 101 | size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, |
| 102 | bool show_displacement, bool show_header, | 102 | int max_cols, FILE *fp); |
| 103 | int max_rows, int max_cols, FILE *fp); | ||
| 104 | 103 | ||
| 105 | int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); | 104 | int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); |
| 106 | int hist_entry__annotate(struct hist_entry *self, size_t privsize); | 105 | int hist_entry__annotate(struct hist_entry *self, size_t privsize); |
| @@ -118,9 +117,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *he); | |||
| 118 | struct perf_hpp { | 117 | struct perf_hpp { |
| 119 | char *buf; | 118 | char *buf; |
| 120 | size_t size; | 119 | size_t size; |
| 121 | u64 total_period; | ||
| 122 | const char *sep; | 120 | const char *sep; |
| 123 | long displacement; | ||
| 124 | void *ptr; | 121 | void *ptr; |
| 125 | }; | 122 | }; |
| 126 | 123 | ||
| @@ -135,6 +132,7 @@ struct perf_hpp_fmt { | |||
| 135 | extern struct perf_hpp_fmt perf_hpp__format[]; | 132 | extern struct perf_hpp_fmt perf_hpp__format[]; |
| 136 | 133 | ||
| 137 | enum { | 134 | enum { |
| 135 | PERF_HPP__BASELINE, | ||
| 138 | PERF_HPP__OVERHEAD, | 136 | PERF_HPP__OVERHEAD, |
| 139 | PERF_HPP__OVERHEAD_SYS, | 137 | PERF_HPP__OVERHEAD_SYS, |
| 140 | PERF_HPP__OVERHEAD_US, | 138 | PERF_HPP__OVERHEAD_US, |
| @@ -148,13 +146,22 @@ enum { | |||
| 148 | PERF_HPP__MAX_INDEX | 146 | PERF_HPP__MAX_INDEX |
| 149 | }; | 147 | }; |
| 150 | 148 | ||
| 151 | void perf_hpp__init(bool need_pair, bool show_displacement); | 149 | void perf_hpp__init(void); |
| 150 | void perf_hpp__column_enable(unsigned col, bool enable); | ||
| 152 | int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he, | 151 | int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he, |
| 153 | bool color); | 152 | bool color); |
| 154 | 153 | ||
| 155 | struct perf_evlist; | 154 | struct perf_evlist; |
| 156 | 155 | ||
| 157 | #ifdef NO_NEWT_SUPPORT | 156 | #ifdef NEWT_SUPPORT |
| 157 | #include "../ui/keysyms.h" | ||
| 158 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, | ||
| 159 | void(*timer)(void *arg), void *arg, int delay_secs); | ||
| 160 | |||
| 161 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, | ||
| 162 | void(*timer)(void *arg), void *arg, | ||
| 163 | int refresh); | ||
| 164 | #else | ||
| 158 | static inline | 165 | static inline |
| 159 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, | 166 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, |
| 160 | const char *help __maybe_unused, | 167 | const char *help __maybe_unused, |
| @@ -177,17 +184,13 @@ static inline int hist_entry__tui_annotate(struct hist_entry *self | |||
| 177 | } | 184 | } |
| 178 | #define K_LEFT -1 | 185 | #define K_LEFT -1 |
| 179 | #define K_RIGHT -2 | 186 | #define K_RIGHT -2 |
| 180 | #else | 187 | #endif |
| 181 | #include "../ui/keysyms.h" | ||
| 182 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, | ||
| 183 | void(*timer)(void *arg), void *arg, int delay_secs); | ||
| 184 | 188 | ||
| 185 | int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, | 189 | #ifdef GTK2_SUPPORT |
| 190 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, | ||
| 186 | void(*timer)(void *arg), void *arg, | 191 | void(*timer)(void *arg), void *arg, |
| 187 | int refresh); | 192 | int refresh); |
| 188 | #endif | 193 | #else |
| 189 | |||
| 190 | #ifdef NO_GTK2_SUPPORT | ||
| 191 | static inline | 194 | static inline |
| 192 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, | 195 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, |
| 193 | const char *help __maybe_unused, | 196 | const char *help __maybe_unused, |
| @@ -197,11 +200,6 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, | |||
| 197 | { | 200 | { |
| 198 | return 0; | 201 | return 0; |
| 199 | } | 202 | } |
| 200 | |||
| 201 | #else | ||
| 202 | int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, | ||
| 203 | void(*timer)(void *arg), void *arg, | ||
| 204 | int refresh); | ||
| 205 | #endif | 203 | #endif |
| 206 | 204 | ||
| 207 | unsigned int hists__sort_list_width(struct hists *self); | 205 | unsigned int hists__sort_list_width(struct hists *self); |
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index ead5316b3f89..6109fa4d14cd 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
| @@ -162,7 +162,7 @@ int map__load(struct map *self, symbol_filter_t filter) | |||
| 162 | pr_warning(", continuing without symbols\n"); | 162 | pr_warning(", continuing without symbols\n"); |
| 163 | return -1; | 163 | return -1; |
| 164 | } else if (nr == 0) { | 164 | } else if (nr == 0) { |
| 165 | #ifndef NO_LIBELF_SUPPORT | 165 | #ifdef LIBELF_SUPPORT |
| 166 | const size_t len = strlen(name); | 166 | const size_t len = strlen(name); |
| 167 | const size_t real_len = len - sizeof(DSO__DELETED); | 167 | const size_t real_len = len - sizeof(DSO__DELETED); |
| 168 | 168 | ||
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c index 443fc116512b..2bc9e70df7e2 100644 --- a/tools/perf/util/parse-options.c +++ b/tools/perf/util/parse-options.c | |||
| @@ -384,6 +384,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx, | |||
| 384 | return usage_with_options_internal(usagestr, options, 1); | 384 | return usage_with_options_internal(usagestr, options, 1); |
| 385 | if (internal_help && !strcmp(arg + 2, "help")) | 385 | if (internal_help && !strcmp(arg + 2, "help")) |
| 386 | return parse_options_usage(usagestr, options); | 386 | return parse_options_usage(usagestr, options); |
| 387 | if (!strcmp(arg + 2, "list-opts")) | ||
| 388 | return PARSE_OPT_LIST; | ||
| 387 | switch (parse_long_opt(ctx, arg + 2, options)) { | 389 | switch (parse_long_opt(ctx, arg + 2, options)) { |
| 388 | case -1: | 390 | case -1: |
| 389 | return parse_options_usage(usagestr, options); | 391 | return parse_options_usage(usagestr, options); |
| @@ -422,6 +424,12 @@ int parse_options(int argc, const char **argv, const struct option *options, | |||
| 422 | exit(129); | 424 | exit(129); |
| 423 | case PARSE_OPT_DONE: | 425 | case PARSE_OPT_DONE: |
| 424 | break; | 426 | break; |
| 427 | case PARSE_OPT_LIST: | ||
| 428 | while (options->type != OPTION_END) { | ||
| 429 | printf("--%s ", options->long_name); | ||
| 430 | options++; | ||
| 431 | } | ||
| 432 | exit(130); | ||
| 425 | default: /* PARSE_OPT_UNKNOWN */ | 433 | default: /* PARSE_OPT_UNKNOWN */ |
| 426 | if (ctx.argv[0][1] == '-') { | 434 | if (ctx.argv[0][1] == '-') { |
| 427 | error("unknown option `%s'", ctx.argv[0] + 2); | 435 | error("unknown option `%s'", ctx.argv[0] + 2); |
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h index abc31a1dac1a..7bb5999940ca 100644 --- a/tools/perf/util/parse-options.h +++ b/tools/perf/util/parse-options.h | |||
| @@ -140,6 +140,7 @@ extern NORETURN void usage_with_options(const char * const *usagestr, | |||
| 140 | enum { | 140 | enum { |
| 141 | PARSE_OPT_HELP = -1, | 141 | PARSE_OPT_HELP = -1, |
| 142 | PARSE_OPT_DONE, | 142 | PARSE_OPT_DONE, |
| 143 | PARSE_OPT_LIST, | ||
| 143 | PARSE_OPT_UNKNOWN, | 144 | PARSE_OPT_UNKNOWN, |
| 144 | }; | 145 | }; |
| 145 | 146 | ||
diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c index bd7497711424..a8c49548ca48 100644 --- a/tools/perf/util/path.c +++ b/tools/perf/util/path.c | |||
| @@ -22,7 +22,7 @@ static const char *get_perf_dir(void) | |||
| 22 | return "."; | 22 | return "."; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | #ifdef NO_STRLCPY | 25 | #ifndef HAVE_STRLCPY |
| 26 | size_t strlcpy(char *dest, const char *src, size_t size) | 26 | size_t strlcpy(char *dest, const char *src, size_t size) |
| 27 | { | 27 | { |
| 28 | size_t ret = strlen(src); | 28 | size_t ret = strlen(src); |
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h index 316dbe7f86ed..5a4f2b6f3738 100644 --- a/tools/perf/util/perf_regs.h +++ b/tools/perf/util/perf_regs.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef __PERF_REGS_H | 1 | #ifndef __PERF_REGS_H |
| 2 | #define __PERF_REGS_H | 2 | #define __PERF_REGS_H |
| 3 | 3 | ||
| 4 | #ifndef NO_PERF_REGS | 4 | #ifdef HAVE_PERF_REGS |
| 5 | #include <perf_regs.h> | 5 | #include <perf_regs.h> |
| 6 | #else | 6 | #else |
| 7 | #define PERF_REGS_MASK 0 | 7 | #define PERF_REGS_MASK 0 |
| @@ -10,5 +10,5 @@ static inline const char *perf_reg_name(int id __maybe_unused) | |||
| 10 | { | 10 | { |
| 11 | return NULL; | 11 | return NULL; |
| 12 | } | 12 | } |
| 13 | #endif /* NO_PERF_REGS */ | 13 | #endif /* HAVE_PERF_REGS */ |
| 14 | #endif /* __PERF_REGS_H */ | 14 | #endif /* __PERF_REGS_H */ |
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 12d634792de5..5786f323b597 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h | |||
| @@ -43,6 +43,15 @@ extern struct sort_entry sort_sym_from; | |||
| 43 | extern struct sort_entry sort_sym_to; | 43 | extern struct sort_entry sort_sym_to; |
| 44 | extern enum sort_type sort__first_dimension; | 44 | extern enum sort_type sort__first_dimension; |
| 45 | 45 | ||
| 46 | struct he_stat { | ||
| 47 | u64 period; | ||
| 48 | u64 period_sys; | ||
| 49 | u64 period_us; | ||
| 50 | u64 period_guest_sys; | ||
| 51 | u64 period_guest_us; | ||
| 52 | u32 nr_events; | ||
| 53 | }; | ||
| 54 | |||
| 46 | /** | 55 | /** |
| 47 | * struct hist_entry - histogram entry | 56 | * struct hist_entry - histogram entry |
| 48 | * | 57 | * |
| @@ -52,16 +61,11 @@ extern enum sort_type sort__first_dimension; | |||
| 52 | struct hist_entry { | 61 | struct hist_entry { |
| 53 | struct rb_node rb_node_in; | 62 | struct rb_node rb_node_in; |
| 54 | struct rb_node rb_node; | 63 | struct rb_node rb_node; |
| 55 | u64 period; | 64 | struct he_stat stat; |
| 56 | u64 period_sys; | ||
| 57 | u64 period_us; | ||
| 58 | u64 period_guest_sys; | ||
| 59 | u64 period_guest_us; | ||
| 60 | struct map_symbol ms; | 65 | struct map_symbol ms; |
| 61 | struct thread *thread; | 66 | struct thread *thread; |
| 62 | u64 ip; | 67 | u64 ip; |
| 63 | s32 cpu; | 68 | s32 cpu; |
| 64 | u32 nr_events; | ||
| 65 | 69 | ||
| 66 | /* XXX These two should move to some tree widget lib */ | 70 | /* XXX These two should move to some tree widget lib */ |
| 67 | u16 row_offset; | 71 | u16 row_offset; |
| @@ -73,12 +77,13 @@ struct hist_entry { | |||
| 73 | u8 filtered; | 77 | u8 filtered; |
| 74 | char *srcline; | 78 | char *srcline; |
| 75 | struct symbol *parent; | 79 | struct symbol *parent; |
| 80 | unsigned long position; | ||
| 76 | union { | 81 | union { |
| 77 | unsigned long position; | ||
| 78 | struct hist_entry *pair; | 82 | struct hist_entry *pair; |
| 79 | struct rb_root sorted_chain; | 83 | struct rb_root sorted_chain; |
| 80 | }; | 84 | }; |
| 81 | struct branch_info *branch_info; | 85 | struct branch_info *branch_info; |
| 86 | struct hists *hists; | ||
| 82 | struct callchain_root callchain[0]; | 87 | struct callchain_root callchain[0]; |
| 83 | }; | 88 | }; |
| 84 | 89 | ||
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index b441b07172b7..8b6ef7fac745 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <byteswap.h> | 12 | #include <byteswap.h> |
| 13 | #include <libgen.h> | 13 | #include <libgen.h> |
| 14 | 14 | ||
| 15 | #ifndef NO_LIBELF_SUPPORT | 15 | #ifdef LIBELF_SUPPORT |
| 16 | #include <libelf.h> | 16 | #include <libelf.h> |
| 17 | #include <gelf.h> | 17 | #include <gelf.h> |
| 18 | #include <elf.h> | 18 | #include <elf.h> |
| @@ -46,10 +46,10 @@ char *strxfrchar(char *s, char from, char to); | |||
| 46 | * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; | 46 | * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; |
| 47 | * for newer versions we can use mmap to reduce memory usage: | 47 | * for newer versions we can use mmap to reduce memory usage: |
| 48 | */ | 48 | */ |
| 49 | #ifdef LIBELF_NO_MMAP | 49 | #ifdef LIBELF_MMAP |
| 50 | # define PERF_ELF_C_READ_MMAP ELF_C_READ | ||
| 51 | #else | ||
| 52 | # define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP | 50 | # define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP |
| 51 | #else | ||
| 52 | # define PERF_ELF_C_READ_MMAP ELF_C_READ | ||
| 53 | #endif | 53 | #endif |
| 54 | 54 | ||
| 55 | #ifndef DMGL_PARAMS | 55 | #ifndef DMGL_PARAMS |
| @@ -233,7 +233,7 @@ struct symsrc { | |||
| 233 | int fd; | 233 | int fd; |
| 234 | enum dso_binary_type type; | 234 | enum dso_binary_type type; |
| 235 | 235 | ||
| 236 | #ifndef NO_LIBELF_SUPPORT | 236 | #ifdef LIBELF_SUPPORT |
| 237 | Elf *elf; | 237 | Elf *elf; |
| 238 | GElf_Ehdr ehdr; | 238 | GElf_Ehdr ehdr; |
| 239 | 239 | ||
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h index a78c8b303bb5..cb6bc503a792 100644 --- a/tools/perf/util/unwind.h +++ b/tools/perf/util/unwind.h | |||
| @@ -13,7 +13,7 @@ struct unwind_entry { | |||
| 13 | 13 | ||
| 14 | typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg); | 14 | typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg); |
| 15 | 15 | ||
| 16 | #ifndef NO_LIBUNWIND_SUPPORT | 16 | #ifdef LIBUNWIND_SUPPORT |
| 17 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | 17 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, |
| 18 | struct machine *machine, | 18 | struct machine *machine, |
| 19 | struct thread *thread, | 19 | struct thread *thread, |
| @@ -31,5 +31,5 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, | |||
| 31 | { | 31 | { |
| 32 | return 0; | 32 | return 0; |
| 33 | } | 33 | } |
| 34 | #endif /* NO_LIBUNWIND_SUPPORT */ | 34 | #endif /* LIBUNWIND_SUPPORT */ |
| 35 | #endif /* __UNWIND_H */ | 35 | #endif /* __UNWIND_H */ |
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 2055cf38041c..99664598bc1a 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #include "../perf.h" | 1 | #include "../perf.h" |
| 2 | #include "util.h" | 2 | #include "util.h" |
| 3 | #include <sys/mman.h> | 3 | #include <sys/mman.h> |
| 4 | #ifndef NO_BACKTRACE | 4 | #ifdef BACKTRACE_SUPPORT |
| 5 | #include <execinfo.h> | 5 | #include <execinfo.h> |
| 6 | #endif | 6 | #endif |
| 7 | #include <stdio.h> | 7 | #include <stdio.h> |
| @@ -165,7 +165,7 @@ size_t hex_width(u64 v) | |||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | /* Obtain a backtrace and print it to stdout. */ | 167 | /* Obtain a backtrace and print it to stdout. */ |
| 168 | #ifndef NO_BACKTRACE | 168 | #ifdef BACKTRACE_SUPPORT |
| 169 | void dump_stack(void) | 169 | void dump_stack(void) |
| 170 | { | 170 | { |
| 171 | void *array[16]; | 171 | void *array[16]; |
