Lines Matching refs:nr_cpus
51 int nr_cpus; in cpu_map__default_new() local
53 nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); in cpu_map__default_new()
54 if (nr_cpus < 0) in cpu_map__default_new()
57 cpus = malloc(sizeof(*cpus) + nr_cpus * sizeof(int)); in cpu_map__default_new()
61 for (i = 0; i < nr_cpus; ++i) in cpu_map__default_new()
64 cpus->nr = nr_cpus; in cpu_map__default_new()
76 static struct perf_cpu_map *cpu_map__trim_new(int nr_cpus, int *tmp_cpus) in cpu_map__trim_new() argument
78 size_t payload_size = nr_cpus * sizeof(int); in cpu_map__trim_new()
84 qsort(cpus->map, nr_cpus, sizeof(int), cmp_int); in cpu_map__trim_new()
87 for (i = 0; i < nr_cpus; i++) { in cpu_map__trim_new()
92 assert(j <= nr_cpus); in cpu_map__trim_new()
102 int nr_cpus = 0; in perf_cpu_map__read() local
115 int new_max = nr_cpus + cpu - prev - 1; in perf_cpu_map__read()
129 tmp_cpus[nr_cpus++] = prev; in perf_cpu_map__read()
131 if (nr_cpus == max_entries) { in perf_cpu_map__read()
139 tmp_cpus[nr_cpus++] = cpu; in perf_cpu_map__read()
148 if (nr_cpus > 0) in perf_cpu_map__read()
149 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); in perf_cpu_map__read()
176 int i, nr_cpus = 0; in perf_cpu_map__new() local
217 for (i = 0; i < nr_cpus; i++) in perf_cpu_map__new()
221 if (nr_cpus == max_entries) { in perf_cpu_map__new()
228 tmp_cpus[nr_cpus++] = (int)start_cpu; in perf_cpu_map__new()
236 if (nr_cpus > 0) in perf_cpu_map__new()
237 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); in perf_cpu_map__new()