Lines Matching refs:thread
44 static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock);
115 struct thread *thread = machine__findnew_thread(machine, -1, in machine__init() local
119 if (thread == NULL) in machine__init()
123 thread__set_comm(thread, comm, 0); in machine__init()
124 thread__put(thread); in machine__init()
204 struct thread *t = rb_entry(nd, struct thread, rb_node); in machine__delete_threads()
230 struct thread *thread, *n; in machine__exit() local
239 list_for_each_entry_safe(thread, n, &threads->dead, node) in machine__exit()
240 list_del_init(&thread->node); in machine__exit()
400 struct thread *th, pid_t pid) in machine__update_thread_pid()
402 struct thread *leader; in machine__update_thread_pid()
451 static struct thread*
455 struct thread *th; in __threads__get_last_match()
470 static struct thread*
474 struct thread *th = NULL; in threads__get_last_match()
483 __threads__set_last_match(struct threads *threads, struct thread *th) in __threads__set_last_match()
489 threads__set_last_match(struct threads *threads, struct thread *th) in threads__set_last_match()
499 static struct thread *____machine__findnew_thread(struct machine *machine, in ____machine__findnew_thread()
506 struct thread *th; in ____machine__findnew_thread()
515 th = rb_entry(parent, struct thread, rb_node); in ____machine__findnew_thread()
563 struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid) in __machine__findnew_thread()
568 struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, in machine__findnew_thread()
572 struct thread *th; in machine__findnew_thread()
580 struct thread *machine__find_thread(struct machine *machine, pid_t pid, in machine__find_thread()
584 struct thread *th; in machine__find_thread()
593 struct thread *thread) in machine__thread_exec_comm() argument
596 return thread__exec_comm(thread); in machine__thread_exec_comm()
598 return thread__comm(thread); in machine__thread_exec_comm()
604 struct thread *thread = machine__findnew_thread(machine, in machine__process_comm_event() local
616 if (thread == NULL || in machine__process_comm_event()
617 __thread__set_comm(thread, event->comm.comm, sample->time, exec)) { in machine__process_comm_event()
622 thread__put(thread); in machine__process_comm_event()
631 struct thread *thread = machine__findnew_thread(machine, in machine__process_namespaces_event() local
647 if (thread == NULL || in machine__process_namespaces_event()
648 thread__set_namespaces(thread, sample->time, &event->namespaces)) { in machine__process_namespaces_event()
653 thread__put(thread); in machine__process_namespaces_event()
957 struct thread *pos = rb_entry(nd, struct thread, rb_node); in machine__fprintf()
1723 struct thread *thread; in machine__process_mmap2_event() local
1744 thread = machine__findnew_thread(machine, event->mmap2.pid, in machine__process_mmap2_event()
1746 if (thread == NULL) in machine__process_mmap2_event()
1753 event->mmap2.filename, thread); in machine__process_mmap2_event()
1758 ret = thread__insert_map(thread, map); in machine__process_mmap2_event()
1762 thread__put(thread); in machine__process_mmap2_event()
1769 thread__put(thread); in machine__process_mmap2_event()
1778 struct thread *thread; in machine__process_mmap_event() local
1794 thread = machine__findnew_thread(machine, event->mmap.pid, in machine__process_mmap_event()
1796 if (thread == NULL) in machine__process_mmap_event()
1804 NULL, prot, 0, event->mmap.filename, thread); in machine__process_mmap_event()
1809 ret = thread__insert_map(thread, map); in machine__process_mmap_event()
1813 thread__put(thread); in machine__process_mmap_event()
1820 thread__put(thread); in machine__process_mmap_event()
1826 static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock) in __machine__remove_thread()
1859 void machine__remove_thread(struct machine *machine, struct thread *th) in machine__remove_thread()
1867 struct thread *thread = machine__find_thread(machine, in machine__process_fork_event() local
1870 struct thread *parent = machine__findnew_thread(machine, in machine__process_fork_event()
1895 if (thread != NULL) { in machine__process_fork_event()
1896 machine__remove_thread(machine, thread); in machine__process_fork_event()
1897 thread__put(thread); in machine__process_fork_event()
1900 thread = machine__findnew_thread(machine, event->fork.pid, in machine__process_fork_event()
1919 if (thread == NULL || parent == NULL || in machine__process_fork_event()
1920 thread__fork(thread, parent, sample->time, do_maps_clone) < 0) { in machine__process_fork_event()
1924 thread__put(thread); in machine__process_fork_event()
1933 struct thread *thread = machine__find_thread(machine, in machine__process_exit_event() local
1940 if (thread != NULL) { in machine__process_exit_event()
1941 thread__exited(thread); in machine__process_exit_event()
1942 thread__put(thread); in machine__process_exit_event()
2000 static void ip__resolve_ams(struct thread *thread, in ip__resolve_ams() argument
2014 thread__find_cpumode_addr_location(thread, ip, &al); in ip__resolve_ams()
2024 static void ip__resolve_data(struct thread *thread, in ip__resolve_data() argument
2032 thread__find_symbol(thread, m, addr, &al); in ip__resolve_data()
2050 ip__resolve_ams(al->thread, &mi->iaddr, sample->ip); in sample__resolve_mem()
2051 ip__resolve_data(al->thread, al->cpumode, &mi->daddr, in sample__resolve_mem()
2084 static int add_callchain_ip(struct thread *thread, in add_callchain_ip() argument
2105 thread__find_cpumode_addr_location(thread, ip, &al); in add_callchain_ip()
2130 thread__find_symbol(thread, *cpumode, ip, &al); in add_callchain_ip()
2175 ip__resolve_ams(al->thread, &bi[i].to, entries[i].to); in sample__resolve_bstack()
2176 ip__resolve_ams(al->thread, &bi[i].from, entries[i].from); in sample__resolve_bstack()
2246 static int lbr_callchain_add_kernel_ip(struct thread *thread, in lbr_callchain_add_kernel_ip() argument
2260 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_kernel_ip()
2270 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_kernel_ip()
2280 static void save_lbr_cursor_node(struct thread *thread, in save_lbr_cursor_node() argument
2284 struct lbr_stitch *lbr_stitch = thread->lbr_stitch; in save_lbr_cursor_node()
2305 static int lbr_callchain_add_lbr_ip(struct thread *thread, in lbr_callchain_add_lbr_ip() argument
2326 if (thread->lbr_stitch) { in lbr_callchain_add_lbr_ip()
2341 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_lbr_ip()
2354 if (thread->lbr_stitch && (cursor->pos != cursor->nr)) { in lbr_callchain_add_lbr_ip()
2366 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_lbr_ip()
2372 save_lbr_cursor_node(thread, cursor, i); in lbr_callchain_add_lbr_ip()
2381 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_lbr_ip()
2387 save_lbr_cursor_node(thread, cursor, i); in lbr_callchain_add_lbr_ip()
2395 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_lbr_ip()
2406 static int lbr_callchain_add_stitched_lbr_ip(struct thread *thread, in lbr_callchain_add_stitched_lbr_ip() argument
2409 struct lbr_stitch *lbr_stitch = thread->lbr_stitch; in lbr_callchain_add_stitched_lbr_ip()
2431 static struct stitch_list *get_stitch_node(struct thread *thread) in get_stitch_node() argument
2433 struct lbr_stitch *lbr_stitch = thread->lbr_stitch; in get_stitch_node()
2447 static bool has_stitched_lbr(struct thread *thread, in has_stitched_lbr() argument
2457 struct lbr_stitch *lbr_stitch = thread->lbr_stitch; in has_stitched_lbr()
2503 stitch_node = get_stitch_node(thread); in has_stitched_lbr()
2519 static bool alloc_lbr_stitch(struct thread *thread, unsigned int max_lbr) in alloc_lbr_stitch() argument
2521 if (thread->lbr_stitch) in alloc_lbr_stitch()
2524 thread->lbr_stitch = zalloc(sizeof(*thread->lbr_stitch)); in alloc_lbr_stitch()
2525 if (!thread->lbr_stitch) in alloc_lbr_stitch()
2528 thread->lbr_stitch->prev_lbr_cursor = calloc(max_lbr + 1, sizeof(struct callchain_cursor_node)); in alloc_lbr_stitch()
2529 if (!thread->lbr_stitch->prev_lbr_cursor) in alloc_lbr_stitch()
2532 INIT_LIST_HEAD(&thread->lbr_stitch->lists); in alloc_lbr_stitch()
2533 INIT_LIST_HEAD(&thread->lbr_stitch->free_lists); in alloc_lbr_stitch()
2538 zfree(&thread->lbr_stitch); in alloc_lbr_stitch()
2541 thread->lbr_stitch_enable = false; in alloc_lbr_stitch()
2552 static int resolve_lbr_callchain_sample(struct thread *thread, in resolve_lbr_callchain_sample() argument
2577 if (thread->lbr_stitch_enable && !sample->no_hw_idx && in resolve_lbr_callchain_sample()
2578 (max_lbr > 0) && alloc_lbr_stitch(thread, max_lbr)) { in resolve_lbr_callchain_sample()
2579 lbr_stitch = thread->lbr_stitch; in resolve_lbr_callchain_sample()
2581 stitched_lbr = has_stitched_lbr(thread, sample, in resolve_lbr_callchain_sample()
2594 err = lbr_callchain_add_kernel_ip(thread, cursor, sample, in resolve_lbr_callchain_sample()
2600 err = lbr_callchain_add_lbr_ip(thread, cursor, sample, parent, in resolve_lbr_callchain_sample()
2606 err = lbr_callchain_add_stitched_lbr_ip(thread, cursor); in resolve_lbr_callchain_sample()
2613 err = lbr_callchain_add_stitched_lbr_ip(thread, cursor); in resolve_lbr_callchain_sample()
2617 err = lbr_callchain_add_lbr_ip(thread, cursor, sample, parent, in resolve_lbr_callchain_sample()
2623 err = lbr_callchain_add_kernel_ip(thread, cursor, sample, in resolve_lbr_callchain_sample()
2635 static int find_prev_cpumode(struct ip_callchain *chain, struct thread *thread, in find_prev_cpumode() argument
2647 err = add_callchain_ip(thread, cursor, parent, in find_prev_cpumode()
2656 static int thread__resolve_callchain_sample(struct thread *thread, in thread__resolve_callchain_sample() argument
2679 err = resolve_lbr_callchain_sample(thread, cursor, sample, parent, in thread__resolve_callchain_sample()
2690 skip_idx = arch_skip_callchain_idx(thread, chain); in thread__resolve_callchain_sample()
2742 err = add_callchain_ip(thread, cursor, parent, in thread__resolve_callchain_sample()
2749 err = add_callchain_ip(thread, cursor, parent, root_al, in thread__resolve_callchain_sample()
2767 err = find_prev_cpumode(chain, thread, cursor, parent, root_al, in thread__resolve_callchain_sample()
2789 err = find_prev_cpumode(chain, thread, cursor, parent, in thread__resolve_callchain_sample()
2796 err = add_callchain_ip(thread, cursor, parent, in thread__resolve_callchain_sample()
2870 static int thread__resolve_callchain_unwind(struct thread *thread, in thread__resolve_callchain_unwind() argument
2887 thread, sample, max_stack); in thread__resolve_callchain_unwind()
2890 int thread__resolve_callchain(struct thread *thread, in thread__resolve_callchain() argument
2903 ret = thread__resolve_callchain_sample(thread, cursor, in thread__resolve_callchain()
2909 ret = thread__resolve_callchain_unwind(thread, cursor, in thread__resolve_callchain()
2913 ret = thread__resolve_callchain_unwind(thread, cursor, in thread__resolve_callchain()
2918 ret = thread__resolve_callchain_sample(thread, cursor, in thread__resolve_callchain()
2928 int (*fn)(struct thread *thread, void *p), in machine__for_each_thread() argument
2933 struct thread *thread; in machine__for_each_thread() local
2941 thread = rb_entry(nd, struct thread, rb_node); in machine__for_each_thread()
2942 rc = fn(thread, priv); in machine__for_each_thread()
2947 list_for_each_entry(thread, &threads->dead, node) { in machine__for_each_thread()
2948 rc = fn(thread, priv); in machine__for_each_thread()
2957 int (*fn)(struct thread *thread, void *p), in machines__for_each_thread() argument
2990 struct thread *thread; in machine__set_current_tid() local
3014 thread = machine__findnew_thread(machine, pid, tid); in machine__set_current_tid()
3015 if (!thread) in machine__set_current_tid()
3018 thread->cpu = cpu; in machine__set_current_tid()
3019 thread__put(thread); in machine__set_current_tid()