Files
compute-runtime/runtime/tracing/tracing_handle.h
Anton V. Gorshkov b26650c7b0 Added host-side API tracing support
Change-Id: Id473243344d76e58e326c5a1cb487c57cf5c736c
Signed-off-by: Anton V Gorshkov <anton.v.gorshkov@intel.com>
2019-06-11 08:02:58 +02:00

48 lines
1.1 KiB
C++

/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "runtime/helpers/debug_helpers.h"
#include "runtime/tracing/tracing_types.h"
#include <bitset>
#include <stdint.h>
namespace HostSideTracing {
struct TracingHandle {
public:
TracingHandle(cl_tracing_callback callback, void *userData) : callback(callback), userData(userData) {}
void call(cl_function_id fid, cl_callback_data *callbackData) {
callback(fid, callbackData, userData);
}
void setTracingPoint(cl_function_id fid, bool enable) {
DEBUG_BREAK_IF(static_cast<uint32_t>(fid) >= CL_FUNCTION_COUNT);
mask[static_cast<uint32_t>(fid)] = enable;
}
bool getTracingPoint(cl_function_id fid) const {
DEBUG_BREAK_IF(static_cast<uint32_t>(fid) >= CL_FUNCTION_COUNT);
return mask[static_cast<uint32_t>(fid)];
}
private:
cl_tracing_callback callback;
void *userData;
std::bitset<CL_FUNCTION_COUNT> mask;
};
} // namespace HostSideTracing
struct _cl_tracing_handle {
cl_device_id device;
HostSideTracing::TracingHandle *handle;
};