Skip to content

Instantly share code, notes, and snippets.

@poseidon4o
Last active October 30, 2015 15:09
Show Gist options
  • Save poseidon4o/60995826b511ae7ecca7 to your computer and use it in GitHub Desktop.
Save poseidon4o/60995826b511ae7ecca7 to your computer and use it in GitHub Desktop.
#include <Windows.h>
void main() {
double PCFreq = 0.0;
__int64 CounterStart = 0;
LARGE_INTEGER fr, start, end;
BOOL res = QueryPerformanceFrequency(&fr);
PCFreq = double(fr.QuadPart) / 1000.0;
QueryPerformanceCounter(&start);
{
int x = 0;
for (int c = 0; c < 1000000; c++) {
x ^= c;
}
}
QueryPerformanceCounter(&end);
double time = double(end.QuadPart - start.QuadPart) / PCFreq;
cout << time;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment