2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-02-10 18:15:34 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 01:46:50 +08:00
|
|
|
#include "execution_environment/root_device_environment.h"
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/fixtures/device_fixture.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_ostime.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_ostime_win.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "test.h"
|
|
|
|
|
|
|
|
#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);
|
|
|
|
auto wddmMock = std::unique_ptr<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
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
std::unique_ptr<MockOSTimeWin> timeWin(new MockOSTimeWin(wddmMock.get()));
|
|
|
|
|
|
|
|
double res = 0.0;
|
2020-02-10 18:15:34 +08:00
|
|
|
res = timeWin->getDynamicDeviceTimerResolution(device->getHardwareInfo());
|
2017-12-21 07:45:38 +08:00
|
|
|
EXPECT_EQ(res, 1e+09);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace ULT
|