- 606 名前: ◆0uxK91AxII mailto:sage [2011/06/25(土) 18:39:30.70 ]
- Win32のCRTにある_beginthread。
生成は0.1[ms]未満、実行開始はコンパイラかライブラリに依存で0.1[ms]台からに訂正。 #include <Windows.h> #include <stdio.h> #include <process.h> struct perf {LARGE_INTEGER freq;LARGE_INTEGER t0;};void __cdecl thread(void * pArg){perf *pperf;LARGE_INTEGER t1, d;QueryPerformanceCounter(&t1);pperf = (perf *)pArg;printf("thread: %I64d\n",t1.QuadPart-pperf->t0.QuadPart);}int main(){ LARGE_INTEGER f={0}, t0, t1, d;perf perf;QueryPerformanceFrequency(&f);printf( "freq: %I64d\n", f.QuadPart);perf.freq = f;QueryPerformanceCounter(&t0);perf.t0 = t0;_beginthread(thread, 0, &perf);QueryPerformanceCounter(&t1);printf( "main: %I64d\n", t1.QuadPart-t0.QuadPart);Sleep(1000);return 0;}
|

|