fix(sysman): Replace normal pointers with smart pointers (14/n)

Replacing normal pointers by smart pointers in performance module of L0 sysman.

Related-To: LOCI-2810

Signed-off-by: Singh, Prasoon <prasoon.singh@intel.com>
This commit is contained in:
Singh, Prasoon
2023-05-02 06:06:48 +00:00
committed by Compute-Runtime-Automation
parent 26a2a2829e
commit 531779ffaf
11 changed files with 45 additions and 83 deletions

View File

@@ -16,21 +16,13 @@
namespace L0 {
PerformanceHandleContext::~PerformanceHandleContext() {
for (auto &pPerformance : handleList) {
if (pPerformance) {
delete pPerformance;
pPerformance = nullptr;
}
handleList.pop_back();
}
handleList.clear();
}
void PerformanceHandleContext::createHandle(ze_device_handle_t deviceHandle, zes_engine_type_flag_t domain) {
Performance *pPerformance = new PerformanceImp(pOsSysman, deviceHandle, domain);
std::unique_ptr<Performance> pPerformance = std::make_unique<PerformanceImp>(pOsSysman, deviceHandle, domain);
if (pPerformance->isPerformanceEnabled == true) {
handleList.push_back(pPerformance);
} else {
delete pPerformance;
handleList.push_back(std::move(pPerformance));
}
}