2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2021-05-16 20:51:16 +02:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2018-09-18 09:11:08 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2021-07-06 15:44:16 +02:00
|
|
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
2021-10-21 14:50:10 +00:00
|
|
|
#include "shared/test/common/mocks/mock_ostime.h"
|
2021-12-21 11:53:21 +00:00
|
|
|
#include "shared/test/common/mocks/mock_ostime_win.h"
|
2021-07-06 15:44:16 +02:00
|
|
|
#include "shared/test/common/mocks/mock_wddm.h"
|
2021-12-14 17:40:08 +00:00
|
|
|
#include "shared/test/common/test_macros/test.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2020-05-28 14:05:12 +02:00
|
|
|
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
using namespace NEO;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
namespace ULT {
|
|
|
|
|
|
|
|
|
|
typedef ::testing::Test MockOSTimeWinTest;
|
|
|
|
|
|
2020-02-17 10:48:59 +01:00
|
|
|
TEST_F(MockOSTimeWinTest, WhenCreatingTimerThenResolutionIsSetCorrectly) {
|
2019-11-06 18:14:30 +01:00
|
|
|
MockExecutionEnvironment executionEnvironment;
|
|
|
|
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
2020-04-08 11:45:54 +02:00
|
|
|
auto wddmMock = new WddmMock(rootDeviceEnvironment);
|
2020-02-10 11:15:34 +01:00
|
|
|
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2020-02-10 11:15:34 +01:00
|
|
|
wddmMock->init();
|
2019-02-07 15:09:27 +01:00
|
|
|
|
2021-02-01 18:37:13 +00:00
|
|
|
wddmMock->timestampFrequency = 1000;
|
|
|
|
|
|
2020-04-08 11:45:54 +02:00
|
|
|
std::unique_ptr<MockOSTimeWin> timeWin(new MockOSTimeWin(wddmMock));
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
double res = 0.0;
|
2020-02-10 11:15:34 +01:00
|
|
|
res = timeWin->getDynamicDeviceTimerResolution(device->getHardwareInfo());
|
2021-02-01 18:37:13 +00:00
|
|
|
EXPECT_EQ(res, 1e+06);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace ULT
|