top.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef __PERF_TOP_H
  2. #define __PERF_TOP_H 1
  3. #include "types.h"
  4. #include "../perf.h"
  5. #include <stddef.h>
  6. #include <pthread.h>
  7. #include <linux/list.h>
  8. #include <linux/rbtree.h>
  9. struct perf_evlist;
  10. struct perf_evsel;
  11. struct sym_entry {
  12. struct rb_node rb_node;
  13. struct list_head node;
  14. unsigned long snap_count;
  15. double weight;
  16. struct map *map;
  17. unsigned long count[0];
  18. };
  19. static inline struct symbol *sym_entry__symbol(struct sym_entry *self)
  20. {
  21. return ((void *)self) + symbol_conf.priv_size;
  22. }
  23. struct perf_top {
  24. struct perf_evlist *evlist;
  25. /*
  26. * Symbols will be added here in perf_event__process_sample and will
  27. * get out after decayed.
  28. */
  29. struct list_head active_symbols;
  30. pthread_mutex_t active_symbols_lock;
  31. pthread_cond_t active_symbols_cond;
  32. u64 samples;
  33. u64 kernel_samples, us_samples;
  34. u64 exact_samples;
  35. u64 guest_us_samples, guest_kernel_samples;
  36. int print_entries, count_filter, delay_secs;
  37. int display_weighted, freq, rb_entries;
  38. pid_t target_pid, target_tid;
  39. bool hide_kernel_symbols, hide_user_symbols, zero;
  40. const char *cpu_list;
  41. struct sym_entry *sym_filter_entry;
  42. struct perf_evsel *sym_evsel;
  43. };
  44. size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size);
  45. void perf_top__reset_sample_counters(struct perf_top *top);
  46. float perf_top__decay_samples(struct perf_top *top, struct rb_root *root);
  47. void perf_top__find_widths(struct perf_top *top, struct rb_root *root,
  48. int *dso_width, int *dso_short_width, int *sym_width);
  49. #ifdef NO_NEWT_SUPPORT
  50. static inline int perf_top__tui_browser(struct perf_top *top __used)
  51. {
  52. return 0;
  53. }
  54. #else
  55. int perf_top__tui_browser(struct perf_top *top);
  56. #endif
  57. #endif /* __PERF_TOP_H */