Lines Matching refs:thread

67 static void thread__set_guest_comm(struct thread *thread, pid_t pid)  in thread__set_guest_comm()  argument
72 thread__set_comm(thread, comm, 0); in thread__set_guest_comm()
110 struct thread *thread = machine__findnew_thread(machine, -1, in machine__init() local
113 if (thread == NULL) in machine__init()
116 thread__set_guest_comm(thread, pid); in machine__init()
117 thread__put(thread); in machine__init()
386 static struct thread *findnew_guest_code(struct machine *machine, in findnew_guest_code()
390 struct thread *host_thread; in findnew_guest_code()
391 struct thread *thread; in findnew_guest_code() local
397 thread = machine__findnew_thread(machine, -1, pid); in findnew_guest_code()
398 if (!thread) in findnew_guest_code()
402 if (!maps__empty(thread__maps(thread))) in findnew_guest_code()
403 return thread; in findnew_guest_code()
409 thread__set_guest_comm(thread, pid); in findnew_guest_code()
415 err = maps__copy_from(thread__maps(thread), thread__maps(host_thread)); in findnew_guest_code()
420 return thread; in findnew_guest_code()
423 thread__zput(thread); in findnew_guest_code()
427 struct thread *machines__findnew_guest_code(struct machines *machines, pid_t pid) in machines__findnew_guest_code()
435 struct thread *machine__findnew_guest_code(struct machine *machine, pid_t pid) in machine__findnew_guest_code()
476 struct thread *th, pid_t pid) in machine__update_thread_pid()
478 struct thread *leader; in machine__update_thread_pid()
526 static struct thread *__machine__findnew_thread(struct machine *machine, in __machine__findnew_thread()
531 struct thread *th = threads__find(&machine->threads, tid); 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__find_thread(struct machine *machine, pid_t pid, in machine__find_thread()
581 struct thread *machine__idle_thread(struct machine *machine) in machine__idle_thread()
583 struct thread *thread = machine__findnew_thread(machine, 0, 0); in machine__idle_thread() local
585 if (!thread || thread__set_comm(thread, "swapper", 0) || in machine__idle_thread()
586 thread__set_namespaces(thread, 0, NULL)) in machine__idle_thread()
589 return thread; in machine__idle_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()
939 static int machine_fprintf_cb(struct thread *thread, void *data) in machine_fprintf_cb() argument
944 args->printed += thread__fprintf(thread, args->fp); in machine_fprintf_cb()
1732 struct thread *thread; in machine__process_mmap2_event() local
1766 thread = machine__findnew_thread(machine, event->mmap2.pid, in machine__process_mmap2_event()
1768 if (thread == NULL) in machine__process_mmap2_event()
1775 event->mmap2.filename, thread); in machine__process_mmap2_event()
1780 ret = thread__insert_map(thread, map); in machine__process_mmap2_event()
1784 thread__put(thread); in machine__process_mmap2_event()
1791 thread__put(thread); in machine__process_mmap2_event()
1800 struct thread *thread; in machine__process_mmap_event() local
1823 thread = machine__findnew_thread(machine, event->mmap.pid, in machine__process_mmap_event()
1825 if (thread == NULL) in machine__process_mmap_event()
1833 &dso_id_empty, prot, /*flags=*/0, event->mmap.filename, thread); in machine__process_mmap_event()
1838 ret = thread__insert_map(thread, map); in machine__process_mmap_event()
1842 thread__put(thread); in machine__process_mmap_event()
1849 thread__put(thread); in machine__process_mmap_event()
1855 void machine__remove_thread(struct machine *machine, struct thread *th) in machine__remove_thread()
1863 struct thread *thread = machine__find_thread(machine, in machine__process_fork_event() local
1866 struct thread *parent = machine__findnew_thread(machine, in machine__process_fork_event()
1891 if (thread != NULL) { in machine__process_fork_event()
1892 machine__remove_thread(machine, thread); in machine__process_fork_event()
1893 thread__put(thread); in machine__process_fork_event()
1896 thread = machine__findnew_thread(machine, event->fork.pid, in machine__process_fork_event()
1915 if (thread == NULL || parent == NULL || in machine__process_fork_event()
1916 thread__fork(thread, parent, sample->time, do_maps_clone) < 0) { in machine__process_fork_event()
1920 thread__put(thread); in machine__process_fork_event()
1929 struct thread *thread = machine__find_thread(machine, in machine__process_exit_event() local
1938 if (thread != NULL) { in machine__process_exit_event()
1940 thread__set_exited(thread, /*exited=*/true); in machine__process_exit_event()
1942 machine__remove_thread(machine, thread); in machine__process_exit_event()
1944 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, /*symbols=*/true, &al); in ip__resolve_ams()
2027 static void ip__resolve_data(struct thread *thread, in ip__resolve_data() argument
2035 thread__find_symbol(thread, m, addr, &al); in ip__resolve_data()
2056 ip__resolve_ams(al->thread, mem_info__iaddr(mi), sample->ip); in sample__resolve_mem()
2057 ip__resolve_data(al->thread, al->cpumode, mem_info__daddr(mi), in sample__resolve_mem()
2093 static int add_callchain_ip(struct thread *thread, in add_callchain_ip() argument
2116 thread__find_cpumode_addr_location(thread, ip, symbols, &al); in add_callchain_ip()
2143 thread__find_symbol(thread, *cpumode, ip, &al); in add_callchain_ip()
2145 thread__find_map(thread, *cpumode, ip, &al); in add_callchain_ip()
2195 ip__resolve_ams(al->thread, &bi[i].to, entries[i].to); in sample__resolve_bstack()
2196 ip__resolve_ams(al->thread, &bi[i].from, entries[i].from); in sample__resolve_bstack()
2268 static int lbr_callchain_add_kernel_ip(struct thread *thread, in lbr_callchain_add_kernel_ip() argument
2283 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_kernel_ip()
2294 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_kernel_ip()
2305 static void save_lbr_cursor_node(struct thread *thread, in save_lbr_cursor_node() argument
2309 struct lbr_stitch *lbr_stitch = thread__lbr_stitch(thread); in save_lbr_cursor_node()
2334 static int lbr_callchain_add_lbr_ip(struct thread *thread, in lbr_callchain_add_lbr_ip() argument
2356 if (thread__lbr_stitch(thread)) { in lbr_callchain_add_lbr_ip()
2371 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_lbr_ip()
2384 if (thread__lbr_stitch(thread) && (cursor->pos != cursor->nr)) { in lbr_callchain_add_lbr_ip()
2396 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_lbr_ip()
2402 save_lbr_cursor_node(thread, cursor, i); in lbr_callchain_add_lbr_ip()
2411 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_lbr_ip()
2417 save_lbr_cursor_node(thread, cursor, i); in lbr_callchain_add_lbr_ip()
2425 err = add_callchain_ip(thread, cursor, parent, in lbr_callchain_add_lbr_ip()
2436 static int lbr_callchain_add_stitched_lbr_ip(struct thread *thread, in lbr_callchain_add_stitched_lbr_ip() argument
2439 struct lbr_stitch *lbr_stitch = thread__lbr_stitch(thread); in lbr_callchain_add_stitched_lbr_ip()
2461 static struct stitch_list *get_stitch_node(struct thread *thread) in get_stitch_node() argument
2463 struct lbr_stitch *lbr_stitch = thread__lbr_stitch(thread); in get_stitch_node()
2477 static bool has_stitched_lbr(struct thread *thread, in has_stitched_lbr() argument
2487 struct lbr_stitch *lbr_stitch = thread__lbr_stitch(thread); in has_stitched_lbr()
2533 stitch_node = get_stitch_node(thread); in has_stitched_lbr()
2552 static bool alloc_lbr_stitch(struct thread *thread, unsigned int max_lbr) in alloc_lbr_stitch() argument
2554 if (thread__lbr_stitch(thread)) in alloc_lbr_stitch()
2557 thread__set_lbr_stitch(thread, zalloc(sizeof(struct lbr_stitch))); in alloc_lbr_stitch()
2558 if (!thread__lbr_stitch(thread)) in alloc_lbr_stitch()
2561 thread__lbr_stitch(thread)->prev_lbr_cursor = in alloc_lbr_stitch()
2563 if (!thread__lbr_stitch(thread)->prev_lbr_cursor) in alloc_lbr_stitch()
2566 thread__lbr_stitch(thread)->prev_lbr_cursor_size = max_lbr + 1; in alloc_lbr_stitch()
2568 INIT_LIST_HEAD(&thread__lbr_stitch(thread)->lists); in alloc_lbr_stitch()
2569 INIT_LIST_HEAD(&thread__lbr_stitch(thread)->free_lists); in alloc_lbr_stitch()
2574 free(thread__lbr_stitch(thread)); in alloc_lbr_stitch()
2575 thread__set_lbr_stitch(thread, NULL); in alloc_lbr_stitch()
2578 thread__set_lbr_stitch_enable(thread, false); in alloc_lbr_stitch()
2589 static int resolve_lbr_callchain_sample(struct thread *thread, in resolve_lbr_callchain_sample() argument
2615 if (thread__lbr_stitch_enable(thread) && !sample->no_hw_idx && in resolve_lbr_callchain_sample()
2616 (max_lbr > 0) && alloc_lbr_stitch(thread, max_lbr)) { in resolve_lbr_callchain_sample()
2617 lbr_stitch = thread__lbr_stitch(thread); in resolve_lbr_callchain_sample()
2619 stitched_lbr = has_stitched_lbr(thread, sample, in resolve_lbr_callchain_sample()
2636 err = lbr_callchain_add_kernel_ip(thread, cursor, sample, in resolve_lbr_callchain_sample()
2642 err = lbr_callchain_add_lbr_ip(thread, cursor, sample, parent, in resolve_lbr_callchain_sample()
2648 err = lbr_callchain_add_stitched_lbr_ip(thread, cursor); in resolve_lbr_callchain_sample()
2655 err = lbr_callchain_add_stitched_lbr_ip(thread, cursor); in resolve_lbr_callchain_sample()
2659 err = lbr_callchain_add_lbr_ip(thread, cursor, sample, parent, in resolve_lbr_callchain_sample()
2665 err = lbr_callchain_add_kernel_ip(thread, cursor, sample, in resolve_lbr_callchain_sample()
2677 static int find_prev_cpumode(struct ip_callchain *chain, struct thread *thread, in find_prev_cpumode() argument
2689 err = add_callchain_ip(thread, cursor, parent, in find_prev_cpumode()
2699 struct thread *thread, int usr_idx) in get_leaf_frame_caller() argument
2701 if (machine__normalized_is(maps__machine(thread__maps(thread)), "arm64")) in get_leaf_frame_caller()
2702 return get_leaf_frame_caller_aarch64(sample, thread, usr_idx); in get_leaf_frame_caller()
2707 static int thread__resolve_callchain_sample(struct thread *thread, in thread__resolve_callchain_sample() argument
2732 err = resolve_lbr_callchain_sample(thread, cursor, sample, parent, in thread__resolve_callchain_sample()
2744 skip_idx = arch_skip_callchain_idx(thread, chain); in thread__resolve_callchain_sample()
2796 err = add_callchain_ip(thread, cursor, parent, in thread__resolve_callchain_sample()
2803 err = add_callchain_ip(thread, cursor, parent, root_al, in thread__resolve_callchain_sample()
2822 err = find_prev_cpumode(chain, thread, cursor, parent, root_al, in thread__resolve_callchain_sample()
2844 err = find_prev_cpumode(chain, thread, cursor, parent, in thread__resolve_callchain_sample()
2862 leaf_frame_caller = get_leaf_frame_caller(sample, thread, usr_idx); in thread__resolve_callchain_sample()
2871 err = add_callchain_ip(thread, cursor, parent, in thread__resolve_callchain_sample()
2879 err = add_callchain_ip(thread, cursor, parent, in thread__resolve_callchain_sample()
2957 static int thread__resolve_callchain_unwind(struct thread *thread, in thread__resolve_callchain_unwind() argument
2977 thread, sample, max_stack, false); in thread__resolve_callchain_unwind()
2980 int __thread__resolve_callchain(struct thread *thread, in __thread__resolve_callchain() argument
2997 ret = thread__resolve_callchain_sample(thread, cursor, in __thread__resolve_callchain()
3003 ret = thread__resolve_callchain_unwind(thread, cursor, in __thread__resolve_callchain()
3007 ret = thread__resolve_callchain_unwind(thread, cursor, in __thread__resolve_callchain()
3012 ret = thread__resolve_callchain_sample(thread, cursor, in __thread__resolve_callchain()
3022 int (*fn)(struct thread *thread, void *p), in machine__for_each_thread() argument
3029 int (*fn)(struct thread *thread, void *p), in machines__for_each_thread() argument
3050 static int thread_list_cb(struct thread *thread, void *data) in thread_list_cb() argument
3058 entry->thread = thread__get(thread); in thread_list_cb()
3073 thread__zput(pos->thread); in thread_list__delete()
3090 struct thread *thread; in machine__set_current_tid() local
3104 thread = machine__findnew_thread(machine, pid, tid); in machine__set_current_tid()
3105 if (!thread) in machine__set_current_tid()
3108 thread__set_cpu(thread, cpu); in machine__set_current_tid()
3109 thread__put(thread); in machine__set_current_tid()