Exemplo n.º 1
0
hard_event::hard_event(command_queue &q, cl_command_type command,
                       const ref_vector<event> &deps, action action) :
   event(q.context(), deps, profile(q, action), [](event &ev){}),
   _queue(q), _command(command), _fence(NULL) {
   if (q.profiling_enabled())
      _time_queued = timestamp::current(q);

   q.sequence(*this);
   trigger();
}
Exemplo n.º 2
0
event::action
hard_event::profile(command_queue &q, const action &action) const {
   if (q.profiling_enabled()) {
      return [&q, action] (event &ev) {
         auto &hev = static_cast<hard_event &>(ev);

         hev._time_submit = timestamp::current(q);
         hev._time_start = timestamp::query(q);

         action(ev);

         hev._time_end = timestamp::query(q);
      };

   } else {
      return action;
   }
}