summaryrefslogtreecommitdiff
path: root/test/test_perfmon_cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_perfmon_cpu.c')
-rw-r--r--test/test_perfmon_cpu.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/test_perfmon_cpu.c b/test/test_perfmon_cpu.c
index 60db729..8ecb241 100644
--- a/test/test_perfmon_cpu.c
+++ b/test/test_perfmon_cpu.c
@@ -55,9 +55,11 @@ test_run(void *arg)
struct perfmon_event *ev_cycle, *ev_instruction;
struct perfmon_group *group;
int error;
+ uint64_t pmc_max;
(void)arg;
+ pmc_max = (1 << perfmon_get_pmc_width()) - 1;
error = perfmon_group_create(&group);
error_check(error, "perfmon_group_create");
@@ -85,10 +87,9 @@ test_run(void *arg)
printf("checking with overflow ...\n");
/* TODO: choose value depending of architecture */
- perfmon_event_write(ev_cycle,
- UINT64_MAX - perfmon_event_read(ev_cycle) / 2);
+ perfmon_event_write(ev_cycle, pmc_max - perfmon_event_read(ev_cycle) / 2);
perfmon_event_write(ev_instruction,
- UINT64_MAX - perfmon_event_read(ev_instruction) / 3);
+ pmc_max - perfmon_event_read(ev_instruction) / 3);
perfmon_event_reset(ev_cycle);
perfmon_event_reset(ev_instruction);