Lines Matching refs:thread

126 static struct thread_stack *thread_stack__new(struct thread *thread,  in thread_stack__new()  argument
140 if (thread->mg && thread->mg->machine) in thread_stack__new()
141 ts->kernel_start = machine__kernel_start(thread->mg->machine); in thread_stack__new()
195 static int thread_stack__call_return(struct thread *thread, in thread_stack__call_return() argument
202 .thread = thread, in thread_stack__call_return()
222 static int __thread_stack__flush(struct thread *thread, struct thread_stack *ts) in __thread_stack__flush() argument
233 err = thread_stack__call_return(thread, ts, --ts->cnt, in __thread_stack__flush()
245 int thread_stack__flush(struct thread *thread) in thread_stack__flush() argument
247 if (thread->ts) in thread_stack__flush()
248 return __thread_stack__flush(thread, thread->ts); in thread_stack__flush()
253 int thread_stack__event(struct thread *thread, u32 flags, u64 from_ip, in thread_stack__event() argument
256 if (!thread) in thread_stack__event()
259 if (!thread->ts) { in thread_stack__event()
260 thread->ts = thread_stack__new(thread, NULL); in thread_stack__event()
261 if (!thread->ts) { in thread_stack__event()
265 thread->ts->trace_nr = trace_nr; in thread_stack__event()
273 if (trace_nr != thread->ts->trace_nr) { in thread_stack__event()
274 if (thread->ts->trace_nr) in thread_stack__event()
275 __thread_stack__flush(thread, thread->ts); in thread_stack__event()
276 thread->ts->trace_nr = trace_nr; in thread_stack__event()
280 if (thread->ts->crp) in thread_stack__event()
291 return thread_stack__push(thread->ts, ret_addr); in thread_stack__event()
295 thread_stack__pop(thread->ts, to_ip); in thread_stack__event()
301 void thread_stack__set_trace_nr(struct thread *thread, u64 trace_nr) in thread_stack__set_trace_nr() argument
303 if (!thread || !thread->ts) in thread_stack__set_trace_nr()
306 if (trace_nr != thread->ts->trace_nr) { in thread_stack__set_trace_nr()
307 if (thread->ts->trace_nr) in thread_stack__set_trace_nr()
308 __thread_stack__flush(thread, thread->ts); in thread_stack__set_trace_nr()
309 thread->ts->trace_nr = trace_nr; in thread_stack__set_trace_nr()
313 void thread_stack__free(struct thread *thread) in thread_stack__free() argument
315 if (thread->ts) { in thread_stack__free()
316 __thread_stack__flush(thread, thread->ts); in thread_stack__free()
317 zfree(&thread->ts->stack); in thread_stack__free()
318 zfree(&thread->ts); in thread_stack__free()
322 void thread_stack__sample(struct thread *thread, struct ip_callchain *chain, in thread_stack__sample() argument
327 if (!thread || !thread->ts) in thread_stack__sample()
330 chain->nr = min(sz, thread->ts->cnt + 1); in thread_stack__sample()
335 chain->ips[i] = thread->ts->stack[thread->ts->cnt - i].ret_addr; in thread_stack__sample()
493 static int thread_stack__pop_cp(struct thread *thread, struct thread_stack *ts, in thread_stack__pop_cp() argument
506 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
511 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
521 err = thread_stack__call_return(thread, ts, in thread_stack__pop_cp()
528 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
536 static int thread_stack__bottom(struct thread *thread, struct thread_stack *ts, in thread_stack__bottom() argument
561 return thread_stack__push_cp(thread->ts, ip, sample->time, ref, cp, in thread_stack__bottom()
565 static int thread_stack__no_call_return(struct thread *thread, in thread_stack__no_call_return() argument
579 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__no_call_return()
599 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__no_call_return()
623 return thread_stack__pop_cp(thread, ts, sample->addr, sample->time, ref, in thread_stack__no_call_return()
627 static int thread_stack__trace_begin(struct thread *thread, in thread_stack__trace_begin() argument
640 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__trace_begin()
671 int thread_stack__process(struct thread *thread, struct comm *comm, in thread_stack__process() argument
677 struct thread_stack *ts = thread->ts; in thread_stack__process()
683 thread_stack__free(thread); in thread_stack__process()
684 thread->ts = thread_stack__new(thread, crp); in thread_stack__process()
685 if (!thread->ts) in thread_stack__process()
687 ts = thread->ts; in thread_stack__process()
691 thread->ts = thread_stack__new(thread, crp); in thread_stack__process()
692 if (!thread->ts) in thread_stack__process()
694 ts = thread->ts; in thread_stack__process()
699 if (ts->comm != comm && thread->pid_ == thread->tid) { in thread_stack__process()
700 err = __thread_stack__flush(thread, ts); in thread_stack__process()
708 err = thread_stack__bottom(thread, ts, sample, from_al, to_al, in thread_stack__process()
740 err = thread_stack__pop_cp(thread, ts, sample->addr, in thread_stack__process()
745 err = thread_stack__no_call_return(thread, ts, sample, in thread_stack__process()
749 err = thread_stack__trace_begin(thread, ts, sample->time, ref); in thread_stack__process()