mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Add support for zetPowerGetEnergyCounter
Change-Id: I497e025690401ced668d653db4e0052852b6e570 Signed-off-by: SaiKishore Konda <saikishore.konda@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
d9cc640986
commit
16ee26f20d
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "level_zero/tools/source/sysman/power/linux/os_power_imp.h"
|
||||
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
ze_result_t LinuxPowerImp::getEnergyCounter(uint64_t &energy) {
|
||||
@@ -19,6 +21,10 @@ LinuxPowerImp::LinuxPowerImp(OsSysman *pOsSysman) {
|
||||
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
}
|
||||
|
||||
bool LinuxPowerImp::isPowerModuleSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
OsPower *OsPower::create(OsSysman *pOsSysman) {
|
||||
LinuxPowerImp *pLinuxPowerImp = new LinuxPowerImp(pOsSysman);
|
||||
return static_cast<OsPower *>(pLinuxPowerImp);
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
#include "level_zero/tools/source/sysman/power/os_power.h"
|
||||
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class SysfsAccess;
|
||||
class LinuxPowerImp : public OsPower, public NEO::NonCopyableClass {
|
||||
public:
|
||||
ze_result_t getEnergyCounter(uint64_t &energy) override;
|
||||
bool isPowerModuleSupported() override;
|
||||
LinuxPowerImp(OsSysman *pOsSysman);
|
||||
LinuxPowerImp() = default;
|
||||
~LinuxPowerImp() override = default;
|
||||
|
||||
@@ -15,6 +15,7 @@ struct OsSysman;
|
||||
class OsPower {
|
||||
public:
|
||||
virtual ze_result_t getEnergyCounter(uint64_t &energy) = 0;
|
||||
virtual bool isPowerModuleSupported() = 0;
|
||||
static OsPower *create(OsSysman *pOsSysman);
|
||||
virtual ~OsPower() = default;
|
||||
};
|
||||
|
||||
@@ -57,6 +57,10 @@ PowerImp::PowerImp(OsSysman *pOsSysman) {
|
||||
init();
|
||||
}
|
||||
|
||||
void PowerImp::init() {
|
||||
this->initSuccess = pOsPower->isPowerModuleSupported();
|
||||
}
|
||||
|
||||
PowerImp::~PowerImp() {
|
||||
if (nullptr != pOsPower) {
|
||||
delete pOsPower;
|
||||
|
||||
@@ -26,6 +26,6 @@ class PowerImp : public NEO::NonCopyableClass, public Power {
|
||||
~PowerImp() override;
|
||||
|
||||
OsPower *pOsPower = nullptr;
|
||||
void init() {}
|
||||
void init();
|
||||
};
|
||||
} // namespace L0
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace L0 {
|
||||
class WddmPowerImp : public OsPower {
|
||||
public:
|
||||
ze_result_t getEnergyCounter(uint64_t &energy) override;
|
||||
bool isPowerModuleSupported() override;
|
||||
};
|
||||
|
||||
ze_result_t WddmPowerImp::getEnergyCounter(uint64_t &energy) {
|
||||
@@ -19,6 +20,10 @@ ze_result_t WddmPowerImp::getEnergyCounter(uint64_t &energy) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
bool WddmPowerImp::isPowerModuleSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
OsPower *OsPower::create(OsSysman *pOsSysman) {
|
||||
WddmPowerImp *pWddmPowerImp = new WddmPowerImp();
|
||||
return static_cast<OsPower *>(pWddmPowerImp);
|
||||
|
||||
Reference in New Issue
Block a user