Lines Matching refs:threads

25 	struct thread_map *threads;  in thread_map__new_by_pid()  local
36 threads = malloc(sizeof(*threads) + sizeof(pid_t) * items); in thread_map__new_by_pid()
37 if (threads != NULL) { in thread_map__new_by_pid()
39 threads->map[i] = atoi(namelist[i]->d_name); in thread_map__new_by_pid()
40 threads->nr = items; in thread_map__new_by_pid()
47 return threads; in thread_map__new_by_pid()
52 struct thread_map *threads = malloc(sizeof(*threads) + sizeof(pid_t)); in thread_map__new_by_tid() local
54 if (threads != NULL) { in thread_map__new_by_tid()
55 threads->map[0] = tid; in thread_map__new_by_tid()
56 threads->nr = 1; in thread_map__new_by_tid()
59 return threads; in thread_map__new_by_tid()
68 struct thread_map *threads = malloc(sizeof(*threads) + in thread_map__new_by_uid() local
70 if (threads == NULL) in thread_map__new_by_uid()
77 threads->nr = 0; in thread_map__new_by_uid()
101 while (threads->nr + items >= max_threads) { in thread_map__new_by_uid()
109 tmp = realloc(threads, (sizeof(*threads) + in thread_map__new_by_uid()
114 threads = tmp; in thread_map__new_by_uid()
118 threads->map[threads->nr + i] = atoi(namelist[i]->d_name); in thread_map__new_by_uid()
124 threads->nr += items; in thread_map__new_by_uid()
130 return threads; in thread_map__new_by_uid()
133 free(threads); in thread_map__new_by_uid()
142 zfree(&threads); in thread_map__new_by_uid()
159 struct thread_map *threads = NULL, *nt; in thread_map__new_by_pid_str() local
188 nt = realloc(threads, (sizeof(*threads) + in thread_map__new_by_pid_str()
193 threads = nt; in thread_map__new_by_pid_str()
196 threads->map[j++] = atoi(namelist[i]->d_name); in thread_map__new_by_pid_str()
199 threads->nr = total_tasks; in thread_map__new_by_pid_str()
205 return threads; in thread_map__new_by_pid_str()
213 zfree(&threads); in thread_map__new_by_pid_str()
219 struct thread_map *threads = malloc(sizeof(*threads) + sizeof(pid_t)); in thread_map__new_dummy() local
221 if (threads != NULL) { in thread_map__new_dummy()
222 threads->map[0] = -1; in thread_map__new_dummy()
223 threads->nr = 1; in thread_map__new_dummy()
225 return threads; in thread_map__new_dummy()
230 struct thread_map *threads = NULL, *nt; in thread_map__new_by_tid_str() local
256 nt = realloc(threads, sizeof(*threads) + sizeof(pid_t) * ntasks); in thread_map__new_by_tid_str()
261 threads = nt; in thread_map__new_by_tid_str()
262 threads->map[ntasks - 1] = tid; in thread_map__new_by_tid_str()
263 threads->nr = ntasks; in thread_map__new_by_tid_str()
266 return threads; in thread_map__new_by_tid_str()
269 zfree(&threads); in thread_map__new_by_tid_str()
285 void thread_map__delete(struct thread_map *threads) in thread_map__delete() argument
287 free(threads); in thread_map__delete()
290 size_t thread_map__fprintf(struct thread_map *threads, FILE *fp) in thread_map__fprintf() argument
294 threads->nr, threads->nr > 1 ? "s" : ""); in thread_map__fprintf()
295 for (i = 0; i < threads->nr; ++i) in thread_map__fprintf()
296 printed += fprintf(fp, "%s%d", i ? ", " : "", threads->map[i]); in thread_map__fprintf()