| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
|
| 3 |
#include "../../../util/pmu.h" |
| 4 |
#include "../../../util/pmus.h" |
| 5 |
#include "../../../util/tool_pmu.h" |
| 6 |
#include <api/fs/fs.h> |
| 7 |
|
| 8 |
u64 tool_pmu__cpu_slots_per_cycle(void) |
| 9 |
{ |
| 10 |
char path[PATH_MAX]; |
| 11 |
unsigned long long slots = 0; |
| 12 |
struct perf_pmu *pmu = perf_pmus__find_core_pmu(); |
| 13 |
|
| 14 |
if (pmu) { |
| 15 |
perf_pmu__pathname_scnprintf(path, sizeof(path), |
| 16 |
pmu->name, "caps/slots"); |
| 17 |
/* |
| 18 |
* The value of slots is not greater than 32 bits, but |
| 19 |
* filename__read_int can't read value with 0x prefix, |
| 20 |
* so use filename__read_ull instead. |
| 21 |
*/ |
| 22 |
filename__read_ull(path, &slots); |
| 23 |
} |
| 24 |
|
| 25 |
return slots; |
| 26 |
} |