Support for Platform Monitoring Technology

Add support for Platform Monitoring Technology,
and read temperature and energy counters.

Change-Id: Ic2c79e902400148cc538267c498fc1d0185c81f8
Signed-off-by: Matias Cabral <matias.a.cabral@intel.com>
This commit is contained in:
macabral
2020-06-30 17:34:31 -07:00
committed by sys_ocldev
parent fdf85aff7a
commit e08022e9c7
17 changed files with 450 additions and 74 deletions

View File

@@ -5,8 +5,8 @@
#
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
${CMAKE_CURRENT_SOURCE_DIR}/os_power_imp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/os_power_imp.h
)
if(UNIX)

View File

@@ -7,15 +7,12 @@
#include "level_zero/tools/source/sysman/power/linux/os_power_imp.h"
#include "level_zero/tools/source/sysman/linux/pmt.h"
#include "sysman/linux/os_sysman_imp.h"
namespace L0 {
ze_result_t LinuxPowerImp::getEnergyCounter(uint64_t &energy) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
constexpr uint64_t convertJouleToMicroJoule = 1000000u;
ze_result_t LinuxPowerImp::getEnergyThreshold(zet_energy_threshold_t *pThreshold) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
@@ -25,14 +22,21 @@ ze_result_t LinuxPowerImp::setEnergyThreshold(double threshold) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
LinuxPowerImp::LinuxPowerImp(OsSysman *pOsSysman) {
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
ze_result_t LinuxPowerImp::getEnergyCounter(uint64_t &energy) {
const std::string key("PACKAGE_ENERGY");
ze_result_t result = pPmt->readValue(key, energy);
// PMT will return in joules and need to convert into microjoules
energy = energy * convertJouleToMicroJoule;
return result;
}
bool LinuxPowerImp::isPowerModuleSupported() {
return false;
return pPmt->isPmtSupported();
}
LinuxPowerImp::LinuxPowerImp(OsSysman *pOsSysman) {
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
pPmt = &pLinuxSysmanImp->getPlatformMonitoringTechAccess();
}
OsPower *OsPower::create(OsSysman *pOsSysman) {

View File

@@ -13,6 +13,7 @@
namespace L0 {
class SysfsAccess;
class PlatformMonitoringTech;
class LinuxPowerImp : public OsPower, public NEO::NonCopyableClass {
public:
ze_result_t getEnergyCounter(uint64_t &energy) override;
@@ -25,5 +26,6 @@ class LinuxPowerImp : public OsPower, public NEO::NonCopyableClass {
protected:
SysfsAccess *pSysfsAccess = nullptr;
PlatformMonitoringTech *pPmt = nullptr;
};
} // namespace L0