callchain.h 782 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef __PERF_CALLCHAIN_H
  2. #define __PERF_CALLCHAIN_H
  3. #include "../perf.h"
  4. #include "list.h"
  5. #include <linux/rbtree.h>
  6. #include "symbol.h"
  7. struct callchain_node {
  8. struct callchain_node *parent;
  9. struct list_head brothers;
  10. struct list_head children;
  11. struct list_head val;
  12. struct rb_node rb_node;
  13. unsigned int val_nr;
  14. u64 hit;
  15. };
  16. struct callchain_list {
  17. u64 ip;
  18. struct symbol *sym;
  19. struct list_head list;
  20. };
  21. static inline void callchain_init(struct callchain_node *node)
  22. {
  23. INIT_LIST_HEAD(&node->brothers);
  24. INIT_LIST_HEAD(&node->children);
  25. INIT_LIST_HEAD(&node->val);
  26. }
  27. void append_chain(struct callchain_node *root, struct ip_callchain *chain,
  28. struct symbol **syms);
  29. void sort_chain_to_rbtree(struct rb_root *rb_root, struct callchain_node *node);
  30. #endif