Lines Matching refs:threads

36 	struct perf_thread_map *threads;  in thread_map__new_by_pid()  local
47 threads = thread_map__alloc(items); in thread_map__new_by_pid()
48 if (threads != NULL) { in thread_map__new_by_pid()
50 perf_thread_map__set_pid(threads, i, atoi(namelist[i]->d_name)); in thread_map__new_by_pid()
51 threads->nr = items; in thread_map__new_by_pid()
52 refcount_set(&threads->refcnt, 1); in thread_map__new_by_pid()
59 return threads; in thread_map__new_by_pid()
64 struct perf_thread_map *threads = thread_map__alloc(1); in thread_map__new_by_tid() local
66 if (threads != NULL) { in thread_map__new_by_tid()
67 perf_thread_map__set_pid(threads, 0, tid); in thread_map__new_by_tid()
68 threads->nr = 1; in thread_map__new_by_tid()
69 refcount_set(&threads->refcnt, 1); in thread_map__new_by_tid()
72 return threads; in thread_map__new_by_tid()
81 struct perf_thread_map *threads = thread_map__alloc(max_threads); in thread_map__new_all_cpus() local
83 if (threads == NULL) in thread_map__new_all_cpus()
90 threads->nr = 0; in thread_map__new_all_cpus()
91 refcount_set(&threads->refcnt, 1); in thread_map__new_all_cpus()
107 while (threads->nr + items >= max_threads) { in thread_map__new_all_cpus()
115 tmp = perf_thread_map__realloc(threads, max_threads); in thread_map__new_all_cpus()
119 threads = tmp; in thread_map__new_all_cpus()
123 perf_thread_map__set_pid(threads, threads->nr + i, in thread_map__new_all_cpus()
131 threads->nr += items; in thread_map__new_all_cpus()
137 return threads; in thread_map__new_all_cpus()
140 free(threads); in thread_map__new_all_cpus()
147 zfree(&threads); in thread_map__new_all_cpus()
161 struct perf_thread_map *threads = NULL, *nt; in thread_map__new_by_pid_str() local
191 nt = perf_thread_map__realloc(threads, total_tasks); in thread_map__new_by_pid_str()
195 threads = nt; in thread_map__new_by_pid_str()
198 perf_thread_map__set_pid(threads, j++, atoi(namelist[i]->d_name)); in thread_map__new_by_pid_str()
201 threads->nr = total_tasks; in thread_map__new_by_pid_str()
207 if (threads) in thread_map__new_by_pid_str()
208 refcount_set(&threads->refcnt, 1); in thread_map__new_by_pid_str()
209 return threads; in thread_map__new_by_pid_str()
217 zfree(&threads); in thread_map__new_by_pid_str()
223 struct perf_thread_map *threads = NULL, *nt; in thread_map__new_by_tid_str() local
250 nt = perf_thread_map__realloc(threads, ntasks); in thread_map__new_by_tid_str()
255 threads = nt; in thread_map__new_by_tid_str()
256 perf_thread_map__set_pid(threads, ntasks - 1, tid); in thread_map__new_by_tid_str()
257 threads->nr = ntasks; in thread_map__new_by_tid_str()
261 if (threads) in thread_map__new_by_tid_str()
262 refcount_set(&threads->refcnt, 1); in thread_map__new_by_tid_str()
263 return threads; in thread_map__new_by_tid_str()
266 zfree(&threads); in thread_map__new_by_tid_str()
281 size_t thread_map__fprintf(struct perf_thread_map *threads, FILE *fp) in thread_map__fprintf() argument
285 threads->nr, threads->nr > 1 ? "s" : ""); in thread_map__fprintf()
286 for (i = 0; i < threads->nr; ++i) in thread_map__fprintf()
287 printed += fprintf(fp, "%s%d", i ? ", " : "", perf_thread_map__pid(threads, i)); in thread_map__fprintf()
337 void thread_map__read_comms(struct perf_thread_map *threads) in thread_map__read_comms() argument
341 for (i = 0; i < threads->nr; ++i) in thread_map__read_comms()
342 comm_init(threads, i); in thread_map__read_comms()
345 static void thread_map__copy_event(struct perf_thread_map *threads, in thread_map__copy_event() argument
350 threads->nr = (int) event->nr; in thread_map__copy_event()
353 perf_thread_map__set_pid(threads, i, (pid_t) event->entries[i].pid); in thread_map__copy_event()
354 threads->map[i].comm = strndup(event->entries[i].comm, 16); in thread_map__copy_event()
357 refcount_set(&threads->refcnt, 1); in thread_map__copy_event()
362 struct perf_thread_map *threads; in thread_map__new_event() local
364 threads = thread_map__alloc(event->nr); in thread_map__new_event()
365 if (threads) in thread_map__new_event()
366 thread_map__copy_event(threads, event); in thread_map__new_event()
368 return threads; in thread_map__new_event()
371 bool thread_map__has(struct perf_thread_map *threads, pid_t pid) in thread_map__has() argument
375 for (i = 0; i < threads->nr; ++i) { in thread_map__has()
376 if (threads->map[i].pid == pid) in thread_map__has()
383 int thread_map__remove(struct perf_thread_map *threads, int idx) in thread_map__remove() argument
387 if (threads->nr < 1) in thread_map__remove()
390 if (idx >= threads->nr) in thread_map__remove()
396 zfree(&threads->map[idx].comm); in thread_map__remove()
398 for (i = idx; i < threads->nr - 1; i++) in thread_map__remove()
399 threads->map[i] = threads->map[i + 1]; in thread_map__remove()
401 threads->nr--; in thread_map__remove()