top.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. u16 name_len;
  30. u8 origin;
  31. struct map *map;
  32. struct sym_entry_source *src;
  33. unsigned long count[0];
  34. };
  35. static inline struct symbol *sym_entry__symbol(struct sym_entry *self)
  36. {
  37. return ((void *)self) + symbol_conf.priv_size;
  38. }
  39. struct perf_top {
  40. struct perf_evlist *evlist;
  41. /*
  42. * Symbols will be added here in perf_event__process_sample and will
  43. * get out after decayed.
  44. */
  45. struct list_head active_symbols;
  46. pthread_mutex_t active_symbols_lock;
  47. u64 samples;
  48. u64 kernel_samples, us_samples;
  49. u64 exact_samples;
  50. u64 guest_us_samples, guest_kernel_samples;
  51. int print_entries, count_filter, delay_secs;
  52. int display_weighted, freq, rb_entries;
  53. int sym_counter, target_pid, target_tid;
  54. bool hide_kernel_symbols, hide_user_symbols, zero;
  55. const char *cpu_list;
  56. struct perf_evsel *sym_evsel;
  57. };
  58. size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size);
  59. void perf_top__reset_sample_counters(struct perf_top *top);
  60. float perf_top__decay_samples(struct perf_top *top, struct rb_root *root);
  61. void perf_top__find_widths(struct perf_top *top, struct rb_root *root,
  62. int *dso_width, int *dso_short_width, int *sym_width);
  63. #ifdef NO_NEWT_SUPPORT
  64. static inline int perf_top__tui_browser(struct perf_top *top __used)
  65. {
  66. return 0;
  67. }
  68. #else
  69. int perf_top__tui_browser(struct perf_top *top);
  70. #endif
  71. #endif /* __PERF_TOP_H */