|
// Improved2005crt.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <time.h>
int _tmain()
{
// be sure the F/TLS is initialized
srand((unsigned)time(NULL));
LARGE_INTEGER liStart;
QueryPerformanceCounter(&liStart);
double d = 0;
for (int i=0; i<50000000; i++)
d += rand();
LARGE_INTEGER liStop;
QueryPerformanceCounter(&liStop);
LARGE_INTEGER liDiff;
liDiff.QuadPart = liStop.QuadPart - liStart.QuadPart;
LARGE_INTEGER liFreq;
QueryPerformanceFrequency(&liFreq);
double ms = (liDiff.QuadPart* 1000) / liFreq.QuadPart;
_tprintf(_T("Diff %f ms\n"), ms);
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.