mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 09:03:14 +08:00
fix: Add move instead of copy in sysman module
Related-To: NEO-15795 Signed-off-by: Sarbojit Sarkar <sarbojit.sarkar@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
584e176126
commit
2b1cc98693
@@ -54,13 +54,13 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar
|
||||
return result;
|
||||
}
|
||||
if (std::find(lateBindingFirmwareTypes.begin(), lateBindingFirmwareTypes.end(), fwType) != lateBindingFirmwareTypes.end()) {
|
||||
if (pLinuxSysmanImp->getSysmanKmdInterface()->isLateBindingVersionAvailable(fwType, fwVersion)) {
|
||||
if (pLinuxSysmanImp->getSysmanKmdInterface()->isLateBindingVersionAvailable(std::move(fwType), fwVersion)) {
|
||||
strncpy_s(static_cast<char *>(pProperties->version), ZES_STRING_PROPERTY_SIZE, fwVersion.c_str(), ZES_STRING_PROPERTY_SIZE - 1);
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
ze_result_t result = pFwInterface->getFwVersion(fwType, fwVersion);
|
||||
ze_result_t result = pFwInterface->getFwVersion(std::move(fwType), fwVersion);
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
strncpy_s(static_cast<char *>(pProperties->version), ZES_STRING_PROPERTY_SIZE, fwVersion.c_str(), ZES_STRING_PROPERTY_SIZE - 1);
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ std::vector<zes_freq_domain_t> OsFrequency::getNumberOfFreqDomainsSupported(OsSy
|
||||
auto pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
auto pSysmanKmdInterface = pLinuxSysmanImp->getSysmanKmdInterface();
|
||||
auto baseDir = pSysmanKmdInterface->getFreqMediaDomainBasePath();
|
||||
if (pSysfsAccess->directoryExists(baseDir)) {
|
||||
if (pSysfsAccess->directoryExists(std::move(baseDir))) {
|
||||
freqDomains.push_back(ZES_FREQ_DOMAIN_MEDIA);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,11 +439,11 @@ ze_result_t LinuxGlobalOperationsImp::getMemoryStatsUsedByProcess(std::vector<st
|
||||
label = label.substr(0, label.length() - 1);
|
||||
if (label.substr(0, memSizeString.length()) == memSizeString) {
|
||||
// Convert Memory obtained to bytes
|
||||
value = value * convertToBytes(unitOfSize);
|
||||
value = value * convertToBytes(std::move(unitOfSize));
|
||||
memSize += value;
|
||||
} else if (label.substr(0, sharedSizeString.length()) == sharedSizeString) {
|
||||
// Convert Memory obtained to bytes
|
||||
value = value * convertToBytes(unitOfSize);
|
||||
value = value * convertToBytes(std::move(unitOfSize));
|
||||
sharedSize += value;
|
||||
}
|
||||
}
|
||||
@@ -546,7 +546,7 @@ ze_result_t LinuxGlobalOperationsImp::readClientInfoFromFdInfo(std::map<uint64_t
|
||||
for (const auto &fd : gpuClientProcess.second) {
|
||||
std::string fdInfoPath = "/proc/" + std::to_string(static_cast<int>(pid)) + "/fdinfo/" + std::to_string(fd);
|
||||
std::vector<std::string> fdFileContents;
|
||||
result = pFsAccess->read(fdInfoPath, fdFileContents);
|
||||
result = pFsAccess->read(std::move(fdInfoPath), fdFileContents);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
if (ZE_RESULT_ERROR_NOT_AVAILABLE == result) {
|
||||
// update the result as Success as ZE_RESULT_ERROR_NOT_AVAILABLE is expected if process exited by the time we are readig it.
|
||||
@@ -613,7 +613,7 @@ ze_result_t LinuxGlobalOperationsImp::readClientInfoFromSysfs(std::map<uint64_t,
|
||||
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
std::string bPidString;
|
||||
result = pSysfsAccess->read(realClientPidPath, bPidString);
|
||||
result = pSysfsAccess->read(std::move(realClientPidPath), bPidString);
|
||||
if (result == ZE_RESULT_SUCCESS) {
|
||||
size_t start = bPidString.find("<");
|
||||
size_t end = bPidString.find(">");
|
||||
@@ -654,7 +654,7 @@ ze_result_t LinuxGlobalOperationsImp::readClientInfoFromSysfs(std::map<uint64_t,
|
||||
for (const auto &engineNum : engineNums) {
|
||||
uint64_t timeSpent = 0;
|
||||
std::string engine = busyDirForEngines + "/" + engineNum;
|
||||
result = pSysfsAccess->read(engine, timeSpent);
|
||||
result = pSysfsAccess->read(std::move(engine), timeSpent);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
if (ZE_RESULT_ERROR_NOT_AVAILABLE == result) {
|
||||
continue;
|
||||
|
||||
@@ -89,7 +89,7 @@ void LinuxPciImp::getMaxLinkCaps(double &maxLinkSpeed, int32_t &maxLinkWidth) {
|
||||
}
|
||||
|
||||
std::vector<uint8_t> configMemory(PCI_CFG_SPACE_SIZE);
|
||||
if (!getPciConfigMemory(pciConfigNode, configMemory)) {
|
||||
if (!getPciConfigMemory(std::move(pciConfigNode), configMemory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ bool LinuxPciImp::resizableBarSupported() {
|
||||
std::string pciConfigNode = {};
|
||||
pSysfsAccess->getRealPath("device/config", pciConfigNode);
|
||||
std::vector<uint8_t> configMemory(PCI_CFG_SPACE_EXP_SIZE);
|
||||
if (!getPciConfigMemory(pciConfigNode, configMemory)) {
|
||||
if (!getPciConfigMemory(std::move(pciConfigNode), configMemory)) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ bool LinuxPciImp::resizableBarEnabled(uint32_t barIndex) {
|
||||
std::string pciConfigNode = {};
|
||||
pSysfsAccess->getRealPath("device/config", pciConfigNode);
|
||||
std::vector<uint8_t> configMemory(PCI_CFG_SPACE_EXP_SIZE);
|
||||
if (!getPciConfigMemory(pciConfigNode, configMemory)) {
|
||||
if (!getPciConfigMemory(std::move(pciConfigNode), configMemory)) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Unable to get pci config space \n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ ze_result_t SysmanKmdInterface::initFsAccessInterface(const NEO::Drm &drm) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to device name and returning error:0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
}
|
||||
pSysfsAccess = SysFsAccessInterface::create(deviceName);
|
||||
pSysfsAccess = SysFsAccessInterface::create(std::move(deviceName));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ ze_result_t SysmanKmdInterface::getNumEngineTypeAndInstancesForSubDevices(std::m
|
||||
ze_result_t SysmanKmdInterface::getNumEngineTypeAndInstancesForDevice(std::string engineDir, std::map<zes_engine_type_flag_t, std::vector<std::string>> &mapOfEngines,
|
||||
SysFsAccessInterface *pSysfsAccess) {
|
||||
std::vector<std::string> localListOfAllEngines = {};
|
||||
auto result = pSysfsAccess->scanDirEntries(engineDir, localListOfAllEngines);
|
||||
auto result = pSysfsAccess->scanDirEntries(std::move(engineDir), localListOfAllEngines);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
|
||||
@@ -104,7 +104,7 @@ ze_result_t SysmanProductHelperHw<gfxProduct>::getMemoryProperties(zes_mem_prope
|
||||
if (isSubdevice) {
|
||||
std::string memval;
|
||||
std::string physicalSizeFile = pSysmanKmdInterface->getSysfsFilePathForPhysicalMemorySize(subDeviceId);
|
||||
ze_result_t result = pSysFsAccess->read(physicalSizeFile, memval);
|
||||
ze_result_t result = pSysFsAccess->read(std::move(physicalSizeFile), memval);
|
||||
uint64_t intval = strtoull(memval.c_str(), nullptr, 16);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
pProperties->physicalSize = 0u;
|
||||
@@ -176,16 +176,16 @@ zes_freq_throttle_reason_flags_t SysmanProductHelperHw<gfxProduct>::getThrottleR
|
||||
std::string throttleReasonPL4File = pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNameThrottleReasonPL4, subdeviceId, baseDirectoryExists);
|
||||
std::string throttleReasonThermalFile = pSysmanKmdInterface->getSysfsFilePath(SysfsName::sysfsNameThrottleReasonThermal, subdeviceId, baseDirectoryExists);
|
||||
|
||||
if ((ZE_RESULT_SUCCESS == pSysfsAccess->read(throttleReasonPL1File, val)) && val) {
|
||||
if ((ZE_RESULT_SUCCESS == pSysfsAccess->read(std::move(throttleReasonPL1File), val)) && val) {
|
||||
throttleReasons |= ZES_FREQ_THROTTLE_REASON_FLAG_AVE_PWR_CAP;
|
||||
}
|
||||
if ((ZE_RESULT_SUCCESS == pSysfsAccess->read(throttleReasonPL2File, val)) && val) {
|
||||
if ((ZE_RESULT_SUCCESS == pSysfsAccess->read(std::move(throttleReasonPL2File), val)) && val) {
|
||||
throttleReasons |= ZES_FREQ_THROTTLE_REASON_FLAG_BURST_PWR_CAP;
|
||||
}
|
||||
if ((ZE_RESULT_SUCCESS == pSysfsAccess->read(throttleReasonPL4File, val)) && val) {
|
||||
if ((ZE_RESULT_SUCCESS == pSysfsAccess->read(std::move(throttleReasonPL4File), val)) && val) {
|
||||
throttleReasons |= ZES_FREQ_THROTTLE_REASON_FLAG_CURRENT_LIMIT;
|
||||
}
|
||||
if ((ZE_RESULT_SUCCESS == pSysfsAccess->read(throttleReasonThermalFile, val)) && val) {
|
||||
if ((ZE_RESULT_SUCCESS == pSysfsAccess->read(std::move(throttleReasonThermalFile), val)) && val) {
|
||||
throttleReasons |= ZES_FREQ_THROTTLE_REASON_FLAG_THERMAL_LIMIT;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -157,7 +157,7 @@ ze_result_t getVFIDString(std::map<std::string, uint64_t> keyOffsetMap, std::str
|
||||
|
||||
uint32_t vf1VfIdVal = 0;
|
||||
key = "VF1_VFID";
|
||||
if (!PlatformMonitoringTech::readValue(keyOffsetMap, telemDir, key, telemOffset, vf1VfIdVal)) {
|
||||
if (!PlatformMonitoringTech::readValue(std::move(keyOffsetMap), telemDir, key, telemOffset, vf1VfIdVal)) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for VF1_VFID is returning error:0x%x \n", __FUNCTION__, ZE_RESULT_ERROR_NOT_AVAILABLE);
|
||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ ze_result_t getHBMBandwidth(zes_mem_bandwidth_t *pBandwidth, LinuxSysmanImp *pLi
|
||||
keyOffsetMap = keyOffsetMapEntry->second;
|
||||
|
||||
if (guid != guid64BitMemoryCounters) {
|
||||
return getHBMBandwidth(keyOffsetMap, pBandwidth, pLinuxSysmanImp, telemDir, telemOffset, subdeviceId, stepping);
|
||||
return getHBMBandwidth(std::move(keyOffsetMap), pBandwidth, pLinuxSysmanImp, telemDir, telemOffset, subdeviceId, stepping);
|
||||
}
|
||||
|
||||
pBandwidth->readCounter = 0;
|
||||
|
||||
@@ -184,7 +184,7 @@ ze_result_t SysmanProductHelperHw<gfxProduct>::getMemoryBandwidth(zes_mem_bandwi
|
||||
}
|
||||
keyOffsetMap = keyOffsetMapEntry->second;
|
||||
|
||||
result = readMcChannelCounters(keyOffsetMap, pBandwidth->readCounter, pBandwidth->writeCounter, telemDir, telemOffset);
|
||||
result = readMcChannelCounters(std::move(keyOffsetMap), pBandwidth->readCounter, pBandwidth->writeCounter, std::move(telemDir), telemOffset);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readMcChannelCounters returning error:0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
@@ -214,7 +214,7 @@ ze_result_t SysmanProductHelperHw<gfxProduct>::getPowerEnergyCounter(zes_power_e
|
||||
}
|
||||
|
||||
std::map<std::string, uint64_t> keyOffsetMap;
|
||||
if (!PlatformMonitoringTech::getKeyOffsetMap(this, guid, keyOffsetMap)) {
|
||||
if (!PlatformMonitoringTech::getKeyOffsetMap(this, std::move(guid), keyOffsetMap)) {
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ ze_result_t SysmanProductHelperHw<gfxProduct>::getVfLocalMemoryQuota(SysFsAccess
|
||||
const std::string pathForLmemQuota = "/gt/lmem_quota";
|
||||
std::string pathForDeviceMemQuota = "iov/vf" + std::to_string(vfId) + pathForLmemQuota;
|
||||
|
||||
auto result = pSysfsAccess->read(pathForDeviceMemQuota, lMemQuota);
|
||||
auto result = pSysfsAccess->read(std::move(pathForDeviceMemQuota), lMemQuota);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Failed to read Local Memory Quota with error 0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
|
||||
@@ -416,7 +416,7 @@ SysFsAccessInterface::SysFsAccessInterface(const std::string dev) {
|
||||
std::string fileName = FsAccessInterface::getBaseName(dev);
|
||||
std::string devicesDir = drmPath + fileName + std::string("/") + devicesPath;
|
||||
|
||||
FsAccessInterface::listDirectory(devicesDir, deviceNames);
|
||||
FsAccessInterface::listDirectory(std::move(devicesDir), deviceNames);
|
||||
for (auto &&next : deviceNames) {
|
||||
if (!next.compare(0, primaryDevName.length(), primaryDevName)) {
|
||||
dirname = drmPath + next + std::string("/");
|
||||
|
||||
Reference in New Issue
Block a user