16 #include <linux/rbtree.h> 17 #include <linux/list.h> 29 #define STACK_GROWTH 2048 82 new_stack = realloc(ts->
stack, sz);
86 ts->
stack = new_stack;
119 if (ts->
cnt == ts->
sz) {
122 pr_warning(
"Out of memory: discarding thread stack\n");
145 for (i = ts->
cnt; i; ) {
173 tse = &ts->
stack[idx];
202 pr_err(
"Error flushing thread stack!\n");
220 u64 to_ip, u16 insn_len, u64 trace_nr)
228 pr_warning(
"Out of memory: no thread stack\n");
254 ret_addr = from_ip + insn_len;
255 if (ret_addr == to_ip)
269 if (!thread || !thread->
ts)
293 if (!thread || !thread->
ts)
300 for (i = 1; i < chain->
nr; i++)
340 if (ts->
cnt == ts->
sz) {
369 if (tse->
cp->
sym == sym)
371 timestamp, ref,
false);
376 timestamp, ref,
false);
378 size_t i = ts->
cnt - 1;
384 while (ts->
cnt > i) {
393 timestamp, ref,
false);
413 }
else if (sample->
addr) {
440 if (sample->
ip >= ks && sample->
addr < ks) {
503 if (tse->
cp->
sym == NULL && tse->
cp->
ip == 0) {
505 timestamp, ref,
false);
563 if (ts->
comm != comm && thread->
pid_ == thread->
tid) {
586 if (!sample->
ip || !sample->
addr)
590 if (ret_addr == sample->
addr)
601 if (!sample->
ip || !sample->
addr)
605 sample->
time, ref, from_al->
sym);
610 from_al, to_al, ref);
625 return thread->
ts->
cnt;
static int thread_stack__bottom(struct thread *thread, struct thread_stack *ts, struct perf_sample *sample, struct addr_location *from_al, struct addr_location *to_al, u64 ref)
static int thread_stack__pop_cp(struct thread *thread, struct thread_stack *ts, u64 ret_addr, u64 timestamp, u64 ref, struct symbol *sym)
struct call_return_processor * call_return_processor__new(int(*process)(struct call_return *cr, void *data), void *data)
void call_path_root__free(struct call_path_root *cpr)
void thread_stack__free(struct thread *thread)
static int thread_stack__push_cp(struct thread_stack *ts, u64 ret_addr, u64 timestamp, u64 ref, struct call_path *cp, bool no_call)
int thread_stack__event(struct thread *thread, u32 flags, u64 from_ip, u64 to_ip, u16 insn_len, u64 trace_nr)
struct call_return_processor * crp
void call_return_processor__free(struct call_return_processor *crp)
struct call_path * parent
struct call_path call_path
struct call_path * call_path__findnew(struct call_path_root *cpr, struct call_path *parent, struct symbol *sym, u64 ip, u64 ks)
static void thread_stack__pop(struct thread_stack *ts, u64 ret_addr)
int thread_stack__process(struct thread *thread, struct comm *comm, struct perf_sample *sample, struct addr_location *from_al, struct addr_location *to_al, u64 ref, struct call_return_processor *crp)
static int thread_stack__grow(struct thread_stack *ts)
struct call_path_root * cpr
static int thread_stack__no_call_return(struct thread *thread, struct thread_stack *ts, struct perf_sample *sample, struct addr_location *from_al, struct addr_location *to_al, u64 ref)
static bool thread_stack__in_kernel(struct thread_stack *ts)
size_t thread_stack__depth(struct thread *thread)
static int thread_stack__call_return(struct thread *thread, struct thread_stack *ts, size_t idx, u64 timestamp, u64 ref, bool no_return)
static struct thread_stack * thread_stack__new(struct thread *thread, struct call_return_processor *crp)
int(* process)(struct call_return *cr, void *data)
static int sym(yyscan_t scanner, int type, int config)
static int thread_stack__trace_begin(struct thread *thread, struct thread_stack *ts, u64 timestamp, u64 ref)
void thread_stack__sample(struct thread *thread, struct ip_callchain *chain, size_t sz, u64 ip)
void thread_stack__set_trace_nr(struct thread *thread, u64 trace_nr)
int thread_stack__flush(struct thread *thread)
struct call_path_root * call_path_root__new(void)
static int thread_stack__push(struct thread_stack *ts, u64 ret_addr)
struct thread_stack_entry * stack
#define pr_warning(fmt,...)
static int __thread_stack__flush(struct thread *thread, struct thread_stack *ts)
static u64 machine__kernel_start(struct machine *machine)
static int thread_stack__trace_end(struct thread_stack *ts, struct perf_sample *sample, u64 ref)
void static void * zalloc(size_t size)