Lines Matching refs:thread

92 static struct thread_stack *thread_stack__new(struct thread *thread,  in thread_stack__new()  argument
106 if (thread->mg && thread->mg->machine) in thread_stack__new()
107 ts->kernel_start = machine__kernel_start(thread->mg->machine); in thread_stack__new()
161 static int thread_stack__call_return(struct thread *thread, in thread_stack__call_return() argument
168 .thread = thread, in thread_stack__call_return()
188 static int __thread_stack__flush(struct thread *thread, struct thread_stack *ts) in __thread_stack__flush() argument
199 err = thread_stack__call_return(thread, ts, --ts->cnt, in __thread_stack__flush()
211 int thread_stack__flush(struct thread *thread) in thread_stack__flush() argument
213 if (thread->ts) in thread_stack__flush()
214 return __thread_stack__flush(thread, thread->ts); in thread_stack__flush()
219 int thread_stack__event(struct thread *thread, u32 flags, u64 from_ip, in thread_stack__event() argument
222 if (!thread) in thread_stack__event()
225 if (!thread->ts) { in thread_stack__event()
226 thread->ts = thread_stack__new(thread, NULL); in thread_stack__event()
227 if (!thread->ts) { in thread_stack__event()
231 thread->ts->trace_nr = trace_nr; in thread_stack__event()
239 if (trace_nr != thread->ts->trace_nr) { in thread_stack__event()
240 if (thread->ts->trace_nr) in thread_stack__event()
241 __thread_stack__flush(thread, thread->ts); in thread_stack__event()
242 thread->ts->trace_nr = trace_nr; in thread_stack__event()
246 if (thread->ts->crp) in thread_stack__event()
257 return thread_stack__push(thread->ts, ret_addr); in thread_stack__event()
261 thread_stack__pop(thread->ts, to_ip); in thread_stack__event()
267 void thread_stack__set_trace_nr(struct thread *thread, u64 trace_nr) in thread_stack__set_trace_nr() argument
269 if (!thread || !thread->ts) in thread_stack__set_trace_nr()
272 if (trace_nr != thread->ts->trace_nr) { in thread_stack__set_trace_nr()
273 if (thread->ts->trace_nr) in thread_stack__set_trace_nr()
274 __thread_stack__flush(thread, thread->ts); in thread_stack__set_trace_nr()
275 thread->ts->trace_nr = trace_nr; in thread_stack__set_trace_nr()
279 void thread_stack__free(struct thread *thread) in thread_stack__free() argument
281 if (thread->ts) { in thread_stack__free()
282 __thread_stack__flush(thread, thread->ts); in thread_stack__free()
283 zfree(&thread->ts->stack); in thread_stack__free()
284 zfree(&thread->ts); in thread_stack__free()
288 void thread_stack__sample(struct thread *thread, struct ip_callchain *chain, in thread_stack__sample() argument
293 if (!thread || !thread->ts) in thread_stack__sample()
296 chain->nr = min(sz, thread->ts->cnt + 1); in thread_stack__sample()
301 chain->ips[i] = thread->ts->stack[thread->ts->cnt - i].ret_addr; in thread_stack__sample()
357 static int thread_stack__pop_cp(struct thread *thread, struct thread_stack *ts, in thread_stack__pop_cp() argument
370 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
375 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
385 err = thread_stack__call_return(thread, ts, in thread_stack__pop_cp()
392 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
400 static int thread_stack__bottom(struct thread *thread, struct thread_stack *ts, in thread_stack__bottom() argument
425 return thread_stack__push_cp(thread->ts, ip, sample->time, ref, cp, in thread_stack__bottom()
429 static int thread_stack__no_call_return(struct thread *thread, in thread_stack__no_call_return() argument
443 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__no_call_return()
463 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__no_call_return()
487 return thread_stack__pop_cp(thread, ts, sample->addr, sample->time, ref, in thread_stack__no_call_return()
491 static int thread_stack__trace_begin(struct thread *thread, in thread_stack__trace_begin() argument
504 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__trace_begin()
535 int thread_stack__process(struct thread *thread, struct comm *comm, in thread_stack__process() argument
541 struct thread_stack *ts = thread->ts; in thread_stack__process()
547 thread_stack__free(thread); in thread_stack__process()
548 thread->ts = thread_stack__new(thread, crp); in thread_stack__process()
549 if (!thread->ts) in thread_stack__process()
551 ts = thread->ts; in thread_stack__process()
555 thread->ts = thread_stack__new(thread, crp); in thread_stack__process()
556 if (!thread->ts) in thread_stack__process()
558 ts = thread->ts; in thread_stack__process()
563 if (ts->comm != comm && thread->pid_ == thread->tid) { in thread_stack__process()
564 err = __thread_stack__flush(thread, ts); in thread_stack__process()
572 err = thread_stack__bottom(thread, ts, sample, from_al, to_al, in thread_stack__process()
604 err = thread_stack__pop_cp(thread, ts, sample->addr, in thread_stack__process()
609 err = thread_stack__no_call_return(thread, ts, sample, in thread_stack__process()
613 err = thread_stack__trace_begin(thread, ts, sample->time, ref); in thread_stack__process()
621 size_t thread_stack__depth(struct thread *thread) in thread_stack__depth() argument
623 if (!thread->ts) in thread_stack__depth()
625 return thread->ts->cnt; in thread_stack__depth()