Accurate timing measurements with HPET
Posted: Sun Aug 29, 2010 8:44 am
Hi all,
I am using HPET for taking some timing measurements on an Intel Celeron processor. My question is this: Should I issue a CPUID instruction before reading the current value of the timer (just like you do when you readiong the TSC) in order to have accurate measurements or it doesn't matter? My processor has OoOE (Out-of-Order-Execution) so I guess that I should issue a CPUID in this case.
Since I read the current value of the timer from a memory mapped location (i.e. I am not issuing a serializing instruction), I guess it is possible that some of the instructions which follow it have already been issued before the timer is read, or existing instructions have not yet completed, thus resulting in an inaccurate measurement of the time interval.
What do you guys think?
Thanks in advance.
I am using HPET for taking some timing measurements on an Intel Celeron processor. My question is this: Should I issue a CPUID instruction before reading the current value of the timer (just like you do when you readiong the TSC) in order to have accurate measurements or it doesn't matter? My processor has OoOE (Out-of-Order-Execution) so I guess that I should issue a CPUID in this case.
Since I read the current value of the timer from a memory mapped location (i.e. I am not issuing a serializing instruction), I guess it is possible that some of the instructions which follow it have already been issued before the timer is read, or existing instructions have not yet completed, thus resulting in an inaccurate measurement of the time interval.
What do you guys think?
Thanks in advance.