@@ -4498,6 +4498,24 @@ hwloc_linux_cpukinds_compar(const void *_a, const void *_b)
4498
4498
return a -> value - b -> value ;
4499
4499
}
4500
4500
4501
+ static void
4502
+ hwloc_linux_cpukinds_register_one (struct hwloc_topology * topology ,
4503
+ hwloc_bitmap_t cpuset ,
4504
+ int efficiency ,
4505
+ char * infoname ,
4506
+ char * infovalue )
4507
+ {
4508
+ struct hwloc_info_s infoattr ;
4509
+ struct hwloc_infos_s infos ;
4510
+ infoattr .name = infoname ;
4511
+ infoattr .value = infovalue ;
4512
+ infos .array = & infoattr ;
4513
+ infos .count = 1 ;
4514
+ infos .allocated = 0 ;
4515
+ hwloc_internal_cpukinds_register (topology , cpuset , efficiency , & infos , 0 );
4516
+ /* the cpuset is given to the callee */
4517
+ }
4518
+
4501
4519
static void
4502
4520
hwloc_linux_cpukinds_register (struct hwloc_linux_cpukinds * cpukinds ,
4503
4521
struct hwloc_topology * topology ,
@@ -4510,19 +4528,12 @@ hwloc_linux_cpukinds_register(struct hwloc_linux_cpukinds *cpukinds,
4510
4528
qsort (cpukinds -> sets , cpukinds -> nr_sets , sizeof (* cpukinds -> sets ), hwloc_linux_cpukinds_compar );
4511
4529
4512
4530
for (i = 0 ; i < cpukinds -> nr_sets ; i ++ ) {
4513
- struct hwloc_info_s infoattr ;
4514
- struct hwloc_infos_s infos ;
4515
4531
char value [32 ];
4516
- infoattr .name = (char * ) name ;
4517
- infoattr .value = value ;
4518
- infos .array = & infoattr ;
4519
- infos .count = 1 ;
4520
- infos .allocated = 0 ;
4521
4532
snprintf (value , sizeof (value ), "%lu" , cpukinds -> sets [i ].value );
4522
4533
/* value (at least cpu_capacity) may be > INT_MAX, too large for a forced_efficiency, hence use i instead */
4523
- hwloc_internal_cpukinds_register (topology , cpukinds -> sets [i ].cpuset ,
4524
- forced_efficiency ? (int ) i : HWLOC_CPUKIND_EFFICIENCY_UNKNOWN ,
4525
- & infos , 0 );
4534
+ hwloc_linux_cpukinds_register_one (topology , cpukinds -> sets [i ].cpuset ,
4535
+ forced_efficiency ? (int ) i : HWLOC_CPUKIND_EFFICIENCY_UNKNOWN ,
4536
+ ( char * ) name , value );
4526
4537
/* the cpuset is given to the callee */
4527
4538
cpukinds -> sets [i ].cpuset = NULL ;
4528
4539
}
@@ -4694,27 +4705,17 @@ look_sysfscpukinds(struct hwloc_topology *topology,
4694
4705
atom_pmu_set = hwloc__alloc_read_path_as_cpulist ("/sys/devices/cpu_atom/cpus" , data -> root_fd );
4695
4706
core_pmu_set = hwloc__alloc_read_path_as_cpulist ("/sys/devices/cpu_core/cpus" , data -> root_fd );
4696
4707
if (atom_pmu_set ) {
4697
- struct hwloc_infos_s infos ;
4698
- struct hwloc_info_s infoattr ;
4699
- infoattr .name = (char * ) "CoreType" ;
4700
- infoattr .value = (char * ) "IntelAtom" ;
4701
- infos .array = & infoattr ;
4702
- infos .count = 1 ;
4703
- infos .allocated = 0 ;
4704
- hwloc_internal_cpukinds_register (topology , atom_pmu_set , HWLOC_CPUKIND_EFFICIENCY_UNKNOWN , & infos , 0 );
4708
+ hwloc_linux_cpukinds_register_one (topology , atom_pmu_set ,
4709
+ HWLOC_CPUKIND_EFFICIENCY_UNKNOWN ,
4710
+ (char * ) "CoreType" , (char * ) "IntelAtom" );
4705
4711
/* the cpuset is given to the callee */
4706
4712
} else {
4707
4713
hwloc_bitmap_free (atom_pmu_set );
4708
4714
}
4709
4715
if (core_pmu_set ) {
4710
- struct hwloc_infos_s infos ;
4711
- struct hwloc_info_s infoattr ;
4712
- infoattr .name = (char * ) "CoreType" ;
4713
- infoattr .value = (char * ) "IntelCore" ;
4714
- infos .array = & infoattr ;
4715
- infos .count = 1 ;
4716
- infos .allocated = 0 ;
4717
- hwloc_internal_cpukinds_register (topology , core_pmu_set , HWLOC_CPUKIND_EFFICIENCY_UNKNOWN , & infos , 0 );
4716
+ hwloc_linux_cpukinds_register_one (topology , core_pmu_set ,
4717
+ HWLOC_CPUKIND_EFFICIENCY_UNKNOWN ,
4718
+ (char * ) "CoreType" , (char * ) "IntelCore" );
4718
4719
/* the cpuset is given to the callee */
4719
4720
} else {
4720
4721
hwloc_bitmap_free (core_pmu_set );
0 commit comments