top.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. pthread_cond_t active_symbols_cond;
  34. u64 samples;
  35. u64 kernel_samples, us_samples;
  36. u64 exact_samples;
  37. u64 guest_us_samples, guest_kernel_samples;
  38. int print_entries, count_filter, delay_secs;
  39. int display_weighted, freq, rb_entries, sym_counter;
  40. pid_t target_pid, target_tid;
  41. bool hide_kernel_symbols, hide_user_symbols, zero;
  42. const char *cpu_list;
  43. struct sym_entry *sym_filter_entry;
  44. struct perf_evsel *sym_evsel;
  45. };
  46. size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size);
  47. void perf_top__reset_sample_counters(struct perf_top *top);
  48. float perf_top__decay_samples(struct perf_top *top, struct rb_root *root);
  49. void perf_top__find_widths(struct perf_top *top, struct rb_root *root,
  50. int *dso_width, int *dso_short_width, int *sym_width);
  51. #ifdef NO_NEWT_SUPPORT
  52. static inline int perf_top__tui_browser(struct perf_top *top __used)
  53. {
  54. return 0;
  55. }
  56. #else
  57. int perf_top__tui_browser(struct perf_top *top);
  58. #endif
  59. #endif /* __PERF_TOP_H */