Lines Matching refs:cpu_top
154 * Returns amount of cpus, negative on error, cpu_top must be
159 int get_cpu_topology(struct cpupower_topology *cpu_top)
163 cpu_top->core_info = malloc(sizeof(struct cpuid_core_info) * cpus);
164 if (cpu_top->core_info == NULL)
166 cpu_top->pkgs = cpu_top->cores = 0;
168 cpu_top->core_info[cpu].cpu = cpu;
169 cpu_top->core_info[cpu].is_online = cpupower_is_cpu_online(cpu);
173 &(cpu_top->core_info[cpu].pkg)) < 0) {
174 cpu_top->core_info[cpu].pkg = -1;
175 cpu_top->core_info[cpu].core = -1;
181 &(cpu_top->core_info[cpu].core)) < 0) {
182 cpu_top->core_info[cpu].pkg = -1;
183 cpu_top->core_info[cpu].core = -1;
188 qsort(cpu_top->core_info, cpus, sizeof(struct cpuid_core_info),
194 last_pkg = cpu_top->core_info[0].pkg;
196 if (cpu_top->core_info[cpu].pkg != last_pkg &&
197 cpu_top->core_info[cpu].pkg != -1) {
199 last_pkg = cpu_top->core_info[cpu].pkg;
200 cpu_top->pkgs++;
203 if (!(cpu_top->core_info[0].pkg == -1))
204 cpu_top->pkgs++;
209 for (cpu = 0; cpu_top->core_info[cpu].pkg = 0 && cpu < cpus; cpu++) {
210 if (cpu_top->core_info[cpu].core == 0)
211 cpu_top->cores++;
216 void cpu_topology_release(struct cpupower_topology cpu_top)
218 free(cpu_top.core_info);