hist.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef __PERF_HIST_H
  2. #define __PERF_HIST_H
  3. #include <linux/types.h>
  4. #include "callchain.h"
  5. extern struct callchain_param callchain_param;
  6. struct hist_entry;
  7. struct addr_location;
  8. struct symbol;
  9. struct rb_root;
  10. struct objdump_line {
  11. struct list_head node;
  12. s64 offset;
  13. char *line;
  14. };
  15. void objdump_line__free(struct objdump_line *self);
  16. struct objdump_line *objdump__get_next_ip_line(struct list_head *head,
  17. struct objdump_line *pos);
  18. struct sym_hist {
  19. u64 sum;
  20. u64 ip[0];
  21. };
  22. struct sym_ext {
  23. struct rb_node node;
  24. double percent;
  25. char *path;
  26. };
  27. struct sym_priv {
  28. struct sym_hist *hist;
  29. struct sym_ext *ext;
  30. };
  31. struct events_stats {
  32. u64 total;
  33. u64 lost;
  34. u32 nr_events[PERF_RECORD_HEADER_MAX];
  35. u32 nr_unknown_events;
  36. };
  37. struct hists {
  38. struct rb_node rb_node;
  39. struct rb_root entries;
  40. u64 nr_entries;
  41. struct events_stats stats;
  42. u64 config;
  43. u64 event_stream;
  44. u32 type;
  45. u32 max_sym_namelen;
  46. };
  47. struct hist_entry *__hists__add_entry(struct hists *self,
  48. struct addr_location *al,
  49. struct symbol *parent, u64 count);
  50. extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *);
  51. extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *);
  52. int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
  53. bool show_displacement, long displacement, FILE *fp,
  54. u64 total);
  55. int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size,
  56. struct hists *pair_hists, bool show_displacement,
  57. long displacement, bool color, u64 total);
  58. void hist_entry__free(struct hist_entry *);
  59. void hists__output_resort(struct hists *self);
  60. void hists__collapse_resort(struct hists *self);
  61. void hists__inc_nr_events(struct hists *self, u32 type);
  62. size_t hists__fprintf_nr_events(struct hists *self, FILE *fp);
  63. size_t hists__fprintf(struct hists *self, struct hists *pair,
  64. bool show_displacement, FILE *fp);
  65. int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip);
  66. int hist_entry__annotate(struct hist_entry *self, struct list_head *head);
  67. void hists__filter_by_dso(struct hists *self, const struct dso *dso);
  68. void hists__filter_by_thread(struct hists *self, const struct thread *thread);
  69. #ifdef NO_NEWT_SUPPORT
  70. static inline int hists__browse(struct hists *self __used,
  71. const char *helpline __used,
  72. const char *input_name __used)
  73. {
  74. return 0;
  75. }
  76. #else
  77. int hists__browse(struct hists *self, const char *helpline,
  78. const char *input_name);
  79. #endif
  80. #endif /* __PERF_HIST_H */