I am trying to measure the cycle count of an instruction in a VM -- my code looks like this:
start = rdtscp();
//complex_sequence_of_instructions
end = rtdscp();
//complex_sequence_of_instructions took end-time cycles
To the best of my knowledge, using rdtscp
in a VM does not provide an accurate cycle count, however. I launch my VM like this:
qemu-system-x86_64 -enable-kvm -cpu EPYC-v4 [...]
on a zen3 AMD CPU (without SEV enabled). Is there any way I can configure kvm to no trap the rdtscp
instruction and get an accurate timestamp measurement?