|
1 | 1 | // SPDX-License-Identifier: BSD-3-Clause
|
2 |
| -// Copyright (c) 2009-2022, Intel Corporation |
| 2 | +// Copyright (c) 2009-2024, Intel Corporation |
3 | 3 | // written by Roman Dementiev
|
4 | 4 | //
|
5 | 5 |
|
@@ -39,43 +39,41 @@ typedef signed int int32;
|
39 | 39 | #define PCM_ULIMIT_RECOMMENDATION ("try executing 'ulimit -n 1000000' to increase the limit on the number of open files.\n")
|
40 | 40 |
|
41 | 41 | /*
|
42 |
| - MSR addresses from |
43 |
| - "Intel 64 and IA-32 Architectures Software Developers Manual Volume 3B: |
44 |
| - System Programming Guide, Part 2", Appendix A "PERFORMANCE-MONITORING EVENTS" |
| 42 | + MSR addresses from |
| 43 | + "Intel 64 and IA-32 Architectures Software Developers Manual Volume 3B: |
| 44 | + System Programming Guide, Part 2", Appendix A "PERFORMANCE-MONITORING EVENTS" |
45 | 45 | */
|
46 | 46 |
|
47 |
| -#define INST_RETIRED_ADDR (0x309) |
48 |
| -#define CPU_CLK_UNHALTED_THREAD_ADDR (0x30A) |
49 |
| -#define CPU_CLK_UNHALTED_REF_ADDR (0x30B) |
50 |
| -#define TOPDOWN_SLOTS_ADDR (0x30C) |
51 |
| -#define PERF_METRICS_ADDR (0x329) |
52 |
| -#define IA32_CR_PERF_GLOBAL_CTRL (0x38F) |
53 |
| -#define IA32_CR_FIXED_CTR_CTRL (0x38D) |
54 |
| -#define IA32_PERFEVTSEL0_ADDR (0x186) |
55 |
| -#define IA32_PERFEVTSEL1_ADDR (IA32_PERFEVTSEL0_ADDR + 1) |
56 |
| -#define IA32_PERFEVTSEL2_ADDR (IA32_PERFEVTSEL0_ADDR + 2) |
57 |
| -#define IA32_PERFEVTSEL3_ADDR (IA32_PERFEVTSEL0_ADDR + 3) |
58 |
| - |
| 47 | +constexpr auto INST_RETIRED_ADDR = 0x309; |
| 48 | +constexpr auto CPU_CLK_UNHALTED_THREAD_ADDR = 0x30A; |
| 49 | +constexpr auto CPU_CLK_UNHALTED_REF_ADDR = 0x30B; |
| 50 | +constexpr auto TOPDOWN_SLOTS_ADDR = 0x30C; |
| 51 | +constexpr auto PERF_METRICS_ADDR = 0x329; |
| 52 | +constexpr auto IA32_CR_PERF_GLOBAL_CTRL = 0x38F; |
| 53 | +constexpr auto IA32_CR_FIXED_CTR_CTRL = 0x38D; |
| 54 | +constexpr auto IA32_PERFEVTSEL0_ADDR = 0x186; |
| 55 | +constexpr auto IA32_PERFEVTSEL1_ADDR = IA32_PERFEVTSEL0_ADDR + 1; |
| 56 | +constexpr auto IA32_PERFEVTSEL2_ADDR = IA32_PERFEVTSEL0_ADDR + 2; |
| 57 | +constexpr auto IA32_PERFEVTSEL3_ADDR = IA32_PERFEVTSEL0_ADDR + 3; |
59 | 58 | constexpr auto IA32_PERF_GLOBAL_STATUS = 0x38E;
|
60 | 59 | constexpr auto IA32_PERF_GLOBAL_OVF_CTRL = 0x390;
|
61 | 60 | constexpr auto IA32_PEBS_ENABLE_ADDR = 0x3F1;
|
62 | 61 |
|
63 |
| -#define PERF_MAX_FIXED_COUNTERS (3) |
64 |
| -#define PERF_MAX_CUSTOM_COUNTERS (8) |
65 |
| -#define PERF_TOPDOWN_COUNTERS_L1 (5) |
66 |
| -#define PERF_TOPDOWN_COUNTERS (PERF_TOPDOWN_COUNTERS_L1 + 4) |
67 |
| -#define PERF_MAX_COUNTERS (PERF_MAX_FIXED_COUNTERS + PERF_MAX_CUSTOM_COUNTERS + PERF_TOPDOWN_COUNTERS) |
68 |
| - |
69 |
| -#define IA32_DEBUGCTL (0x1D9) |
| 62 | +constexpr auto PERF_MAX_FIXED_COUNTERS = 3; |
| 63 | +constexpr auto PERF_MAX_CUSTOM_COUNTERS = 8; |
| 64 | +constexpr auto PERF_TOPDOWN_COUNTERS_L1 = 5; |
| 65 | +constexpr auto PERF_TOPDOWN_COUNTERS = PERF_TOPDOWN_COUNTERS_L1 + 4; |
| 66 | +constexpr auto PERF_MAX_COUNTERS = PERF_MAX_FIXED_COUNTERS + PERF_MAX_CUSTOM_COUNTERS + PERF_TOPDOWN_COUNTERS; |
70 | 67 |
|
71 |
| -#define IA32_PMC0 (0xC1) |
72 |
| -#define IA32_PMC1 (0xC1 + 1) |
73 |
| -#define IA32_PMC2 (0xC1 + 2) |
74 |
| -#define IA32_PMC3 (0xC1 + 3) |
| 68 | +constexpr auto IA32_DEBUGCTL = 0x1D9; |
75 | 69 |
|
76 |
| -#define MSR_OFFCORE_RSP0 (0x1A6) |
77 |
| -#define MSR_OFFCORE_RSP1 (0x1A7) |
| 70 | +constexpr auto IA32_PMC0 = 0xC1; |
| 71 | +constexpr auto IA32_PMC1 = IA32_PMC0 + 1; |
| 72 | +constexpr auto IA32_PMC2 = IA32_PMC0 + 2; |
| 73 | +constexpr auto IA32_PMC3 = IA32_PMC0 + 3; |
78 | 74 |
|
| 75 | +constexpr auto MSR_OFFCORE_RSP0 = 0x1A6; |
| 76 | +constexpr auto MSR_OFFCORE_RSP1 = 0x1A7; |
79 | 77 | constexpr auto MSR_LOAD_LATENCY = 0x3F6;
|
80 | 78 | constexpr auto MSR_FRONTEND = 0x3F7;
|
81 | 79 |
|
|
0 commit comments