diff options
Diffstat (limited to 'arch/x86/machine/pmu_intel.c')
-rw-r--r-- | arch/x86/machine/pmu_intel.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/x86/machine/pmu_intel.c b/arch/x86/machine/pmu_intel.c index 20d7aa2..c47be6c 100644 --- a/arch/x86/machine/pmu_intel.c +++ b/arch/x86/machine/pmu_intel.c @@ -113,6 +113,23 @@ pmu_intel_get(void) return &pmu_intel; } +static unsigned int +pmu_popcount(unsigned int bits) +{ + unsigned int count = 0; + + /* XXX: Dummy version of popcount. We should implement a faster one if it + * gets needed somewhere else. + */ + while (bits) { + if (bits & 1) { + count++; + } + bits >>= 1; + } + return count; +} + static void pmu_intel_info(void) { @@ -120,7 +137,7 @@ pmu_intel_info(void) unsigned int nr_events; pmu = pmu_intel_get(); - nr_events = __builtin_popcount(pmu->events); + nr_events = pmu_popcount(pmu->events); log_info("pmu: driver: intel, architectural v1\n" "pmu: nr_pmcs: %u, pmc_width: %u, events: %#x, nr_events: %u\n", pmu->nr_pmcs, pmu->pmc_width, pmu->events, nr_events); |