blob: 611370fa7df8f873f4a56d2aa2e0a4eb1ed0028c [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
14struct source_line {
15 u64 eip;
16 unsigned long count[MAX_COUNTERS]; /* FIXME */
17 char *line;
18 struct source_line *next;
19};
20
21struct sym_entry_source {
22 struct source_line *source;
23 struct source_line *lines;
24 struct source_line **lines_tail;
25 pthread_mutex_t lock;
26};
27
28struct sym_entry {
29 struct rb_node rb_node;
30 struct list_head node;
31 unsigned long snap_count;
32 double weight;
33 int skip;
34 u16 name_len;
35 u8 origin;
36 struct map *map;
37 struct sym_entry_source *src;
38 unsigned long count[0];
39};
40
Arnaldo Carvalho de Meloc0443df2011-01-31 18:19:33 -020041static inline struct symbol *sym_entry__symbol(struct sym_entry *self)
42{
43 return ((void *)self) + symbol_conf.priv_size;
44}
45
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020046struct perf_top {
47 struct perf_evlist *evlist;
48 /*
49 * Symbols will be added here in perf_event__process_sample and will
50 * get out after decayed.
51 */
52 struct list_head active_symbols;
53 pthread_mutex_t active_symbols_lock;
54 u64 samples;
55 u64 kernel_samples, us_samples;
56 u64 exact_samples;
57 u64 guest_us_samples, guest_kernel_samples;
58 int print_entries, count_filter, delay_secs;
Arnaldo Carvalho de Meloc0443df2011-01-31 18:19:33 -020059 int display_weighted, freq, rb_entries;
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020060 int sym_counter, target_pid, target_tid;
61 bool hide_kernel_symbols, hide_user_symbols, zero;
62 const char *cpu_list;
63 struct perf_evsel *sym_evsel;
64};
65
66size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size);
67void perf_top__reset_sample_counters(struct perf_top *top);
68float perf_top__decay_samples(struct perf_top *top, struct rb_root *root);
69void perf_top__find_widths(struct perf_top *top, struct rb_root *root,
70 int *dso_width, int *dso_short_width, int *sym_width);
71
Arnaldo Carvalho de Meloc0443df2011-01-31 18:19:33 -020072#ifdef NO_NEWT_SUPPORT
73static inline int perf_top__tui_browser(struct perf_top *top __used)
74{
75 return 0;
76}
77#else
78int perf_top__tui_browser(struct perf_top *top);
79#endif
Arnaldo Carvalho de Melo8c3e10e2011-01-31 14:50:39 -020080#endif /* __PERF_TOP_H */