Lines Matching refs:threads

35 	struct perf_thread_map *threads;  in thread_map__new_by_pid()  local
46 threads = thread_map__alloc(items); in thread_map__new_by_pid()
47 if (threads != NULL) { in thread_map__new_by_pid()
49 perf_thread_map__set_pid(threads, i, atoi(namelist[i]->d_name)); in thread_map__new_by_pid()
50 threads->nr = items; in thread_map__new_by_pid()
51 refcount_set(&threads->refcnt, 1); in thread_map__new_by_pid()
58 return threads; in thread_map__new_by_pid()
63 struct perf_thread_map *threads = thread_map__alloc(1); in thread_map__new_by_tid() local
65 if (threads != NULL) { in thread_map__new_by_tid()
66 perf_thread_map__set_pid(threads, 0, tid); in thread_map__new_by_tid()
67 threads->nr = 1; in thread_map__new_by_tid()
68 refcount_set(&threads->refcnt, 1); in thread_map__new_by_tid()
71 return threads; in thread_map__new_by_tid()
80 struct perf_thread_map *threads = thread_map__alloc(max_threads); in __thread_map__new_all_cpus() local
82 if (threads == NULL) in __thread_map__new_all_cpus()
89 threads->nr = 0; in __thread_map__new_all_cpus()
90 refcount_set(&threads->refcnt, 1); in __thread_map__new_all_cpus()
114 while (threads->nr + items >= max_threads) { in __thread_map__new_all_cpus()
122 tmp = perf_thread_map__realloc(threads, max_threads); in __thread_map__new_all_cpus()
126 threads = tmp; in __thread_map__new_all_cpus()
130 perf_thread_map__set_pid(threads, threads->nr + i, in __thread_map__new_all_cpus()
138 threads->nr += items; in __thread_map__new_all_cpus()
144 return threads; in __thread_map__new_all_cpus()
147 free(threads); in __thread_map__new_all_cpus()
156 zfree(&threads); in __thread_map__new_all_cpus()
183 struct perf_thread_map *threads = NULL, *nt; in thread_map__new_by_pid_str() local
213 nt = perf_thread_map__realloc(threads, total_tasks); in thread_map__new_by_pid_str()
217 threads = nt; in thread_map__new_by_pid_str()
220 perf_thread_map__set_pid(threads, j++, atoi(namelist[i]->d_name)); in thread_map__new_by_pid_str()
223 threads->nr = total_tasks; in thread_map__new_by_pid_str()
229 if (threads) in thread_map__new_by_pid_str()
230 refcount_set(&threads->refcnt, 1); in thread_map__new_by_pid_str()
231 return threads; in thread_map__new_by_pid_str()
239 zfree(&threads); in thread_map__new_by_pid_str()
245 struct perf_thread_map *threads = NULL, *nt; in thread_map__new_by_tid_str() local
272 nt = perf_thread_map__realloc(threads, ntasks); in thread_map__new_by_tid_str()
277 threads = nt; in thread_map__new_by_tid_str()
278 perf_thread_map__set_pid(threads, ntasks - 1, tid); in thread_map__new_by_tid_str()
279 threads->nr = ntasks; in thread_map__new_by_tid_str()
282 if (threads) in thread_map__new_by_tid_str()
283 refcount_set(&threads->refcnt, 1); in thread_map__new_by_tid_str()
284 return threads; in thread_map__new_by_tid_str()
287 zfree(&threads); in thread_map__new_by_tid_str()
307 size_t thread_map__fprintf(struct perf_thread_map *threads, FILE *fp) in thread_map__fprintf() argument
311 threads->nr, threads->nr > 1 ? "s" : ""); in thread_map__fprintf()
312 for (i = 0; i < threads->nr; ++i) in thread_map__fprintf()
313 printed += fprintf(fp, "%s%d", i ? ", " : "", perf_thread_map__pid(threads, i)); in thread_map__fprintf()
363 void thread_map__read_comms(struct perf_thread_map *threads) in thread_map__read_comms() argument
367 for (i = 0; i < threads->nr; ++i) in thread_map__read_comms()
368 comm_init(threads, i); in thread_map__read_comms()
371 static void thread_map__copy_event(struct perf_thread_map *threads, in thread_map__copy_event() argument
376 threads->nr = (int) event->nr; in thread_map__copy_event()
379 perf_thread_map__set_pid(threads, i, (pid_t) event->entries[i].pid); in thread_map__copy_event()
380 threads->map[i].comm = strndup(event->entries[i].comm, 16); in thread_map__copy_event()
383 refcount_set(&threads->refcnt, 1); in thread_map__copy_event()
388 struct perf_thread_map *threads; in thread_map__new_event() local
390 threads = thread_map__alloc(event->nr); in thread_map__new_event()
391 if (threads) in thread_map__new_event()
392 thread_map__copy_event(threads, event); in thread_map__new_event()
394 return threads; in thread_map__new_event()
397 bool thread_map__has(struct perf_thread_map *threads, pid_t pid) in thread_map__has() argument
401 for (i = 0; i < threads->nr; ++i) { in thread_map__has()
402 if (threads->map[i].pid == pid) in thread_map__has()
409 int thread_map__remove(struct perf_thread_map *threads, int idx) in thread_map__remove() argument
413 if (threads->nr < 1) in thread_map__remove()
416 if (idx >= threads->nr) in thread_map__remove()
422 zfree(&threads->map[idx].comm); in thread_map__remove()
424 for (i = idx; i < threads->nr - 1; i++) in thread_map__remove()
425 threads->map[i] = threads->map[i + 1]; in thread_map__remove()
427 threads->nr--; in thread_map__remove()