4 #include <linux/bitops.h>
11 static int cached_result
;
18 ncpu
= sysconf(_SC_NPROCESSORS_CONF
);
19 for (cpu
= 0; cpu
< ncpu
; cpu
++) {
20 unsigned long long siblings
;
25 snprintf(fn
, sizeof fn
,
26 "devices/system/cpu/cpu%d/topology/core_cpus", cpu
);
27 if (access(fn
, F_OK
) == -1) {
28 snprintf(fn
, sizeof fn
,
29 "devices/system/cpu/cpu%d/topology/thread_siblings",
32 if (sysfs__read_str(fn
, &str
, &strlen
) < 0)
34 /* Entry is hex, but does not have 0x, so need custom parser */
35 siblings
= strtoull(str
, NULL
, 16);
37 if (hweight64(siblings
) > 1) {