C/C++時間測定

848 ワード

<time.h>
LARGE_INTEGER frequency,start,stop;
	QueryPerformanceFrequency(&frequency);
	srand(time(NULL));
	QueryPerformanceCounter(&start);
QueryPerformanceCounter(&stop);
	double time;
	time = (stop.QuadPart-start.QuadPart)*1000/frequency.QuadPart;
	printf("Time:%fms
",time);

別の方法:
timeGetTime
 http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece763105392230e54f73260878e482a958448e435061e5a27b8ef707e4953929e613441fe1307aea72b72350023aa99cc9548dea6922a2b8f2331710b8636489546f1df037881769f19aef859acf8a77284afa28782140c990f542d97f1fb0b5d539629a754&p=c436da0a83904ead10bd9b7e0c14bb&newp=882a9544d48057e50be2963a4d0582231610db2151d0d7133cc2d9&user=baidu&fm=sc&query=QueryPerformanceCounter&qid=&p1=1