Lines Matching refs:thread
113 static inline bool thread_stack__per_cpu(struct thread *thread) in thread_stack__per_cpu() argument
115 return !(thread->tid || thread->pid_); in thread_stack__per_cpu()
136 static int thread_stack__init(struct thread_stack *ts, struct thread *thread, in thread_stack__init() argument
158 if (thread->maps && thread->maps->machine) { in thread_stack__init()
159 struct machine *machine = thread->maps->machine; in thread_stack__init()
173 static struct thread_stack *thread_stack__new(struct thread *thread, int cpu, in thread_stack__new() argument
178 struct thread_stack *ts = thread->ts, *new_ts; in thread_stack__new()
182 if (thread_stack__per_cpu(thread) && cpu > 0) in thread_stack__new()
192 zfree(&thread->ts); in thread_stack__new()
193 thread->ts = new_ts; in thread_stack__new()
197 if (thread_stack__per_cpu(thread) && cpu > 0 && in thread_stack__new()
202 thread_stack__init(ts, thread, crp, callstack, br_stack_sz)) in thread_stack__new()
208 static struct thread_stack *thread__cpu_stack(struct thread *thread, int cpu) in thread__cpu_stack() argument
210 struct thread_stack *ts = thread->ts; in thread__cpu_stack()
226 static inline struct thread_stack *thread__stack(struct thread *thread, in thread__stack() argument
229 if (!thread) in thread__stack()
232 if (thread_stack__per_cpu(thread)) in thread__stack()
233 return thread__cpu_stack(thread, cpu); in thread__stack()
235 return thread->ts; in thread__stack()
298 static int thread_stack__call_return(struct thread *thread, in thread_stack__call_return() argument
305 .thread = thread, in thread_stack__call_return()
338 static int __thread_stack__flush(struct thread *thread, struct thread_stack *ts) in __thread_stack__flush() argument
352 err = thread_stack__call_return(thread, ts, --ts->cnt, in __thread_stack__flush()
364 int thread_stack__flush(struct thread *thread) in thread_stack__flush() argument
366 struct thread_stack *ts = thread->ts; in thread_stack__flush()
372 int ret = __thread_stack__flush(thread, ts + pos); in thread_stack__flush()
406 int thread_stack__event(struct thread *thread, int cpu, u32 flags, u64 from_ip, in thread_stack__event() argument
410 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__event()
412 if (!thread) in thread_stack__event()
416 ts = thread_stack__new(thread, cpu, NULL, callstack, br_stack_sz); in thread_stack__event()
432 __thread_stack__flush(thread, ts); in thread_stack__event()
473 void thread_stack__set_trace_nr(struct thread *thread, int cpu, u64 trace_nr) in thread_stack__set_trace_nr() argument
475 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__set_trace_nr()
482 __thread_stack__flush(thread, ts); in thread_stack__set_trace_nr()
487 static void __thread_stack__free(struct thread *thread, struct thread_stack *ts) in __thread_stack__free() argument
489 __thread_stack__flush(thread, ts); in __thread_stack__free()
494 static void thread_stack__reset(struct thread *thread, struct thread_stack *ts) in thread_stack__reset() argument
498 __thread_stack__free(thread, ts); in thread_stack__reset()
503 void thread_stack__free(struct thread *thread) in thread_stack__free() argument
505 struct thread_stack *ts = thread->ts; in thread_stack__free()
510 __thread_stack__free(thread, ts + pos); in thread_stack__free()
511 zfree(&thread->ts); in thread_stack__free()
520 void thread_stack__sample(struct thread *thread, int cpu, in thread_stack__sample() argument
524 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__sample()
563 void thread_stack__sample_late(struct thread *thread, int cpu, in thread_stack__sample_late() argument
567 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__sample_late()
616 void thread_stack__br_sample(struct thread *thread, int cpu, in thread_stack__br_sample() argument
619 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__br_sample()
677 void thread_stack__br_sample_late(struct thread *thread, int cpu, in thread_stack__br_sample_late() argument
681 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__br_sample_late()
813 static int thread_stack__pop_cp(struct thread *thread, struct thread_stack *ts, in thread_stack__pop_cp() argument
826 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
832 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
843 err = thread_stack__call_return(thread, ts, in thread_stack__pop_cp()
850 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
885 static int thread_stack__pop_ks(struct thread *thread, struct thread_stack *ts, in thread_stack__pop_ks() argument
893 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_ks()
902 static int thread_stack__no_call_return(struct thread *thread, in thread_stack__no_call_return() argument
921 err = thread_stack__pop_ks(thread, ts, sample, ref); in thread_stack__no_call_return()
933 err = thread_stack__pop_ks(thread, ts, sample, ref); in thread_stack__no_call_return()
950 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__no_call_return()
993 return thread_stack__call_return(thread, ts, --ts->cnt, tm, ref, false); in thread_stack__no_call_return()
996 static int thread_stack__trace_begin(struct thread *thread, in thread_stack__trace_begin() argument
1009 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__trace_begin()
1102 int thread_stack__process(struct thread *thread, struct comm *comm, in thread_stack__process() argument
1108 struct thread_stack *ts = thread__stack(thread, sample->cpu); in thread_stack__process()
1114 thread_stack__reset(thread, ts); in thread_stack__process()
1119 ts = thread_stack__new(thread, sample->cpu, crp, true, 0); in thread_stack__process()
1130 if (ts->comm != comm && thread->pid_ == thread->tid) { in thread_stack__process()
1131 err = __thread_stack__flush(thread, ts); in thread_stack__process()
1186 return thread_stack__pop_ks(thread, ts, sample, ref); in thread_stack__process()
1197 err = thread_stack__pop_cp(thread, ts, sample->addr, in thread_stack__process()
1202 err = thread_stack__no_call_return(thread, ts, sample, in thread_stack__process()
1206 err = thread_stack__trace_begin(thread, ts, sample->time, ref); in thread_stack__process()
1233 size_t thread_stack__depth(struct thread *thread, int cpu) in thread_stack__depth() argument
1235 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__depth()