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()
115 while (threads->nr + items >= max_threads) { in __thread_map__new_all_cpus()
123 tmp = perf_thread_map__realloc(threads, max_threads); in __thread_map__new_all_cpus()
127 threads = tmp; in __thread_map__new_all_cpus()
131 perf_thread_map__set_pid(threads, threads->nr + i, in __thread_map__new_all_cpus()
139 threads->nr += items; in __thread_map__new_all_cpus()
145 return threads; in __thread_map__new_all_cpus()
148 free(threads); in __thread_map__new_all_cpus()
157 zfree(&threads); in __thread_map__new_all_cpus()
184 struct perf_thread_map *threads = NULL, *nt; in thread_map__new_by_pid_str() local
214 nt = perf_thread_map__realloc(threads, total_tasks); in thread_map__new_by_pid_str()
218 threads = nt; in thread_map__new_by_pid_str()
221 perf_thread_map__set_pid(threads, j++, atoi(namelist[i]->d_name)); in thread_map__new_by_pid_str()
224 threads->nr = total_tasks; in thread_map__new_by_pid_str()
230 if (threads) in thread_map__new_by_pid_str()
231 refcount_set(&threads->refcnt, 1); in thread_map__new_by_pid_str()
232 return threads; in thread_map__new_by_pid_str()
240 zfree(&threads); in thread_map__new_by_pid_str()
246 struct perf_thread_map *threads = NULL, *nt; in thread_map__new_by_tid_str() local
273 nt = perf_thread_map__realloc(threads, ntasks); in thread_map__new_by_tid_str()
278 threads = nt; in thread_map__new_by_tid_str()
279 perf_thread_map__set_pid(threads, ntasks - 1, tid); in thread_map__new_by_tid_str()
280 threads->nr = ntasks; in thread_map__new_by_tid_str()
283 if (threads) in thread_map__new_by_tid_str()
284 refcount_set(&threads->refcnt, 1); in thread_map__new_by_tid_str()
285 return threads; in thread_map__new_by_tid_str()
288 zfree(&threads); in thread_map__new_by_tid_str()
308 size_t thread_map__fprintf(struct perf_thread_map *threads, FILE *fp) in thread_map__fprintf() argument
312 threads->nr, threads->nr > 1 ? "s" : ""); in thread_map__fprintf()
313 for (i = 0; i < threads->nr; ++i) in thread_map__fprintf()
314 printed += fprintf(fp, "%s%d", i ? ", " : "", perf_thread_map__pid(threads, i)); in thread_map__fprintf()
364 void thread_map__read_comms(struct perf_thread_map *threads) in thread_map__read_comms() argument
368 for (i = 0; i < threads->nr; ++i) in thread_map__read_comms()
369 comm_init(threads, i); in thread_map__read_comms()
372 static void thread_map__copy_event(struct perf_thread_map *threads, in thread_map__copy_event() argument
377 threads->nr = (int) event->nr; in thread_map__copy_event()
380 perf_thread_map__set_pid(threads, i, (pid_t) event->entries[i].pid); in thread_map__copy_event()
381 threads->map[i].comm = strndup(event->entries[i].comm, 16); in thread_map__copy_event()
384 refcount_set(&threads->refcnt, 1); in thread_map__copy_event()
389 struct perf_thread_map *threads; in thread_map__new_event() local
391 threads = thread_map__alloc(event->nr); in thread_map__new_event()
392 if (threads) in thread_map__new_event()
393 thread_map__copy_event(threads, event); in thread_map__new_event()
395 return threads; in thread_map__new_event()
398 bool thread_map__has(struct perf_thread_map *threads, pid_t pid) in thread_map__has() argument
402 for (i = 0; i < threads->nr; ++i) { in thread_map__has()
403 if (threads->map[i].pid == pid) in thread_map__has()
410 int thread_map__remove(struct perf_thread_map *threads, int idx) in thread_map__remove() argument
414 if (threads->nr < 1) in thread_map__remove()
417 if (idx >= threads->nr) in thread_map__remove()
423 zfree(&threads->map[idx].comm); in thread_map__remove()
425 for (i = idx; i < threads->nr - 1; i++) in thread_map__remove()
426 threads->map[i] = threads->map[i + 1]; in thread_map__remove()
428 threads->nr--; in thread_map__remove()