mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
add support for zetSysmanPowerGetEnergyCounter
-- add ULT support for power Change-Id: I37ebebb62c3433a1efe106d6b6546955a2d6effb Signed-off-by: SaiKishore Konda <saikishore.konda@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
135851e218
commit
80f9b5e45a
@@ -6,6 +6,7 @@
|
||||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_POWER_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/os_power_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/os_power_imp.h
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
@@ -15,4 +16,4 @@ if(UNIX)
|
||||
endif()
|
||||
|
||||
# Make our source files visible to parent
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_POWER_LINUX ${L0_SRCS_TOOLS_SYSMAN_POWER_LINUX})
|
||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_POWER_LINUX ${L0_SRCS_TOOLS_SYSMAN_POWER_LINUX})
|
||||
|
||||
@@ -5,22 +5,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
|
||||
#include "level_zero/tools/source/sysman/power/os_power.h"
|
||||
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
#include "level_zero/tools/source/sysman/power/linux/os_power_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class LinuxPowerImp : public OsPower, public NEO::NonCopyableClass {
|
||||
public:
|
||||
LinuxPowerImp(OsSysman *pOsSysman);
|
||||
~LinuxPowerImp() override = default;
|
||||
ze_result_t LinuxPowerImp::getEnergyCounter(uint64_t &energy) {
|
||||
|
||||
private:
|
||||
SysfsAccess *pSysfsAccess = nullptr;
|
||||
};
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
LinuxPowerImp::LinuxPowerImp(OsSysman *pOsSysman) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
@@ -32,4 +24,4 @@ OsPower *OsPower::create(OsSysman *pOsSysman) {
|
||||
return static_cast<OsPower *>(pLinuxPowerImp);
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
} // namespace L0
|
||||
|
||||
27
level_zero/tools/source/sysman/power/linux/os_power_imp.h
Normal file
27
level_zero/tools/source/sysman/power/linux/os_power_imp.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
|
||||
#include "level_zero/tools/source/sysman/power/os_power.h"
|
||||
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class LinuxPowerImp : public OsPower, public NEO::NonCopyableClass {
|
||||
public:
|
||||
ze_result_t getEnergyCounter(uint64_t &energy) override;
|
||||
LinuxPowerImp(OsSysman *pOsSysman);
|
||||
LinuxPowerImp() = default;
|
||||
~LinuxPowerImp() override = default;
|
||||
|
||||
protected:
|
||||
SysfsAccess *pSysfsAccess = nullptr;
|
||||
};
|
||||
} // namespace L0
|
||||
@@ -14,6 +14,7 @@ namespace L0 {
|
||||
struct OsSysman;
|
||||
class OsPower {
|
||||
public:
|
||||
virtual ze_result_t getEnergyCounter(uint64_t &energy) = 0;
|
||||
static OsPower *create(OsSysman *pOsSysman);
|
||||
virtual ~OsPower() = default;
|
||||
};
|
||||
|
||||
@@ -11,14 +11,30 @@
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
void powerGetTimestamp(uint64_t ×tamp) {
|
||||
std::chrono::time_point<std::chrono::steady_clock> ts = std::chrono::steady_clock::now();
|
||||
timestamp = std::chrono::duration_cast<std::chrono::microseconds>(ts.time_since_epoch()).count();
|
||||
}
|
||||
|
||||
ze_result_t PowerImp::powerGetProperties(zet_power_properties_t *pProperties) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t PowerImp::powerGetEnergyCounter(zet_power_energy_counter_t *pEnergy) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
|
||||
ze_result_t result = pOsPower->getEnergyCounter(pEnergy->energy);
|
||||
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
powerGetTimestamp(pEnergy->timestamp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t PowerImp::powerGetLimits(zet_power_sustained_limit_t *pSustained, zet_power_burst_limit_t *pBurst, zet_power_peak_limit_t *pPeak) {
|
||||
|
||||
@@ -9,11 +9,19 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class WddmPowerImp : public OsPower {};
|
||||
class WddmPowerImp : public OsPower {
|
||||
public:
|
||||
ze_result_t getEnergyCounter(uint64_t &energy) override;
|
||||
};
|
||||
|
||||
ze_result_t WddmPowerImp::getEnergyCounter(uint64_t &energy) {
|
||||
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
OsPower *OsPower::create(OsSysman *pOsSysman) {
|
||||
WddmPowerImp *pWddmPowerImp = new WddmPowerImp();
|
||||
return static_cast<OsPower *>(pWddmPowerImp);
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user