mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 17:13:29 +08:00
Change-Id: Ia8558ab30c83f1e30dae94cc7eb489ea7a8897da Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
/*
|
|
* Copyright (C) 2020 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/helpers/basic_math.h"
|
|
|
|
#include "level_zero/tools/source/sysman/scheduler/scheduler_imp.h"
|
|
|
|
namespace L0 {
|
|
|
|
SchedulerHandleContext::~SchedulerHandleContext() {
|
|
for (Scheduler *pScheduler : handleList) {
|
|
delete pScheduler;
|
|
}
|
|
}
|
|
|
|
void SchedulerHandleContext::init() {
|
|
Scheduler *pScheduler = new SchedulerImp(pOsSysman);
|
|
if (pScheduler->initSuccess == true) {
|
|
handleList.push_back(pScheduler);
|
|
} else {
|
|
delete pScheduler;
|
|
}
|
|
}
|
|
|
|
ze_result_t SchedulerHandleContext::schedulerGet(uint32_t *pCount, zes_sched_handle_t *phScheduler) {
|
|
uint32_t handleListSize = static_cast<uint32_t>(handleList.size());
|
|
uint32_t numToCopy = std::min(*pCount, handleListSize);
|
|
if (0 == *pCount || *pCount > handleListSize) {
|
|
*pCount = handleListSize;
|
|
}
|
|
if (nullptr != phScheduler) {
|
|
for (uint32_t i = 0; i < numToCopy; i++) {
|
|
phScheduler[i] = handleList[i]->toHandle();
|
|
}
|
|
}
|
|
return ZE_RESULT_SUCCESS;
|
|
}
|
|
|
|
} // namespace L0
|