In Sysman fix C++ programming warnings

Fix warnings related to unused/uninitialized variables etc.

Change-Id: I2e75ede434442d7b99d6e28253e7811aac205323
Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
Jitendra Sharma
2020-10-05 17:36:05 +05:30
committed by sys_ocldev
parent bdf8c5fc90
commit 1962a89b05
8 changed files with 23 additions and 16 deletions

View File

@@ -29,10 +29,7 @@ void EngineHandleContext::createHandle(zes_engine_group_t engineType, uint32_t e
void EngineHandleContext::init() {
std::multimap<zes_engine_group_t, uint32_t> engineGroupInstance = {};
ze_result_t status = OsEngine::getNumEngineTypeAndInstances(engineGroupInstance, pOsSysman);
if (status != ZE_RESULT_SUCCESS) {
return;
}
OsEngine::getNumEngineTypeAndInstances(engineGroupInstance, pOsSysman);
for (auto itr = engineGroupInstance.begin(); itr != engineGroupInstance.end(); ++itr) {
createHandle(itr->first, itr->second);
}

View File

@@ -30,7 +30,10 @@ FirmwareImp::FirmwareImp(OsSysman *pOsSysman) {
}
FirmwareImp::~FirmwareImp() {
delete pOsFirmware;
if (pOsFirmware != nullptr) {
delete pOsFirmware;
pOsFirmware = nullptr;
}
}
} // namespace L0

View File

@@ -13,7 +13,7 @@ class LinuxSysmanImp;
class PmuInterface {
public:
virtual ~PmuInterface() = default;
virtual int64_t pmuInterfaceOpen(uint64_t config, int group, uint64_t format) = 0;
virtual int64_t pmuInterfaceOpen(uint64_t config, int group, uint32_t format) = 0;
virtual int pmuReadSingle(int fd, uint64_t *data, ssize_t sizeOfdata) = 0;
static PmuInterface *create(LinuxSysmanImp *pLinuxSysmanImp);
};

View File

@@ -47,7 +47,7 @@ inline int64_t PmuInterfaceImp::perfEventOpen(perf_event_attr *attr, pid_t pid,
return syscall(perfEventOpenSyscallNumber, attr, pid, cpu, groupFd, flags);
}
int64_t PmuInterfaceImp::pmuInterfaceOpen(uint64_t config, int group, uint64_t format) {
int64_t PmuInterfaceImp::pmuInterfaceOpen(uint64_t config, int group, uint32_t format) {
struct perf_event_attr attr = {};
int nrCpus = get_nprocs_conf();
int cpu = 0;
@@ -62,7 +62,7 @@ int64_t PmuInterfaceImp::pmuInterfaceOpen(uint64_t config, int group, uint64_t f
format &= ~PERF_FORMAT_GROUP;
}
attr.read_format = format;
attr.read_format = static_cast<uint64_t>(format);
attr.config = config;
do {

View File

@@ -20,7 +20,7 @@ class PmuInterfaceImp : public PmuInterface, NEO::NonCopyableOrMovableClass {
PmuInterfaceImp() = delete;
PmuInterfaceImp(LinuxSysmanImp *pLinuxSysmanImp);
~PmuInterfaceImp() override = default;
int64_t pmuInterfaceOpen(uint64_t config, int group, uint64_t format) override;
int64_t pmuInterfaceOpen(uint64_t config, int group, uint32_t format) override;
MOCKABLE_VIRTUAL int pmuReadSingle(int fd, uint64_t *data, ssize_t sizeOfdata) override;
protected:

View File

@@ -33,7 +33,7 @@ ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t ge
uint32_t i = 0;
std::vector<uint64_t> timeoutVec = {};
timeoutVec.resize(listOfEngines.size());
for (auto engineName : listOfEngines) {
for (const auto &engineName : listOfEngines) {
if (getDefault) {
result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultPreemptTimeouttMilliSecs, timeout);
} else {
@@ -64,7 +64,7 @@ ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t &timeslice, ze_bool
uint32_t i = 0;
std::vector<uint64_t> timesliceVec = {};
timesliceVec.resize(listOfEngines.size());
for (auto engineName : listOfEngines) {
for (const auto &engineName : listOfEngines) {
if (getDefault) {
result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultTimesliceDurationMilliSecs, timeslice);
} else {
@@ -95,7 +95,7 @@ ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool
uint32_t i = 0;
std::vector<uint64_t> heartbeatVec = {};
heartbeatVec.resize(listOfEngines.size());
for (auto engineName : listOfEngines) {
for (const auto &engineName : listOfEngines) {
if (getDefault) {
result = pSysfsAccess->read(engineDir + "/" + engineName + "/" + defaultHeartbeatIntervalMilliSecs, heartbeat);
} else {
@@ -124,7 +124,7 @@ ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool
ze_result_t LinuxSchedulerImp::setPreemptTimeout(uint64_t timeout) {
timeout = timeout / milliSecsToMicroSecs;
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
for (auto engineName : listOfEngines) {
for (const auto &engineName : listOfEngines) {
result = pSysfsAccess->write(engineDir + "/" + engineName + "/" + preemptTimeoutMilliSecs, timeout);
if (result != ZE_RESULT_SUCCESS) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
@@ -139,7 +139,7 @@ ze_result_t LinuxSchedulerImp::setPreemptTimeout(uint64_t timeout) {
ze_result_t LinuxSchedulerImp::setTimesliceDuration(uint64_t timeslice) {
timeslice = timeslice / milliSecsToMicroSecs;
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
for (auto engineName : listOfEngines) {
for (const auto &engineName : listOfEngines) {
result = pSysfsAccess->write(engineDir + "/" + engineName + "/" + timesliceDurationMilliSecs, timeslice);
if (result != ZE_RESULT_SUCCESS) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
@@ -154,7 +154,7 @@ ze_result_t LinuxSchedulerImp::setTimesliceDuration(uint64_t timeslice) {
ze_result_t LinuxSchedulerImp::setHeartbeatInterval(uint64_t heartbeat) {
heartbeat = heartbeat / milliSecsToMicroSecs;
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
for (auto engineName : listOfEngines) {
for (const auto &engineName : listOfEngines) {
result = pSysfsAccess->write(engineDir + "/" + engineName + "/" + heartbeatIntervalMilliSecs, heartbeat);
if (result != ZE_RESULT_SUCCESS) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {

View File

@@ -31,7 +31,6 @@ class SchedulerImp : public Scheduler, NEO::NonCopyableOrMovableClass {
OsScheduler *pOsScheduler = nullptr;
SchedulerImp(OsSysman *pOsSysman, zes_engine_type_flag_t type, std::vector<std::string> &listOfEngines, ze_device_handle_t deviceHandle);
~SchedulerImp() override;
zes_engine_type_flag_t engineType;
private:
zes_sched_properties_t properties = {};