Issue with rdcycle Always Returning the Same Value on Linux

18 views
Skip to first unread message

David Novo

unread,
Feb 19, 2025, 12:28:02 PMFeb 19
to FireSim
Hi,

When I try to use rdcycle as follows:
asm volatile ("rdcycle %0" : "=r" (cycles));

to profile benchmarks running on Linux, I always get the same number of cycles.

For example, profiling the following code:

uint64_t start, end;
start = read_cycles();

printf("Starting\n");

end = read_cycles();

printf("Cycles taken: %llu from %llu to %llu\n", end - start, start, end);
produces this output:

Cycles taken: 0 from 3046933860 to 3046933860

Could this be related to kernel restrictions or configuration parameters that disable access to performance counters in user space?

Thanks!

David Novo

unread,
Feb 19, 2025, 12:58:02 PMFeb 19
to FireSim
Reply all
Reply to author
Forward
0 new messages