Measure CPU time on Windows using GetProcessTimes
问题 I would like to measure CPU time of some function. I know how to use GetProcessTimes , but I have a problem implementing it with some kind of 'restarting': Normally, I would do it like this: #include "stdafx.h" #include <math.h> #include <windows.h> double cputimer() { FILETIME createTime; FILETIME exitTime; FILETIME kernelTime; FILETIME userTime; if ( GetProcessTimes( GetCurrentProcess( ), &createTime, &exitTime, &kernelTime, &userTime ) != -1 ) { SYSTEMTIME userSystemTime; if (