linux - Experienced strange rdtsc behavior comparing physical hardware and kvm-based VMs -


i have following problem. run several stress tests on linux machine

$ uname -a linux debian 3.14-2-686-pae #1 smp debian 3.14.15-2 (2014-08-09) i686 gnu/linux 

it's intel i5 intel(r) core(tm) i5-2400 cpu @ 3.10ghz, 8 g ram, 300 g hdd.

these tests not i/o intensive, compute double arithmetic in following way:

start = rdtsc(); do_arithmetic(); stop = rdtsc(); diff = stop - start; 

i repeat these tests many times, running benchmarking application on physical machine or on kvm based vm:

qemu-system-i386 disk.img -m 2000 -device virtio-net-pci,netdev=net1,mac=52:54:00:12:34:03 -netdev type=tap,id=net1,ifname=tap0,script=no,downscript=no -cpu host,+vmx -enable-kvm -nographichere 

i collect data statistics (i.e., diffs) many trials. physical machine (not loaded), data distribution of processing delay narrow lognormal.

when repeat experiment on virtual machine (physical , virtual machines not loaded), lognormal distribution still there (of little bit wider shape), however, collect few points completion times shorter (about 2 times) absolute minimum gathered physical machine!! (notice completion time distribution on physical machine narrow lying close min value). there points completion times longer average completion time on hardware machine.

i guess rdtsc benchmarking method not accurate vm environment. can please suggest method improve benchmarking system provide reliable (comparable) statistics between physical , kvm-based virtual environment? @ least something, won't show me vm 2x faster hardware pc in small number of cases.

thanks in advance suggestions or comments on subject.

best regards

maybe can try clock_gettime(clock_thread_cputime_id,&ts),see man clock_gettime more information


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -