mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Redesign ULT by mocking sysfs and implementing for standby
Change-Id: Id2558122406f23e96e3115d57e7b82d04463bfc4
This commit is contained in:
@@ -80,13 +80,13 @@ class SysfsAccess : private FsAccess {
|
||||
ze_result_t getFileMode(const std::string file, ::mode_t &mode);
|
||||
|
||||
MOCKABLE_VIRTUAL ze_result_t read(const std::string file, std::string &val);
|
||||
ze_result_t read(const std::string file, int &val);
|
||||
MOCKABLE_VIRTUAL ze_result_t read(const std::string file, int &val);
|
||||
MOCKABLE_VIRTUAL ze_result_t read(const std::string file, uint64_t &val);
|
||||
ze_result_t read(const std::string file, double &val);
|
||||
ze_result_t read(const std::string file, std::vector<std::string> &val);
|
||||
|
||||
ze_result_t write(const std::string file, const std::string val);
|
||||
ze_result_t write(const std::string file, const int val);
|
||||
MOCKABLE_VIRTUAL ze_result_t write(const std::string file, const int val);
|
||||
MOCKABLE_VIRTUAL ze_result_t write(const std::string file, const uint64_t val);
|
||||
ze_result_t write(const std::string file, const double val);
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_STANDBY_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/os_standby_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_standby_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_standby_imp.h
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
|
||||
@@ -5,37 +5,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/os_interface.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
#include "sysman/standby/os_standby.h"
|
||||
#include "sysman/standby/standby_imp.h"
|
||||
#include "level_zero/tools/source/sysman/standby/linux/os_standby_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class LinuxStandbyImp : public OsStandby {
|
||||
public:
|
||||
ze_result_t getMode(zet_standby_promo_mode_t &mode) override;
|
||||
ze_result_t setMode(zet_standby_promo_mode_t mode) override;
|
||||
|
||||
LinuxStandbyImp(OsSysman *pOsSysman);
|
||||
~LinuxStandbyImp() override = default;
|
||||
|
||||
// Don't allow copies of the LinuxStandbyImp object
|
||||
LinuxStandbyImp(const LinuxStandbyImp &obj) = delete;
|
||||
LinuxStandbyImp &operator=(const LinuxStandbyImp &obj) = delete;
|
||||
|
||||
private:
|
||||
SysfsAccess *pSysfsAccess;
|
||||
|
||||
static const std::string standbyModeFile;
|
||||
static const int standbyModeDefault = 1;
|
||||
static const int standbyModeNever = 0;
|
||||
};
|
||||
|
||||
const std::string LinuxStandbyImp::standbyModeFile("power/rc6_enable");
|
||||
|
||||
ze_result_t LinuxStandbyImp::getMode(zet_standby_promo_mode_t &mode) {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
#include "sysman/standby/os_standby.h"
|
||||
#include "sysman/standby/standby_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class LinuxStandbyImp : public OsStandby, public NEO::NonCopyableClass {
|
||||
public:
|
||||
ze_result_t getMode(zet_standby_promo_mode_t &mode) override;
|
||||
ze_result_t setMode(zet_standby_promo_mode_t mode) override;
|
||||
LinuxStandbyImp() = default;
|
||||
LinuxStandbyImp(OsSysman *pOsSysman);
|
||||
~LinuxStandbyImp() override = default;
|
||||
|
||||
protected:
|
||||
SysfsAccess *pSysfsAccess = nullptr;
|
||||
|
||||
private:
|
||||
static const std::string standbyModeFile;
|
||||
static const int standbyModeDefault = 1;
|
||||
static const int standbyModeNever = 0;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user