1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef __PERF_THREAD_STACK_H
17#define __PERF_THREAD_STACK_H
18
19#include <sys/types.h>
20
21#include <linux/types.h>
22#include <linux/rbtree.h>
23
24struct thread;
25struct comm;
26struct ip_callchain;
27struct symbol;
28struct dso;
29struct call_return_processor;
30struct comm;
31struct perf_sample;
32struct addr_location;
33
34
35
36
37
38
39
40enum {
41 CALL_RETURN_NO_CALL = 1 << 0,
42 CALL_RETURN_NO_RETURN = 1 << 1,
43};
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58struct call_return {
59 struct thread *thread;
60 struct comm *comm;
61 struct call_path *cp;
62 u64 call_time;
63 u64 return_time;
64 u64 branch_count;
65 u64 call_ref;
66 u64 return_ref;
67 u64 db_id;
68 u32 flags;
69};
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84struct call_path {
85 struct call_path *parent;
86 struct symbol *sym;
87 u64 ip;
88 u64 db_id;
89 bool in_kernel;
90 struct rb_node rb_node;
91 struct rb_root children;
92};
93
94int thread_stack__event(struct thread *thread, u32 flags, u64 from_ip,
95 u64 to_ip, u16 insn_len, u64 trace_nr);
96void thread_stack__set_trace_nr(struct thread *thread, u64 trace_nr);
97void thread_stack__sample(struct thread *thread, struct ip_callchain *chain,
98 size_t sz, u64 ip);
99int thread_stack__flush(struct thread *thread);
100void thread_stack__free(struct thread *thread);
101
102struct call_return_processor *
103call_return_processor__new(int (*process)(struct call_return *cr, void *data),
104 void *data);
105void call_return_processor__free(struct call_return_processor *crp);
106int thread_stack__process(struct thread *thread, struct comm *comm,
107 struct perf_sample *sample,
108 struct addr_location *from_al,
109 struct addr_location *to_al, u64 ref,
110 struct call_return_processor *crp);
111
112#endif
113