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
14struct thread;
15struct comm;
16struct ip_callchain;
17struct symbol;
18struct dso;
19struct perf_sample;
20struct addr_location;
21struct call_path;
22
23
24
25
26
27
28
29
30
31enum {
32 CALL_RETURN_NO_CALL = 1 << 0,
33 CALL_RETURN_NO_RETURN = 1 << 1,
34 CALL_RETURN_NON_CALL = 1 << 2,
35};
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53struct call_return {
54 struct thread *thread;
55 struct comm *comm;
56 struct call_path *cp;
57 u64 call_time;
58 u64 return_time;
59 u64 branch_count;
60 u64 insn_count;
61 u64 cyc_count;
62 u64 call_ref;
63 u64 return_ref;
64 u64 db_id;
65 u64 parent_db_id;
66 u32 flags;
67};
68
69
70
71
72
73
74
75
76struct call_return_processor {
77 struct call_path_root *cpr;
78 int (*process)(struct call_return *cr, u64 *parent_db_id, void *data);
79 void *data;
80};
81
82int thread_stack__event(struct thread *thread, int cpu, u32 flags, u64 from_ip,
83 u64 to_ip, u16 insn_len, u64 trace_nr, bool callstack,
84 unsigned int br_stack_sz, bool mispred_all);
85void thread_stack__set_trace_nr(struct thread *thread, int cpu, u64 trace_nr);
86void thread_stack__sample(struct thread *thread, int cpu, struct ip_callchain *chain,
87 size_t sz, u64 ip, u64 kernel_start);
88void thread_stack__sample_late(struct thread *thread, int cpu,
89 struct ip_callchain *chain, size_t sz, u64 ip,
90 u64 kernel_start);
91void thread_stack__br_sample(struct thread *thread, int cpu,
92 struct branch_stack *dst, unsigned int sz);
93void thread_stack__br_sample_late(struct thread *thread, int cpu,
94 struct branch_stack *dst, unsigned int sz,
95 u64 sample_ip, u64 kernel_start);
96int thread_stack__flush(struct thread *thread);
97void thread_stack__free(struct thread *thread);
98size_t thread_stack__depth(struct thread *thread, int cpu);
99
100struct call_return_processor *
101call_return_processor__new(int (*process)(struct call_return *cr, u64 *parent_db_id, void *data),
102 void *data);
103void call_return_processor__free(struct call_return_processor *crp);
104int thread_stack__process(struct thread *thread, struct comm *comm,
105 struct perf_sample *sample,
106 struct addr_location *from_al,
107 struct addr_location *to_al, u64 ref,
108 struct call_return_processor *crp);
109
110#endif
111