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. int skip;
  17. u8 origin;
  18. struct map *map;
  19. unsigned long count[0];
  20. };
  21. static inline struct symbol *sym_entry__symbol(struct sym_entry *self)
  22. {
  23. return ((void *)self) + symbol_conf.priv_size;
  24. }
  25. struct perf_top {
  26. struct perf_evlist *evlist;
  27. /*
  28. * Symbols will be added here in perf_event__process_sample and will
  29. * get out after decayed.
  30. */
  31. struct list_head active_symbols;
  32. pthread_mutex_t active_symbols_lock;
  33. u64 samples;
  34. u64 kernel_samples, us_samples;
  35. u64 exact_samples;
  36. u64 guest_us_samples, guest_kernel_samples;
  37. int print_entries, count_filter, delay_secs;
  38. int display_weighted, freq, rb_entries, sym_counter;
  39. pid_t target_pid, target_tid;
  40. bool hide_kernel_symbols, hide_user_symbols, zero;
  41. const char *cpu_list;
  42. struct sym_entry *sym_filter_entry;
  43. struct perf_evsel *sym_evsel;
  44. };
  45. size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size);
  46. void perf_top__reset_sample_counters(struct perf_top *top);
  47. float perf_top__decay_samples(struct perf_top *top, struct rb_root *root);
  48. void perf_top__find_widths(struct perf_top *top, struct rb_root *root,
  49. int *dso_width, int *dso_short_width, int *sym_width);
  50. #ifdef NO_NEWT_SUPPORT
  51. static inline int perf_top__tui_browser(struct perf_top *top __used)
  52. {
  53. return 0;
  54. }
  55. #else
  56. int perf_top__tui_browser(struct perf_top *top);
  57. #endif
  58. #endif /* __PERF_TOP_H */