hist.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. };
  35. struct hists {
  36. struct rb_node rb_node;
  37. struct rb_root entries;
  38. u64 nr_entries;
  39. struct events_stats stats;
  40. u64 config;
  41. u64 event_stream;
  42. u32 type;
  43. u32 max_sym_namelen;
  44. };
  45. struct hist_entry *__hists__add_entry(struct hists *self,
  46. struct addr_location *al,
  47. struct symbol *parent, u64 count);
  48. extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *);
  49. extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *);
  50. int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
  51. bool show_displacement, long displacement, FILE *fp,
  52. u64 total);
  53. int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size,
  54. struct hists *pair_hists, bool show_displacement,
  55. long displacement, bool color, u64 total);
  56. void hist_entry__free(struct hist_entry *);
  57. void hists__output_resort(struct hists *self);
  58. void hists__collapse_resort(struct hists *self);
  59. size_t hists__fprintf(struct hists *self, struct hists *pair,
  60. bool show_displacement, FILE *fp);
  61. int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip);
  62. int hist_entry__annotate(struct hist_entry *self, struct list_head *head);
  63. void hists__filter_by_dso(struct hists *self, const struct dso *dso);
  64. void hists__filter_by_thread(struct hists *self, const struct thread *thread);
  65. #ifdef NO_NEWT_SUPPORT
  66. static inline int hists__browse(struct hists self __used,
  67. const char *helpline __used,
  68. const char *input_name __used)
  69. {
  70. return 0;
  71. }
  72. #else
  73. int hists__browse(struct hists *self, const char *helpline,
  74. const char *input_name);
  75. #endif
  76. #endif /* __PERF_HIST_H */