Lines Matching refs:thread
105 static inline bool thread_stack__per_cpu(struct thread *thread) in thread_stack__per_cpu() argument
107 return !(thread->tid || thread->pid_); in thread_stack__per_cpu()
128 static int thread_stack__init(struct thread_stack *ts, struct thread *thread, in thread_stack__init() argument
137 if (thread->mg && thread->mg->machine) { in thread_stack__init()
138 struct machine *machine = thread->mg->machine; in thread_stack__init()
152 static struct thread_stack *thread_stack__new(struct thread *thread, int cpu, in thread_stack__new() argument
155 struct thread_stack *ts = thread->ts, *new_ts; in thread_stack__new()
159 if (thread_stack__per_cpu(thread) && cpu > 0) in thread_stack__new()
169 zfree(&thread->ts); in thread_stack__new()
170 thread->ts = new_ts; in thread_stack__new()
174 if (thread_stack__per_cpu(thread) && cpu > 0 && in thread_stack__new()
179 thread_stack__init(ts, thread, crp)) in thread_stack__new()
185 static struct thread_stack *thread__cpu_stack(struct thread *thread, int cpu) in thread__cpu_stack() argument
187 struct thread_stack *ts = thread->ts; in thread__cpu_stack()
203 static inline struct thread_stack *thread__stack(struct thread *thread, in thread__stack() argument
206 if (!thread) in thread__stack()
209 if (thread_stack__per_cpu(thread)) in thread__stack()
210 return thread__cpu_stack(thread, cpu); in thread__stack()
212 return thread->ts; in thread__stack()
275 static int thread_stack__call_return(struct thread *thread, in thread_stack__call_return() argument
282 .thread = thread, in thread_stack__call_return()
315 static int __thread_stack__flush(struct thread *thread, struct thread_stack *ts) in __thread_stack__flush() argument
326 err = thread_stack__call_return(thread, ts, --ts->cnt, in __thread_stack__flush()
338 int thread_stack__flush(struct thread *thread) in thread_stack__flush() argument
340 struct thread_stack *ts = thread->ts; in thread_stack__flush()
346 int ret = __thread_stack__flush(thread, ts + pos); in thread_stack__flush()
356 int thread_stack__event(struct thread *thread, int cpu, u32 flags, u64 from_ip, in thread_stack__event() argument
359 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__event()
361 if (!thread) in thread_stack__event()
365 ts = thread_stack__new(thread, cpu, NULL); in thread_stack__event()
380 __thread_stack__flush(thread, ts); in thread_stack__event()
415 void thread_stack__set_trace_nr(struct thread *thread, int cpu, u64 trace_nr) in thread_stack__set_trace_nr() argument
417 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__set_trace_nr()
424 __thread_stack__flush(thread, ts); in thread_stack__set_trace_nr()
429 static void __thread_stack__free(struct thread *thread, struct thread_stack *ts) in __thread_stack__free() argument
431 __thread_stack__flush(thread, ts); in __thread_stack__free()
435 static void thread_stack__reset(struct thread *thread, struct thread_stack *ts) in thread_stack__reset() argument
439 __thread_stack__free(thread, ts); in thread_stack__reset()
444 void thread_stack__free(struct thread *thread) in thread_stack__free() argument
446 struct thread_stack *ts = thread->ts; in thread_stack__free()
451 __thread_stack__free(thread, ts + pos); in thread_stack__free()
452 zfree(&thread->ts); in thread_stack__free()
461 void thread_stack__sample(struct thread *thread, int cpu, in thread_stack__sample() argument
465 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__sample()
561 static int thread_stack__pop_cp(struct thread *thread, struct thread_stack *ts, in thread_stack__pop_cp() argument
574 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
580 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
591 err = thread_stack__call_return(thread, ts, in thread_stack__pop_cp()
598 return thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_cp()
633 static int thread_stack__pop_ks(struct thread *thread, struct thread_stack *ts, in thread_stack__pop_ks() argument
641 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__pop_ks()
650 static int thread_stack__no_call_return(struct thread *thread, in thread_stack__no_call_return() argument
669 err = thread_stack__pop_ks(thread, ts, sample, ref); in thread_stack__no_call_return()
681 err = thread_stack__pop_ks(thread, ts, sample, ref); in thread_stack__no_call_return()
698 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__no_call_return()
741 return thread_stack__call_return(thread, ts, --ts->cnt, tm, ref, false); in thread_stack__no_call_return()
744 static int thread_stack__trace_begin(struct thread *thread, in thread_stack__trace_begin() argument
757 err = thread_stack__call_return(thread, ts, --ts->cnt, in thread_stack__trace_begin()
850 int thread_stack__process(struct thread *thread, struct comm *comm, in thread_stack__process() argument
856 struct thread_stack *ts = thread__stack(thread, sample->cpu); in thread_stack__process()
862 thread_stack__reset(thread, ts); in thread_stack__process()
867 ts = thread_stack__new(thread, sample->cpu, crp); in thread_stack__process()
878 if (ts->comm != comm && thread->pid_ == thread->tid) { in thread_stack__process()
879 err = __thread_stack__flush(thread, ts); in thread_stack__process()
934 return thread_stack__pop_ks(thread, ts, sample, ref); in thread_stack__process()
945 err = thread_stack__pop_cp(thread, ts, sample->addr, in thread_stack__process()
950 err = thread_stack__no_call_return(thread, ts, sample, in thread_stack__process()
954 err = thread_stack__trace_begin(thread, ts, sample->time, ref); in thread_stack__process()
981 size_t thread_stack__depth(struct thread *thread, int cpu) in thread_stack__depth() argument
983 struct thread_stack *ts = thread__stack(thread, cpu); in thread_stack__depth()