2 // Copyright (c) 2018 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #include "ocl_user_event.h"
20 using namespace cldnn::gpu;
22 void user_event::set_impl()
24 //we simulate "wrapper_cast" here to cast from cl::Event to cl::UserEvent which both wrap the same cl_event
25 //casting is valid as long as cl::UserEvent does not add any members to cl::Event (which it shouldn't)
26 static_assert(sizeof(cl::UserEvent) == sizeof(cl::Event) && alignof(cl::UserEvent) == alignof(cl::Event), "cl::UserEvent does not match cl::Event");
27 static_cast<cl::UserEvent&&>(get()).setStatus(CL_COMPLETE);
28 _duration = std::unique_ptr<cldnn::instrumentation::profiling_period_basic>(
29 new cldnn::instrumentation::profiling_period_basic(_timer.uptime()));
33 bool user_event::get_profiling_info_impl(std::list<cldnn_profiling_interval>& info) {
34 if (_duration == nullptr)
39 info.push_back({ "duration", static_cast<uint64_t>(_duration->value().count()) });