mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Retrieve system default values for sysman scheduler
Change-Id: Ia547493e88656ad840b935487e52bc67fa806ebb
This commit is contained in:
@@ -7,31 +7,51 @@
|
||||
|
||||
#include "level_zero/tools/source/sysman/scheduler/linux/os_scheduler_imp.h"
|
||||
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
const std::string LinuxSchedulerImp::preemptTimeoutMilliSecs("engine/rcs0/preempt_timeout_ms");
|
||||
const std::string LinuxSchedulerImp::defaultPreemptTimeouttMilliSecs("engine/rcs0/.defaults/preempt_timeout_ms");
|
||||
const std::string LinuxSchedulerImp::timesliceDurationMilliSecs("engine/rcs0/timeslice_duration_ms");
|
||||
const std::string LinuxSchedulerImp::defaultTimesliceDurationMilliSecs("engine/rcs0/.defaults/timeslice_duration_ms");
|
||||
const std::string LinuxSchedulerImp::heartbeatIntervalMilliSecs("engine/rcs0/heartbeat_interval_ms");
|
||||
const std::string LinuxSchedulerImp::defaultHeartbeatIntervalMilliSecs("engine/rcs0/.defaults/heartbeat_interval_ms");
|
||||
constexpr uint16_t milliSecsToMicroSecs = 1000;
|
||||
|
||||
ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout) {
|
||||
ze_result_t result = pSysfsAccess->read(preemptTimeoutMilliSecs, timeout);
|
||||
ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t getDefault) {
|
||||
ze_result_t result;
|
||||
if (getDefault) {
|
||||
result = pSysfsAccess->read(defaultPreemptTimeouttMilliSecs, timeout);
|
||||
} else {
|
||||
result = pSysfsAccess->read(preemptTimeoutMilliSecs, timeout);
|
||||
}
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
timeout = timeout * milliSecsToMicroSecs;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t ×lice) {
|
||||
ze_result_t result = pSysfsAccess->read(timesliceDurationMilliSecs, timeslice);
|
||||
ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t ×lice, ze_bool_t getDefault) {
|
||||
ze_result_t result;
|
||||
if (getDefault) {
|
||||
result = pSysfsAccess->read(defaultTimesliceDurationMilliSecs, timeslice);
|
||||
} else {
|
||||
result = pSysfsAccess->read(timesliceDurationMilliSecs, timeslice);
|
||||
}
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
timeslice = timeslice * milliSecsToMicroSecs;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat) {
|
||||
ze_result_t result = pSysfsAccess->read(heartbeatIntervalMilliSecs, heartbeat);
|
||||
ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool_t getDefault) {
|
||||
ze_result_t result;
|
||||
if (getDefault) {
|
||||
result = pSysfsAccess->read(defaultHeartbeatIntervalMilliSecs, heartbeat);
|
||||
} else {
|
||||
result = pSysfsAccess->read(heartbeatIntervalMilliSecs, heartbeat);
|
||||
}
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
heartbeat = heartbeat * milliSecsToMicroSecs;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "sysman/linux/os_sysman_imp.h"
|
||||
#include "sysman/scheduler/scheduler_imp.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace L0 {
|
||||
class SysfsAccess;
|
||||
|
||||
// Following below mappings of scheduler properties with sysfs nodes
|
||||
// zet_sched_timeslice_properties_t.interval = timeslice_duration_ms
|
||||
@@ -17,9 +19,9 @@ namespace L0 {
|
||||
// zet_sched_timeout_properties_t. watchdogTimeout = heartbeat_interval_ms
|
||||
class LinuxSchedulerImp : public NEO::NonCopyableClass, public OsScheduler {
|
||||
public:
|
||||
ze_result_t getPreemptTimeout(uint64_t &timeout) override;
|
||||
ze_result_t getTimesliceDuration(uint64_t ×lice) override;
|
||||
ze_result_t getHeartbeatInterval(uint64_t &heartbeat) override;
|
||||
ze_result_t getPreemptTimeout(uint64_t &timeout, ze_bool_t getDefault) override;
|
||||
ze_result_t getTimesliceDuration(uint64_t ×lice, ze_bool_t getDefault) override;
|
||||
ze_result_t getHeartbeatInterval(uint64_t &heartbeat, ze_bool_t getDefault) override;
|
||||
ze_result_t setPreemptTimeout(uint64_t timeout) override;
|
||||
ze_result_t setTimesliceDuration(uint64_t timeslice) override;
|
||||
ze_result_t setHeartbeatInterval(uint64_t heartbeat) override;
|
||||
@@ -32,8 +34,11 @@ class LinuxSchedulerImp : public NEO::NonCopyableClass, public OsScheduler {
|
||||
|
||||
private:
|
||||
static const std::string preemptTimeoutMilliSecs;
|
||||
static const std::string defaultPreemptTimeouttMilliSecs;
|
||||
static const std::string timesliceDurationMilliSecs;
|
||||
static const std::string defaultTimesliceDurationMilliSecs;
|
||||
static const std::string heartbeatIntervalMilliSecs;
|
||||
static const std::string defaultHeartbeatIntervalMilliSecs;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user