diff options
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 9b5b21e..39242dc 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, bool print_lines, bool full_paths, int min_pcnt, int max_lines); -#ifdef NO_NEWT_SUPPORT +#ifdef NEWT_SUPPORT +int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, + void(*timer)(void *arg), void *arg, int delay_secs); +#else static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, struct map *map __maybe_unused, int evidx __maybe_unused, @@ -148,9 +151,6 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused, { return 0; } -#else -int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, - void(*timer)(void *arg), void *arg, int delay_secs); #endif extern const char *disassembler_style; diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h index ab17694..2bd5137 100644 --- a/tools/perf/util/cache.h +++ b/tools/perf/util/cache.h @@ -33,39 +33,41 @@ extern int pager_use_color; extern int use_browser; -#if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) -static inline void setup_browser(bool fallback_to_pager) -{ - if (fallback_to_pager) - setup_pager(); -} -static inline void exit_browser(bool wait_for_ok __maybe_unused) {} -#else +#if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT) void setup_browser(bool fallback_to_pager); void exit_browser(bool wait_for_ok); -#ifdef NO_NEWT_SUPPORT +#ifdef NEWT_SUPPORT +int ui__init(void); +void ui__exit(bool wait_for_ok); +#else static inline int ui__init(void) { return -1; } static inline void ui__exit(bool wait_for_ok __maybe_unused) {} -#else -int ui__init(void); -void ui__exit(bool wait_for_ok); #endif -#ifdef NO_GTK2_SUPPORT +#ifdef GTK2_SUPPORT +int perf_gtk__init(void); +void perf_gtk__exit(bool wait_for_ok); +#else static inline int perf_gtk__init(void) { return -1; } static inline void perf_gtk__exit(bool wait_for_ok __maybe_unused) {} -#else -int perf_gtk__init(void); -void perf_gtk__exit(bool wait_for_ok); #endif -#endif /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ + +#else /* NEWT_SUPPORT || GTK2_SUPPORT */ + +static inline void setup_browser(bool fallback_to_pager) +{ + if (fallback_to_pager) + setup_pager(); +} +static inline void exit_browser(bool wait_for_ok __maybe_unused) {} +#endif /* NEWT_SUPPORT || GTK2_SUPPORT */ char *alias_lookup(const char *alias); int split_cmdline(char *cmdline, const char ***argv); @@ -105,7 +107,7 @@ extern char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2 extern char *perf_pathdup(const char *fmt, ...) __attribute__((format (printf, 1, 2))); -#ifdef NO_STRLCPY +#ifndef HAVE_STRLCPY extern size_t strlcpy(char *dest, const char *src, size_t size); #endif diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 66eb382..03f830b 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -49,7 +49,7 @@ int dump_printf(const char *fmt, ...) return ret; } -#if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) +#if !defined(NEWT_SUPPORT) && !defined(GTK2_SUPPORT) int ui__warning(const char *format, ...) { va_list args; diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index bb2e7d1..dec9875 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h @@ -15,7 +15,14 @@ void trace_event(union perf_event *event); struct ui_progress; struct perf_error_ops; -#if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT) +#if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT) + +#include "../ui/progress.h" +int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); +#include "../ui/util.h" + +#else + static inline void ui_progress__update(u64 curr __maybe_unused, u64 total __maybe_unused, const char *title __maybe_unused) {} @@ -34,13 +41,7 @@ perf_error__unregister(struct perf_error_ops *eops __maybe_unused) return 0; } -#else /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ - -#include "../ui/progress.h" -int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2))); -#include "../ui/util.h" - -#endif /* NO_NEWT_SUPPORT && NO_GTK2_SUPPORT */ +#endif /* NEWT_SUPPORT || GTK2_SUPPORT */ int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); int ui__error_paranoid(void); diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index ae89686..186b877 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -154,8 +154,8 @@ error: return -ENOMEM; } -int perf_evlist__add_attrs(struct perf_evlist *evlist, - struct perf_event_attr *attrs, size_t nr_attrs) +static int perf_evlist__add_attrs(struct perf_evlist *evlist, + struct perf_event_attr *attrs, size_t nr_attrs) { struct perf_evsel *evsel, *n; LIST_HEAD(head); @@ -189,60 +189,6 @@ int __perf_evlist__add_default_attrs(struct perf_evlist *evlist, return perf_evlist__add_attrs(evlist, attrs, nr_attrs); } -static int trace_event__id(const char *evname) -{ - char *filename, *colon; - int err = -1, fd; - - if (asprintf(&filename, "%s/%s/id", tracing_events_path, evname) < 0) - return -1; - - colon = strrchr(filename, ':'); - if (colon != NULL) - *colon = '/'; - - fd = open(filename, O_RDONLY); - if (fd >= 0) { - char id[16]; - if (read(fd, id, sizeof(id)) > 0) - err = atoi(id); - close(fd); - } - - free(filename); - return err; -} - -int perf_evlist__add_tracepoints(struct perf_evlist *evlist, - const char *tracepoints[], - size_t nr_tracepoints) -{ - int err; - size_t i; - struct perf_event_attr *attrs = zalloc(nr_tracepoints * sizeof(*attrs)); - - if (attrs == NULL) - return -1; - - for (i = 0; i < nr_tracepoints; i++) { - err = trace_event__id(tracepoints[i]); - - if (err < 0) - goto out_free_attrs; - - attrs[i].type = PERF_TYPE_TRACEPOINT; - attrs[i].config = err; - attrs[i].sample_type = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | - PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD); - attrs[i].sample_period = 1; - } - - err = perf_evlist__add_attrs(evlist, attrs, nr_tracepoints); -out_free_attrs: - free(attrs); - return err; -} - struct perf_evsel * perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) { @@ -257,32 +203,18 @@ perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) return NULL; } -int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist, - const struct perf_evsel_str_handler *assocs, - size_t nr_assocs) +int perf_evlist__add_newtp(struct perf_evlist *evlist, + const char *sys, const char *name, void *handler) { struct perf_evsel *evsel; - int err; - size_t i; - - for (i = 0; i < nr_assocs; i++) { - err = trace_event__id(assocs[i].name); - if (err < 0) - goto out; - - evsel = perf_evlist__find_tracepoint_by_id(evlist, err); - if (evsel == NULL) - continue; - err = -EEXIST; - if (evsel->handler.func != NULL) - goto out; - evsel->handler.func = assocs[i].handler; - } + evsel = perf_evsel__newtp(sys, name, evlist->nr_entries); + if (evsel == NULL) + return -1; - err = 0; -out: - return err; + evsel->handler.func = handler; + perf_evlist__add(evlist, evsel); + return 0; } void perf_evlist__disable(struct perf_evlist *evlist) diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 3f1fb66..56003f7 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); void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry); int perf_evlist__add_default(struct perf_evlist *evlist); -int perf_evlist__add_attrs(struct perf_evlist *evlist, - struct perf_event_attr *attrs, size_t nr_attrs); int __perf_evlist__add_default_attrs(struct perf_evlist *evlist, struct perf_event_attr *attrs, size_t nr_attrs); -int perf_evlist__add_tracepoints(struct perf_evlist *evlist, - const char *tracepoints[], size_t nr_tracepoints); -int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist, - const struct perf_evsel_str_handler *assocs, - size_t nr_assocs); - -#define perf_evlist__add_attrs_array(evlist, array) \ - perf_evlist__add_attrs(evlist, array, ARRAY_SIZE(array)) + #define perf_evlist__add_default_attrs(evlist, array) \ __perf_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array)) -#define perf_evlist__add_tracepoints_array(evlist, array) \ - perf_evlist__add_tracepoints(evlist, array, ARRAY_SIZE(array)) - -#define perf_evlist__set_tracepoints_handlers_array(evlist, array) \ - perf_evlist__set_tracepoints_handlers(evlist, array, ARRAY_SIZE(array)) +int perf_evlist__add_newtp(struct perf_evlist *evlist, + const char *sys, const char *name, void *handler); int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter); diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh index 389590c..3ac3803 100755 --- a/tools/perf/util/generate-cmdlist.sh +++ b/tools/perf/util/generate-cmdlist.sh @@ -22,7 +22,7 @@ do }' "Documentation/perf-$cmd.txt" done -echo "#ifndef NO_LIBELF_SUPPORT" +echo "#ifdef LIBELF_SUPPORT" sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt | sort | while read cmd @@ -35,5 +35,5 @@ do p }' "Documentation/perf-$cmd.txt" done -echo "#endif /* NO_LIBELF_SUPPORT */" +echo "#endif /* LIBELF_SUPPORT */" echo "};" diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 236bc9d..277947a 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, { switch (cpumode) { case PERF_RECORD_MISC_KERNEL: - he->period_sys += period; + he->stat.period_sys += period; break; case PERF_RECORD_MISC_USER: - he->period_us += period; + he->stat.period_us += period; break; case PERF_RECORD_MISC_GUEST_KERNEL: - he->period_guest_sys += period; + he->stat.period_guest_sys += period; break; case PERF_RECORD_MISC_GUEST_USER: - he->period_guest_us += period; + he->stat.period_guest_us += period; break; default: break; } } +static void he_stat__add_period(struct he_stat *he_stat, u64 period) +{ + he_stat->period += period; + he_stat->nr_events += 1; +} + +static void he_stat__add_stat(struct he_stat *dest, struct he_stat *src) +{ + dest->period += src->period; + dest->period_sys += src->period_sys; + dest->period_us += src->period_us; + dest->period_guest_sys += src->period_guest_sys; + dest->period_guest_us += src->period_guest_us; + dest->nr_events += src->nr_events; +} + static void hist_entry__decay(struct hist_entry *he) { - he->period = (he->period * 7) / 8; - he->nr_events = (he->nr_events * 7) / 8; + he->stat.period = (he->stat.period * 7) / 8; + he->stat.nr_events = (he->stat.nr_events * 7) / 8; } static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) { - u64 prev_period = he->period; + u64 prev_period = he->stat.period; if (prev_period == 0) return true; @@ -167,9 +183,9 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) hist_entry__decay(he); if (!he->filtered) - hists->stats.total_period -= prev_period - he->period; + hists->stats.total_period -= prev_period - he->stat.period; - return he->period == 0; + return he->stat.period == 0; } 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) if (he != NULL) { *he = *template; - he->nr_events = 1; + if (he->ms.map) he->ms.map->referenced = true; if (symbol_conf.use_callchain) @@ -238,7 +254,7 @@ static void hists__inc_nr_entries(struct hists *hists, struct hist_entry *h) if (!h->filtered) { hists__calc_col_len(hists, h); ++hists->nr_entries; - hists->stats.total_period += h->period; + hists->stats.total_period += h->stat.period; } } @@ -270,8 +286,7 @@ static struct hist_entry *add_hist_entry(struct hists *hists, cmp = hist_entry__cmp(entry, he); if (!cmp) { - he->period += period; - ++he->nr_events; + he_stat__add_period(&he->stat, period); /* If the map of an existing hist_entry has * become out-of-date due to an exec() or @@ -321,10 +336,14 @@ struct hist_entry *__hists__add_branch_entry(struct hists *self, .cpu = al->cpu, .ip = bi->to.addr, .level = al->level, - .period = period, + .stat = { + .period = period, + .nr_events = 1, + }, .parent = sym_parent, .filtered = symbol__parent_filter(sym_parent), .branch_info = bi, + .hists = self, }; return add_hist_entry(self, &entry, al, period); @@ -343,9 +362,13 @@ struct hist_entry *__hists__add_entry(struct hists *self, .cpu = al->cpu, .ip = al->addr, .level = al->level, - .period = period, + .stat = { + .period = period, + .nr_events = 1, + }, .parent = sym_parent, .filtered = symbol__parent_filter(sym_parent), + .hists = self, }; return add_hist_entry(self, &entry, al, period); @@ -410,12 +433,7 @@ static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused, cmp = hist_entry__collapse(iter, he); if (!cmp) { - iter->period += he->period; - iter->period_sys += he->period_sys; - iter->period_us += he->period_us; - iter->period_guest_sys += he->period_guest_sys; - iter->period_guest_us += he->period_guest_us; - iter->nr_events += he->nr_events; + he_stat__add_stat(&iter->stat, &he->stat); if (symbol_conf.use_callchain) { callchain_cursor_reset(&callchain_cursor); @@ -518,7 +536,7 @@ static void __hists__insert_output_entry(struct rb_root *entries, parent = *p; iter = rb_entry(parent, struct hist_entry, rb_node); - if (he->period > iter->period) + if (he->stat.period > iter->stat.period) p = &(*p)->rb_left; else p = &(*p)->rb_right; @@ -579,8 +597,8 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h if (h->ms.unfolded) hists->nr_entries += h->nr_rows; h->row_offset = 0; - hists->stats.total_period += h->period; - hists->stats.nr_events[PERF_RECORD_SAMPLE] += h->nr_events; + hists->stats.total_period += h->stat.period; + hists->stats.nr_events[PERF_RECORD_SAMPLE] += h->stat.nr_events; hists__calc_col_len(hists, h); } diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index f011ad4..66cb31f 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); void hists__inc_nr_events(struct hists *self, u32 type); size_t hists__fprintf_nr_events(struct hists *self, FILE *fp); -size_t hists__fprintf(struct hists *self, struct hists *pair, - bool show_displacement, bool show_header, - int max_rows, int max_cols, FILE *fp); +size_t hists__fprintf(struct hists *self, bool show_header, int max_rows, + int max_cols, FILE *fp); int hist_entry__inc_addr_samples(struct hist_entry *self, int evidx, u64 addr); 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); struct perf_hpp { char *buf; size_t size; - u64 total_period; const char *sep; - long displacement; void *ptr; }; @@ -135,6 +132,7 @@ struct perf_hpp_fmt { extern struct perf_hpp_fmt perf_hpp__format[]; enum { + PERF_HPP__BASELINE, PERF_HPP__OVERHEAD, PERF_HPP__OVERHEAD_SYS, PERF_HPP__OVERHEAD_US, @@ -148,13 +146,22 @@ enum { PERF_HPP__MAX_INDEX }; -void perf_hpp__init(bool need_pair, bool show_displacement); +void perf_hpp__init(void); +void perf_hpp__column_enable(unsigned col, bool enable); int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he, bool color); struct perf_evlist; -#ifdef NO_NEWT_SUPPORT +#ifdef NEWT_SUPPORT +#include "../ui/keysyms.h" +int hist_entry__tui_annotate(struct hist_entry *he, int evidx, + void(*timer)(void *arg), void *arg, int delay_secs); + +int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, + void(*timer)(void *arg), void *arg, + int refresh); +#else static inline int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused, const char *help __maybe_unused, @@ -177,17 +184,13 @@ static inline int hist_entry__tui_annotate(struct hist_entry *self } #define K_LEFT -1 #define K_RIGHT -2 -#else -#include "../ui/keysyms.h" -int hist_entry__tui_annotate(struct hist_entry *he, int evidx, - void(*timer)(void *arg), void *arg, int delay_secs); +#endif -int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, +#ifdef GTK2_SUPPORT +int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, void(*timer)(void *arg), void *arg, int refresh); -#endif - -#ifdef NO_GTK2_SUPPORT +#else static inline int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, const char *help __maybe_unused, @@ -197,11 +200,6 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused, { return 0; } - -#else -int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help, - void(*timer)(void *arg), void *arg, - int refresh); #endif unsigned int hists__sort_list_width(struct hists *self); diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index ead5316..6109fa4 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) pr_warning(", continuing without symbols\n"); return -1; } else if (nr == 0) { -#ifndef NO_LIBELF_SUPPORT +#ifdef LIBELF_SUPPORT const size_t len = strlen(name); const size_t real_len = len - sizeof(DSO__DELETED); diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c index 443fc11..2bc9e70 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, return usage_with_options_internal(usagestr, options, 1); if (internal_help && !strcmp(arg + 2, "help")) return parse_options_usage(usagestr, options); + if (!strcmp(arg + 2, "list-opts")) + return PARSE_OPT_LIST; switch (parse_long_opt(ctx, arg + 2, options)) { case -1: return parse_options_usage(usagestr, options); @@ -422,6 +424,12 @@ int parse_options(int argc, const char **argv, const struct option *options, exit(129); case PARSE_OPT_DONE: break; + case PARSE_OPT_LIST: + while (options->type != OPTION_END) { + printf("--%s ", options->long_name); + options++; + } + exit(130); default: /* PARSE_OPT_UNKNOWN */ if (ctx.argv[0][1] == '-') { 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 abc31a1..7bb5999 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, enum { PARSE_OPT_HELP = -1, PARSE_OPT_DONE, + PARSE_OPT_LIST, PARSE_OPT_UNKNOWN, }; diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c index bd74977..a8c4954 100644 --- a/tools/perf/util/path.c +++ b/tools/perf/util/path.c @@ -22,7 +22,7 @@ static const char *get_perf_dir(void) return "."; } -#ifdef NO_STRLCPY +#ifndef HAVE_STRLCPY size_t strlcpy(char *dest, const char *src, size_t size) { size_t ret = strlen(src); diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h index 316dbe7..5a4f2b6f 100644 --- a/tools/perf/util/perf_regs.h +++ b/tools/perf/util/perf_regs.h @@ -1,7 +1,7 @@ #ifndef __PERF_REGS_H #define __PERF_REGS_H -#ifndef NO_PERF_REGS +#ifdef HAVE_PERF_REGS #include <perf_regs.h> #else #define PERF_REGS_MASK 0 @@ -10,5 +10,5 @@ static inline const char *perf_reg_name(int id __maybe_unused) { return NULL; } -#endif /* NO_PERF_REGS */ +#endif /* HAVE_PERF_REGS */ #endif /* __PERF_REGS_H */ diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 12d6347..5786f32 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h @@ -43,6 +43,15 @@ extern struct sort_entry sort_sym_from; extern struct sort_entry sort_sym_to; extern enum sort_type sort__first_dimension; +struct he_stat { + u64 period; + u64 period_sys; + u64 period_us; + u64 period_guest_sys; + u64 period_guest_us; + u32 nr_events; +}; + /** * struct hist_entry - histogram entry * @@ -52,16 +61,11 @@ extern enum sort_type sort__first_dimension; struct hist_entry { struct rb_node rb_node_in; struct rb_node rb_node; - u64 period; - u64 period_sys; - u64 period_us; - u64 period_guest_sys; - u64 period_guest_us; + struct he_stat stat; struct map_symbol ms; struct thread *thread; u64 ip; s32 cpu; - u32 nr_events; /* XXX These two should move to some tree widget lib */ u16 row_offset; @@ -73,12 +77,13 @@ struct hist_entry { u8 filtered; char *srcline; struct symbol *parent; + unsigned long position; union { - unsigned long position; struct hist_entry *pair; struct rb_root sorted_chain; }; struct branch_info *branch_info; + struct hists *hists; struct callchain_root callchain[0]; }; diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index b441b07..8b6ef7f 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -12,7 +12,7 @@ #include <byteswap.h> #include <libgen.h> -#ifndef NO_LIBELF_SUPPORT +#ifdef LIBELF_SUPPORT #include <libelf.h> #include <gelf.h> #include <elf.h> @@ -46,10 +46,10 @@ char *strxfrchar(char *s, char from, char to); * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; * for newer versions we can use mmap to reduce memory usage: */ -#ifdef LIBELF_NO_MMAP -# define PERF_ELF_C_READ_MMAP ELF_C_READ -#else +#ifdef LIBELF_MMAP # define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP +#else +# define PERF_ELF_C_READ_MMAP ELF_C_READ #endif #ifndef DMGL_PARAMS @@ -233,7 +233,7 @@ struct symsrc { int fd; enum dso_binary_type type; -#ifndef NO_LIBELF_SUPPORT +#ifdef LIBELF_SUPPORT Elf *elf; GElf_Ehdr ehdr; diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h index a78c8b3..cb6bc50 100644 --- a/tools/perf/util/unwind.h +++ b/tools/perf/util/unwind.h @@ -13,7 +13,7 @@ struct unwind_entry { typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg); -#ifndef NO_LIBUNWIND_SUPPORT +#ifdef LIBUNWIND_SUPPORT int unwind__get_entries(unwind_entry_cb_t cb, void *arg, struct machine *machine, struct thread *thread, @@ -31,5 +31,5 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, { return 0; } -#endif /* NO_LIBUNWIND_SUPPORT */ +#endif /* LIBUNWIND_SUPPORT */ #endif /* __UNWIND_H */ diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 2055cf3..9966459 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c @@ -1,7 +1,7 @@ #include "../perf.h" #include "util.h" #include <sys/mman.h> -#ifndef NO_BACKTRACE +#ifdef BACKTRACE_SUPPORT #include <execinfo.h> #endif #include <stdio.h> @@ -165,7 +165,7 @@ size_t hex_width(u64 v) } /* Obtain a backtrace and print it to stdout. */ -#ifndef NO_BACKTRACE +#ifdef BACKTRACE_SUPPORT void dump_stack(void) { void *array[16]; |