Files
compute-runtime/level_zero/tools/source/sysman/performance/performance.h
Bari, Pratik af2c61c54b feature(sysman): Added support for Performance APIs
Added support for the Performance APIs in the new sysman design.
Added ULTs for the Performance APIs in the new sysman design.
In the black box test for performance, the API to compute the number
of sub devices has been changed in order to get the sub device count
regardless of the sysman initialization using zeInit or zesInit.

Related-To: LOCI-4294

Signed-off-by: Bari, Pratik <pratik.bari@intel.com>
2023-05-16 06:59:29 +02:00

52 lines
1.4 KiB
C++

/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "level_zero/api/sysman/zes_handles_struct.h"
#include "level_zero/core/source/device/device.h"
#include <level_zero/zes_api.h>
#include <mutex>
#include <vector>
namespace L0 {
struct OsSysman;
class Performance : _zes_perf_handle_t {
public:
~Performance() override {}
virtual ze_result_t performanceGetProperties(zes_perf_properties_t *pProperties) = 0;
virtual ze_result_t performanceGetConfig(double *pFactor) = 0;
virtual ze_result_t performanceSetConfig(double pFactor) = 0;
inline zes_perf_handle_t toPerformanceHandle() { return this; }
static Performance *fromHandle(zes_perf_handle_t handle) {
return static_cast<Performance *>(handle);
}
bool isPerformanceEnabled = false;
};
struct PerformanceHandleContext {
PerformanceHandleContext(OsSysman *pOsSysman) : pOsSysman(pOsSysman){};
~PerformanceHandleContext();
ze_result_t init(std::vector<ze_device_handle_t> &deviceHandles, ze_device_handle_t coreDevice);
ze_result_t performanceGet(uint32_t *pCount, zes_perf_handle_t *phPerformance);
OsSysman *pOsSysman = nullptr;
std::vector<std::unique_ptr<Performance>> handleList = {};
private:
void createHandle(ze_device_handle_t deviceHandle, zes_engine_type_flag_t domain);
std::once_flag initPerformanceOnce;
};
} // namespace L0