Use timestamps reported by KMD.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2022-02-09 09:13:26 +00:00
committed by Compute-Runtime-Automation
parent 1390af6efe
commit 91cf5064de
2 changed files with 9 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -158,18 +158,6 @@ class FailingMockOSTime : public OSTime {
}
};
TEST(MockOSTime, givenFailingOSTimeWhenGetDeviceAndHostTimerThenFalseIsReturned) {
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
mockDevice->setOSTime(new FailingMockOSTime());
uint64_t deviceTS = 0u, hostTS = 0u;
bool retVal = mockDevice->getDeviceAndHostTimer(&deviceTS, &hostTS);
EXPECT_FALSE(retVal);
EXPECT_EQ(deviceTS, 0u);
EXPECT_EQ(hostTS, 0u);
}
class FailingMockDeviceTime : public DeviceTime {
public:
bool getCpuGpuTime(TimeStampData *pGpuCpuTime, OSTime *osTime) override {

View File

@@ -475,17 +475,15 @@ EngineControl &Device::getEngine(uint32_t index) {
}
bool Device::getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const {
bool retVal = getOSTime()->getCpuTime(hostTimestamp);
TimeStampData timeStamp;
auto retVal = getOSTime()->getCpuGpuTime(&timeStamp);
if (retVal) {
TimeStampData timeStamp;
retVal = getOSTime()->getCpuGpuTime(&timeStamp);
if (retVal) {
if (DebugManager.flags.EnableDeviceBasedTimestamps.get()) {
auto resolution = getOSTime()->getDynamicDeviceTimerResolution(getHardwareInfo());
*deviceTimestamp = static_cast<uint64_t>(timeStamp.GPUTimeStamp * resolution);
} else
*deviceTimestamp = *hostTimestamp;
}
*hostTimestamp = timeStamp.CPUTimeinNS;
if (DebugManager.flags.EnableDeviceBasedTimestamps.get()) {
auto resolution = getOSTime()->getDynamicDeviceTimerResolution(getHardwareInfo());
*deviceTimestamp = static_cast<uint64_t>(timeStamp.GPUTimeStamp * resolution);
} else
*deviceTimestamp = *hostTimestamp;
}
return retVal;
}