blob: ba111b25e16aa94a8276bc2d3ba6a76d18b43dac [file] [log] [blame]
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -02001#ifndef __PERF_TOP_H
2#define __PERF_TOP_H 1
3
4#include "types.h"
5#include "../perf.h"
6#include <stddef.h>
7#include <pthread.h>
8#include <linux/list.h>
9#include <linux/rbtree.h>
10
11struct perf_evlist;
12struct perf_evsel;
13
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020014struct sym_entry {
15 struct rb_node rb_node;
16 struct list_head node;
17 unsigned long snap_count;
18 double weight;
19 int skip;
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020020 struct map *map;
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020021 unsigned long count[0];
22};
23
Arnaldo Carvalho de Meloc0443df2011-01-31 18:19:33 -020024static inline struct symbol *sym_entry__symbol(struct sym_entry *self)
25{
26 return ((void *)self) + symbol_conf.priv_size;
27}
28
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020029struct perf_top {
30 struct perf_evlist *evlist;
31 /*
32 * Symbols will be added here in perf_event__process_sample and will
33 * get out after decayed.
34 */
35 struct list_head active_symbols;
36 pthread_mutex_t active_symbols_lock;
Arnaldo Carvalho de Melo58078062011-03-01 10:43:03 -030037 pthread_cond_t active_symbols_cond;
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020038 u64 samples;
39 u64 kernel_samples, us_samples;
40 u64 exact_samples;
41 u64 guest_us_samples, guest_kernel_samples;
42 int print_entries, count_filter, delay_secs;
Arnaldo Carvalho de Meloec52d972011-03-11 10:11:48 -030043 int display_weighted, freq, rb_entries;
Denis Kirjanovef4d0012011-02-05 20:39:38 +000044 pid_t target_pid, target_tid;
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020045 bool hide_kernel_symbols, hide_user_symbols, zero;
46 const char *cpu_list;
Arnaldo Carvalho de Meloc97cf422011-02-22 12:02:07 -030047 struct sym_entry *sym_filter_entry;
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020048 struct perf_evsel *sym_evsel;
49};
50
51size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size);
52void perf_top__reset_sample_counters(struct perf_top *top);
53float perf_top__decay_samples(struct perf_top *top, struct rb_root *root);
54void perf_top__find_widths(struct perf_top *top, struct rb_root *root,
55 int *dso_width, int *dso_short_width, int *sym_width);
56
Arnaldo Carvalho de Meloc0443df2011-01-31 18:19:33 -020057#ifdef NO_NEWT_SUPPORT
58static inline int perf_top__tui_browser(struct perf_top *top __used)
59{
60 return 0;
61}
62#else
63int perf_top__tui_browser(struct perf_top *top);
64#endif
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020065#endif /* __PERF_TOP_H */