top.h 2.0 KB

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