Merge pull request #1486 from lz4/win_ptime

fix process time counter on Windows for very large files
This commit is contained in:
Yann Collet 2024-08-03 00:21:34 -07:00 committed by GitHub
commit 7e79c1da1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,9 +115,9 @@ static double cpuLoad_sec(clock_t cpuStart)
FILETIME creationTime, exitTime, kernelTime, userTime;
(void)cpuStart;
GetProcessTimes(GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime);
assert(kernelTime.dwHighDateTime == 0);
assert(userTime.dwHighDateTime == 0);
return ((double)kernelTime.dwLowDateTime + (double)userTime.dwLowDateTime) * 100. / 1000000000.;
return ( ((double)kernelTime.dwLowDateTime + (double)userTime.dwLowDateTime)
+ ((double)kernelTime.dwHighDateTime + (double)userTime.dwHighDateTime) * (double)(1ULL << 32) )
* 100. / 1000000000.;
#else
return (double)(clock() - cpuStart) / CLOCKS_PER_SEC;
#endif