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