File tree Expand file tree Collapse file tree 7 files changed +445
-12
lines changed
test/unit_tests/sources/sysman/temperature Expand file tree Collapse file tree 7 files changed +445
-12
lines changed Original file line number Diff line number Diff line change @@ -103,9 +103,6 @@ ze_result_t SysmanDeviceImp::init() {
103103 if (pFabricPortHandleContext) {
104104 pFabricPortHandleContext->init ();
105105 }
106- if (pTempHandleContext) {
107- pTempHandleContext->init (deviceHandles);
108- }
109106 if (pPci) {
110107 pPci->init ();
111108 }
Original file line number Diff line number Diff line change 11/*
2- * Copyright (C) 2020-2021 Intel Corporation
2+ * Copyright (C) 2020-2022 Intel Corporation
33 *
44 * SPDX-License-Identifier: MIT
55 *
66 */
77
88#include " shared/source/helpers/basic_math.h"
99
10+ #include " level_zero/tools/source/sysman/os_sysman.h"
1011#include " level_zero/tools/source/sysman/temperature/temperature_imp.h"
1112
1213namespace L0 {
@@ -35,6 +36,9 @@ void TemperatureHandleContext::init(std::vector<ze_device_handle_t> &deviceHandl
3536}
3637
3738ze_result_t TemperatureHandleContext::temperatureGet (uint32_t *pCount, zes_temp_handle_t *phTemperature) {
39+ std::call_once (initTemperatureOnce, [this ]() {
40+ this ->init (pOsSysman->getDeviceHandles ());
41+ });
3842 uint32_t handleListSize = static_cast <uint32_t >(handleList.size ());
3943 uint32_t numToCopy = std::min (*pCount, handleListSize);
4044 if (0 == *pCount || *pCount > handleListSize) {
Original file line number Diff line number Diff line change 11/*
2- * Copyright (C) 2020-2021 Intel Corporation
2+ * Copyright (C) 2020-2022 Intel Corporation
33 *
44 * SPDX-License-Identifier: MIT
55 *
88#pragma once
99#include < level_zero/zes_api.h>
1010
11+ #include < mutex>
1112#include < vector>
1213
1314struct _zes_temp_handle_t {
@@ -45,6 +46,7 @@ struct TemperatureHandleContext {
4546
4647 private:
4748 void createHandle (const ze_device_handle_t &deviceHandle, zes_temp_sensors_t type);
49+ std::once_flag initTemperatureOnce;
4850};
4951
50- } // namespace L0
52+ } // namespace L0
Original file line number Diff line number Diff line change 66
77set (L0_TESTS_TOOLS_SYSMAN_TEMPERATURE_LINUX
88 ${CMAKE_CURRENT_SOURCE_DIR} /CMakeLists.txt
9- ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX} test_zes_temperature.cpp
109 ${CMAKE_CURRENT_SOURCE_DIR} /mock_sysfs_temperature.h
1110)
1211
13- if ((NEO_ENABLE_i915_PRELIM_DETECTION) AND ("${BRANCH_TYPE} " STREQUAL "" ))
14- list (REMOVE_ITEM L0_TESTS_TOOLS_SYSMAN_TEMPERATURE_LINUX
12+ if (NEO_ENABLE_i915_PRELIM_DETECTION)
13+ list (APPEND L0_TESTS_TOOLS_SYSMAN_TEMPERATURE_LINUX
14+ ${CMAKE_CURRENT_SOURCE_DIR} /test_zes_temperature_prelim.cpp
15+ )
16+ else ()
17+ list (APPEND L0_TESTS_TOOLS_SYSMAN_TEMPERATURE_LINUX
1518 ${CMAKE_CURRENT_SOURCE_DIR} /test_zes_temperature.cpp
1619 )
1720endif ()
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ class SysmanMultiDeviceTemperatureFixture : public SysmanMultiDeviceFixture {
114114 pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject .emplace (deviceProperties.subdeviceId , pPmt);
115115 }
116116
117- pSysmanDeviceImp-> pTempHandleContext -> init (deviceHandles );
117+ getTempHandles ( 0 );
118118 }
119119 void TearDown () override {
120120 if (!sysmanUltsEnable) {
@@ -230,7 +230,7 @@ class SysmanDeviceTemperatureFixture : public SysmanDeviceFixture {
230230 pLinuxSysmanImp->mapOfSubDeviceIdToPmtObject .emplace (deviceProperties.subdeviceId , pPmt);
231231 }
232232
233- pSysmanDeviceImp-> pTempHandleContext -> init (deviceHandles );
233+ getTempHandles ( 0 );
234234 }
235235 void TearDown () override {
236236 if (!sysmanUltsEnable) {
You can’t perform that action at this time.
0 commit comments