29package com.jogamp.opencl;
31import com.jogamp.opencl.impl.CLTLInfoAccessor;
32import com.jogamp.opencl.llb.CL;
33import com.jogamp.opencl.llb.impl.CLEventCallback;
34import com.jogamp.common.nio.PointerBuffer;
35import java.nio.Buffer;
37import static com.jogamp.opencl.llb.CL.*;
38import static com.jogamp.opencl.CLException.*;
48public class CLEvent extends CLObjectResource {
50 private final CLEventInfoAccessor eventInfo;
51 private final CLEventProfilingInfoAccessor eventProfilingInfo;
52 private final CL binding;
57 this.eventInfo =
new CLEventInfoAccessor();
58 this.eventProfilingInfo =
new CLEventProfilingInfoAccessor();
71 @Override
public void eventStateChanged(
final long event,
final int status) {
81 checkForError(ret,
"can not release event");
99 return (
int)eventInfo.getLong(CL_EVENT_COMMAND_EXECUTION_STATUS);
103 final int status = (int)eventInfo.getLong(CL_EVENT_COMMAND_TYPE);
108 return eventProfilingInfo.getLong(command.
COMMAND);
114 return getClass().getSimpleName()+
" [id: " +
ID
120 public boolean equals(
final Object obj) {
124 if (getClass() != obj.getClass()) {
128 if (this.context != other.
context && (
this.context ==
null || !
this.context.equals(other.
context))) {
131 if (this.
ID != other.
ID) {
140 hash = 13 * hash + (this.context !=
null ? this.context.
hashCode() : 0);
141 hash = 13 * hash + (int) (this.
ID ^ (this.
ID >>> 32));
150 protected int getInfo(
final int name,
final long valueSize,
final Buffer value,
final PointerBuffer valueSizeRet) {
156 private class CLEventProfilingInfoAccessor
extends CLTLInfoAccessor {
159 protected int getInfo(
final int name,
final long valueSize,
final Buffer value,
final PointerBuffer valueSizeRet) {
192 END(CL_PROFILING_COMMAND_END);
200 this.COMMAND = command;
205 case(CL_PROFILING_COMMAND_QUEUED):
207 case(CL_PROFILING_COMMAND_SUBMIT):
209 case(CL_PROFILING_COMMAND_START):
211 case(CL_PROFILING_COMMAND_END):
256 this.STATUS = status;
314 if(value.TYPE == commandType)
CLContext is responsible for managing objects such as command-queues, memory, program and kernel obje...
CLPlatform getPlatform()
Returns the CLPlatform this context is running on.
Event objects can be used for synchronizing command queues, e.g you can wait until a event occurs or ...
boolean equals(final Object obj)
long getProfilingInfo(final ProfilingCommand command)
ExecutionStatus getStatus()
Returns the execution status of the command which triggers this event.
boolean isComplete()
Returns true only if getStatus returns ExecutionStatus#COMPLETE.
void registerCallback(final CLEventListener callback)
Registers a callback which will be called when the event terminates (COMPLETE or ERROR).
void release()
Releases the OpenCL resource.
final long ID
The OpenCL object handle.
Internal utility for common OpenCL clGetFooInfo calls.
static CommandType valueOf(final int commandType)
final int TYPE
Value of wrapped OpenCL command type.
RUNNING
Device is currently executing this command.
static ExecutionStatus valueOf(final int status)
QUEUED
Command has been enqueued in the command-queue.
ERROR
The command did not complete because of an error.
SUBMITTED
Enqueued command has been submitted by the host to the device associated with the command-queue.
COMPLETE
The command has completed.
final int STATUS
Value of wrapped OpenCL command execution status.
START
A 64-bit value that describes the current device time counter in nanoseconds when the command identif...
SUBMIT
A 64-bit value that describes the current device time counter in nanoseconds when the command identif...
final int COMMAND
Value of wrapped OpenCL profiling command.
QUEUED
A 64-bit value that describes the current device time counter in nanoseconds when the command identif...
static ProfilingCommand valueOf(final int status)
END
A 64-bit value that describes the current device time counter in nanoseconds when the command identif...
A callback for a specific command execution status.
void eventStateChanged(CLEvent event, int status)
Java bindings to OpenCL, the Open Computing Language.
int clGetEventInfo(long event, int param_name, long param_value_size, Buffer param_value, PointerBuffer param_value_size_ret)
Interface to C language function: cl_int {@native clGetEventInfo}(cl_event event,...
int clGetEventProfilingInfo(long event, int param_name, long param_value_size, Buffer param_value, PointerBuffer param_value_size_ret)
Interface to C language function: cl_int {@native clGetEventProfilingInfo}(cl_event event,...
int clReleaseEvent(long event)
Interface to C language function: cl_int {@native clReleaseEvent}(cl_event event)
int clSetEventCallback(long event, int type, CLEventCallback cb)
Interface to C language function: int32_t {@native clSetEventCallback}(cl_event event,...
A callback for a specific command execution status.