mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Fix profiling calculation for CPU profiling path.
-There was a precision problem with timestamp calculation, all math was using integers which are not very precise in overflow scenarios -Change the logic to use doubles and cast back to uint64_t at the end. Change-Id: Ia08d504a90a43df7330f398af966535ed944650d
This commit is contained in:
committed by
sys_ocldev
parent
063e9623ba
commit
ca33e029b7
@@ -85,11 +85,9 @@ bool OSTimeWin::getCpuGpuTime(TimeStampData *pGpuCpuTime) {
|
||||
|
||||
bool OSTimeWin::getCpuTime(uint64_t *timeStamp) {
|
||||
uint64_t time;
|
||||
uint64_t frequency;
|
||||
QueryPerformanceCounter((LARGE_INTEGER *)&time);
|
||||
QueryPerformanceFrequency((LARGE_INTEGER *)&frequency);
|
||||
this->QueryPerfomanceCounterFnc((LARGE_INTEGER *)&time);
|
||||
|
||||
*timeStamp = time * NSEC_PER_SEC / frequency;
|
||||
*timeStamp = static_cast<uint64_t>((static_cast<double>(time) * NSEC_PER_SEC / frequency.QuadPart));
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -126,7 +124,7 @@ double OSTimeWin::getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo) co
|
||||
|
||||
uint64_t OSTimeWin::getCpuRawTimestamp() {
|
||||
LARGE_INTEGER cpuRawTimestamp = {};
|
||||
QueryPerformanceCounter(&cpuRawTimestamp);
|
||||
this->QueryPerfomanceCounterFnc(&cpuRawTimestamp);
|
||||
return cpuRawTimestamp.QuadPart;
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -42,6 +42,7 @@ class OSTimeWin : public OSTime {
|
||||
Wddm *wddm;
|
||||
LARGE_INTEGER frequency;
|
||||
OSTimeWin() {}
|
||||
decltype(&QueryPerformanceCounter) QueryPerfomanceCounterFnc = QueryPerformanceCounter;
|
||||
};
|
||||
|
||||
typedef enum GTDI_ESCAPE_FUNCTION_ENUM {
|
||||
|
||||
Reference in New Issue
Block a user