File tree Expand file tree Collapse file tree 2 files changed +9
-23
lines changed
opencl/test/unit_test/device Expand file tree Collapse file tree 2 files changed +9
-23
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (C) 2018-2021 Intel Corporation
2+ * Copyright (C) 2018-2022 Intel Corporation
33 *
44 * SPDX-License-Identifier: MIT
55 *
@@ -158,18 +158,6 @@ class FailingMockOSTime : public OSTime {
158158 }
159159};
160160
161- TEST (MockOSTime, givenFailingOSTimeWhenGetDeviceAndHostTimerThenFalseIsReturned) {
162- auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr ));
163- mockDevice->setOSTime (new FailingMockOSTime ());
164-
165- uint64_t deviceTS = 0u , hostTS = 0u ;
166- bool retVal = mockDevice->getDeviceAndHostTimer (&deviceTS, &hostTS);
167-
168- EXPECT_FALSE (retVal);
169- EXPECT_EQ (deviceTS, 0u );
170- EXPECT_EQ (hostTS, 0u );
171- }
172-
173161class FailingMockDeviceTime : public DeviceTime {
174162 public:
175163 bool getCpuGpuTime (TimeStampData *pGpuCpuTime, OSTime *osTime) override {
Original file line number Diff line number Diff line change @@ -475,17 +475,15 @@ EngineControl &Device::getEngine(uint32_t index) {
475475}
476476
477477bool Device::getDeviceAndHostTimer (uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const {
478- bool retVal = getOSTime ()->getCpuTime (hostTimestamp);
478+ TimeStampData timeStamp;
479+ auto retVal = getOSTime ()->getCpuGpuTime (&timeStamp);
479480 if (retVal) {
480- TimeStampData timeStamp;
481- retVal = getOSTime ()->getCpuGpuTime (&timeStamp);
482- if (retVal) {
483- if (DebugManager.flags .EnableDeviceBasedTimestamps .get ()) {
484- auto resolution = getOSTime ()->getDynamicDeviceTimerResolution (getHardwareInfo ());
485- *deviceTimestamp = static_cast <uint64_t >(timeStamp.GPUTimeStamp * resolution);
486- } else
487- *deviceTimestamp = *hostTimestamp;
488- }
481+ *hostTimestamp = timeStamp.CPUTimeinNS ;
482+ if (DebugManager.flags .EnableDeviceBasedTimestamps .get ()) {
483+ auto resolution = getOSTime ()->getDynamicDeviceTimerResolution (getHardwareInfo ());
484+ *deviceTimestamp = static_cast <uint64_t >(timeStamp.GPUTimeStamp * resolution);
485+ } else
486+ *deviceTimestamp = *hostTimestamp;
489487 }
490488 return retVal;
491489}
You can’t perform that action at this time.
0 commit comments