0001
0002
0003
0004
0005
0006
0007 #ifndef __PERF_THREAD_STACK_H
0008 #define __PERF_THREAD_STACK_H
0009
0010 #include <sys/types.h>
0011
0012 #include <linux/types.h>
0013
0014 struct thread;
0015 struct comm;
0016 struct ip_callchain;
0017 struct symbol;
0018 struct dso;
0019 struct perf_sample;
0020 struct addr_location;
0021 struct call_path;
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 enum {
0032 CALL_RETURN_NO_CALL = 1 << 0,
0033 CALL_RETURN_NO_RETURN = 1 << 1,
0034 CALL_RETURN_NON_CALL = 1 << 2,
0035 };
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 struct call_return {
0054 struct thread *thread;
0055 struct comm *comm;
0056 struct call_path *cp;
0057 u64 call_time;
0058 u64 return_time;
0059 u64 branch_count;
0060 u64 insn_count;
0061 u64 cyc_count;
0062 u64 call_ref;
0063 u64 return_ref;
0064 u64 db_id;
0065 u64 parent_db_id;
0066 u32 flags;
0067 };
0068
0069
0070
0071
0072
0073
0074
0075
0076 struct call_return_processor {
0077 struct call_path_root *cpr;
0078 int (*process)(struct call_return *cr, u64 *parent_db_id, void *data);
0079 void *data;
0080 };
0081
0082 int thread_stack__event(struct thread *thread, int cpu, u32 flags, u64 from_ip,
0083 u64 to_ip, u16 insn_len, u64 trace_nr, bool callstack,
0084 unsigned int br_stack_sz, bool mispred_all);
0085 void thread_stack__set_trace_nr(struct thread *thread, int cpu, u64 trace_nr);
0086 void thread_stack__sample(struct thread *thread, int cpu, struct ip_callchain *chain,
0087 size_t sz, u64 ip, u64 kernel_start);
0088 void thread_stack__sample_late(struct thread *thread, int cpu,
0089 struct ip_callchain *chain, size_t sz, u64 ip,
0090 u64 kernel_start);
0091 void thread_stack__br_sample(struct thread *thread, int cpu,
0092 struct branch_stack *dst, unsigned int sz);
0093 void thread_stack__br_sample_late(struct thread *thread, int cpu,
0094 struct branch_stack *dst, unsigned int sz,
0095 u64 sample_ip, u64 kernel_start);
0096 int thread_stack__flush(struct thread *thread);
0097 void thread_stack__free(struct thread *thread);
0098 size_t thread_stack__depth(struct thread *thread, int cpu);
0099
0100 struct call_return_processor *
0101 call_return_processor__new(int (*process)(struct call_return *cr, u64 *parent_db_id, void *data),
0102 void *data);
0103 void call_return_processor__free(struct call_return_processor *crp);
0104 int thread_stack__process(struct thread *thread, struct comm *comm,
0105 struct perf_sample *sample,
0106 struct addr_location *from_al,
0107 struct addr_location *to_al, u64 ref,
0108 struct call_return_processor *crp);
0109
0110 #endif