blob: 62e32939f3d176e94adbc65e2c3558b6317b0bfd [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_source {
Arnaldo Carvalho de Melo36532462011-02-06 14:54:44 -020015 struct list_head head;
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020016 pthread_mutex_t lock;
17};
18
19struct sym_entry {
20 struct rb_node rb_node;
21 struct list_head node;
22 unsigned long snap_count;
23 double weight;
24 int skip;
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020025 u8 origin;
26 struct map *map;
27 struct sym_entry_source *src;
28 unsigned long count[0];
29};
30
Arnaldo Carvalho de Meloc0443df2011-01-31 18:19:33 -020031static inline struct symbol *sym_entry__symbol(struct sym_entry *self)
32{
33 return ((void *)self) + symbol_conf.priv_size;
34}
35
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020036struct perf_top {
37 struct perf_evlist *evlist;
38 /*
39 * Symbols will be added here in perf_event__process_sample and will
40 * get out after decayed.
41 */
42 struct list_head active_symbols;
43 pthread_mutex_t active_symbols_lock;
44 u64 samples;
45 u64 kernel_samples, us_samples;
46 u64 exact_samples;
47 u64 guest_us_samples, guest_kernel_samples;
48 int print_entries, count_filter, delay_secs;
Denis Kirjanovef4d0012011-02-05 20:39:38 +000049 int display_weighted, freq, rb_entries, sym_counter;
50 pid_t target_pid, target_tid;
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020051 bool hide_kernel_symbols, hide_user_symbols, zero;
52 const char *cpu_list;
53 struct perf_evsel *sym_evsel;
54};
55
56size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size);
57void perf_top__reset_sample_counters(struct perf_top *top);
58float perf_top__decay_samples(struct perf_top *top, struct rb_root *root);
59void perf_top__find_widths(struct perf_top *top, struct rb_root *root,
60 int *dso_width, int *dso_short_width, int *sym_width);
61
Arnaldo Carvalho de Meloc0443df2011-01-31 18:19:33 -020062#ifdef NO_NEWT_SUPPORT
63static inline int perf_top__tui_browser(struct perf_top *top __used)
64{
65 return 0;
66}
67#else
68int perf_top__tui_browser(struct perf_top *top);
69#endif
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020070#endif /* __PERF_TOP_H */