4 #include <linux/bitops.h>
11 static int cached_result
;
18 if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result
) > 0)
21 ncpu
= sysconf(_SC_NPROCESSORS_CONF
);
22 for (cpu
= 0; cpu
< ncpu
; cpu
++) {
23 unsigned long long siblings
;
28 snprintf(fn
, sizeof fn
,
29 "devices/system/cpu/cpu%d/topology/core_cpus", cpu
);
30 if (sysfs__read_str(fn
, &str
, &strlen
) < 0) {
31 snprintf(fn
, sizeof fn
,
32 "devices/system/cpu/cpu%d/topology/thread_siblings",
34 if (sysfs__read_str(fn
, &str
, &strlen
) < 0)
37 /* Entry is hex, but does not have 0x, so need custom parser */
38 siblings
= strtoull(str
, NULL
, 16);
40 if (hweight64(siblings
) > 1) {