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