| 1 |
/* |
| 2 |
* Copyright (C) 2019-2023 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include "shared/source/helpers/debug_helpers.h" |
| 11 |
|
| 12 |
#include "opencl/source/tracing/tracing_types.h" |
| 13 |
|
| 14 |
#include <bitset> |
| 15 |
#include <stdint.h> |
| 16 |
|
| 17 |
namespace HostSideTracing { |
| 18 |
|
| 19 |
struct TracingHandle { |
| 20 |
public: |
| 21 |
TracingHandle(cl_tracing_callback callback, void *userData) : callback(callback), userData(userData) {} |
| 22 |
|
| 23 |
void call(ClFunctionId fid, cl_callback_data *callbackData) { |
| 24 |
callback(fid, callbackData, userData); |
| 25 |
} |
| 26 |
|
| 27 |
void setTracingPoint(ClFunctionId fid, bool enable) { |
| 28 |
DEBUG_BREAK_IF(static_cast<uint32_t>(fid) >= CL_FUNCTION_COUNT); |
| 29 |
mask[static_cast<uint32_t>(fid)] = enable; |
| 30 |
} |
| 31 |
|
| 32 |
bool getTracingPoint(ClFunctionId fid) const { |
| 33 |
DEBUG_BREAK_IF(static_cast<uint32_t>(fid) >= CL_FUNCTION_COUNT); |
| 34 |
return mask[static_cast<uint32_t>(fid)]; |
| 35 |
} |
| 36 |
|
| 37 |
private: |
| 38 |
cl_tracing_callback callback; |
| 39 |
void *userData; |
| 40 |
std::bitset<CL_FUNCTION_COUNT> mask; |
| 41 |
}; |
| 42 |
|
| 43 |
} // namespace HostSideTracing |
| 44 |
|
| 45 |
struct _cl_tracing_handle { |
| 46 |
cl_device_id device; |
| 47 |
HostSideTracing::TracingHandle *handle; |
| 48 |
}; |