| #include <linux/bitops.h> |
| static int cached_result; |
| if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) >= 0) |
| ncpu = sysconf(_SC_NPROCESSORS_CONF); |
| for (cpu = 0; cpu < ncpu; cpu++) { |
| unsigned long long siblings; |
| "devices/system/cpu/cpu%d/topology/core_cpus", cpu); |
| if (sysfs__read_str(fn, &str, &strlen) < 0) { |
| "devices/system/cpu/cpu%d/topology/thread_siblings", |
| if (sysfs__read_str(fn, &str, &strlen) < 0) |
| /* Entry is hex, but does not have 0x, so need custom parser */ |
| siblings = strtoull(str, NULL, 16); |
| if (hweight64(siblings) > 1) { |