I know this question has been asked few times over SO but none of them is really helping me out, so asking again.
I am using windows xp and running visual studio c++
You need a high precision timer. In case of Visual Studio use QueryPerformanceCounter.
If the precision is still not enough, use compiler intristics:
#include
#pragma intrinsic(__rdtsc)
unsigned __int64 ticks = __rdtsc();
See info on that intristic here.
Both solutions are Windows only, the latter is probably MSVC only. I can post a similar solution for GCC/Linux if needed.