How to calculate processing time in millscounds

I want to calculate processing time in milliseconds as most of function I found give me in second. I am new user to C++.


Regards
You can do something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
__int64 iCountsPerSec;
__int64 iTime_StartProcessing;
__int64 iTime_EndProcessing;
double dMSecPerCount;
double dMSeconds_ProcessingTime;
	
QueryPerformanceFrequency((LARGE_INTEGER*)&iCountsPerSec);
dMSecPerCount = 1000.0/(double)iCountsPerSec;

QueryPerformanceCounter((LARGE_INTEGER*)&iTime_StartProcessing);


//...   (perform processing)


QueryPerformanceCounter((LARGE_INTEGER*)&iTime_EndProcessing);

dMSeconds_ProcessingTime = (iTime_EndProcessing - iTime_StartProcessing)*dMSecPerCount;


See:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644905%28v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644904%28v=vs.85%29.aspx
Last edited on
Topic archived. No new replies allowed.