Class: OpenCL::Event
- Inherits:
-
ExtendedStruct
- Object
- ManagedStruct
- ExtendedStruct
- OpenCL::Event
- Includes:
- OpenCL11
- Defined in:
- lib/opencl_ruby_ffi/Event.rb,
lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb
Overview
Maps the cl_event object
Defined Under Namespace
Modules: OpenCL11
Constant Summary collapse
- COMMAND_QUEUE =
0x11D0
- COMMAND_TYPE =
0x11D1
- REFERENCE_COUNT =
0x11D2
- COMMAND_EXECUTION_STATUS =
0x11D3
- CONTEXT =
0x11D4
Instance Method Summary collapse
-
#command_execution_status ⇒ Object
Returns a CommandExecutionStatus corresponding to the status of the command associtated with the Event.
-
#command_queue ⇒ Object
Returns the CommandQueue associated with the Event, if it exists.
-
#command_type ⇒ Object
Returns the OpenCL::Event::command_type info.
- #context ⇒ Object
-
#initialize(ptr, retain = true) ⇒ Event
constructor
Creates a new Event and retains it if specified and aplicable.
- #inspect ⇒ Object
-
#profiling_command_end ⇒ Object
Returns the date the command corresponding to Event ended.
-
#profiling_command_queued ⇒ Object
Returns the date the command corresponding to Event was queued.
-
#profiling_command_start ⇒ Object
Returns the date the command corresponding to Event started.
-
#profiling_command_submit ⇒ Object
Returns the date the command corresponding to Event was submited.
-
#reference_count ⇒ Object
Returns the OpenCL::Event::reference_count info.
Methods included from OpenCL11
#set_event_callback, #set_user_event_status
Methods inherited from ExtendedStruct
Constructor Details
#initialize(ptr, retain = true) ⇒ Event
Creates a new Event and retains it if specified and aplicable
1496 1497 1498 1499 1500 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 1496 def initialize(ptr, retain = true) super(ptr) OpenCL.clRetainEvent(ptr) if retain #STDERR.puts "Allocating Event: #{ptr}" end |
Instance Method Details
#command_execution_status ⇒ Object
Returns a CommandExecutionStatus corresponding to the status of the command associtated with the Event
98 99 100 101 102 103 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 98 def command_execution_status ptr = MemoryPointer::new( :cl_int ) error = OpenCL.clGetEventInfo(self, COMMAND_EXECUTION_STATUS, ptr.size, ptr, nil ) error_check(error) return CommandExecutionStatus::new( ptr.read_cl_int ) end |
#command_queue ⇒ Object
Returns the CommandQueue associated with the Event, if it exists
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 79 def command_queue ptr = MemoryPointer::new( CommandQueue ) error = OpenCL.clGetEventInfo(self, COMMAND_QUEUE, CommandQueue.size, ptr, nil) error_check(error) pt = ptr.read_pointer if pt.null? then return nil else return CommandQueue::new( pt ) end end |
#command_type ⇒ Object
Returns the OpenCL::Event::command_type info
91 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 91 get_info("Event", :cl_command_type, "command_type") |
#context ⇒ Object
93 94 95 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 93 def context return command_queue.context end |
#inspect ⇒ Object
74 75 76 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 74 def inspect return "#<#{self.class.name}: #{command_type} (#{command_execution_status})>" end |
#profiling_command_end ⇒ Object
Returns the date the command corresponding to Event ended
132 133 134 135 136 137 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 132 def profiling_command_end ptr = MemoryPointer::new( :cl_ulong ) error = OpenCL.clGetEventProfilingInfo(self, PROFILING_COMMAND_END, ptr.size, ptr, nil ) error_check(error) return ptr.read_cl_ulong end |
#profiling_command_queued ⇒ Object
Returns the date the command corresponding to Event was queued
108 109 110 111 112 113 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 108 def profiling_command_queued ptr = MemoryPointer::new( :cl_ulong ) error = OpenCL.clGetEventProfilingInfo(self, PROFILING_COMMAND_QUEUED, ptr.size, ptr, nil ) error_check(error) return ptr.read_cl_ulong end |
#profiling_command_start ⇒ Object
Returns the date the command corresponding to Event started
124 125 126 127 128 129 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 124 def profiling_command_start ptr = MemoryPointer::new( :cl_ulong ) error = OpenCL.clGetEventProfilingInfo(self, PROFILING_COMMAND_START, ptr.size, ptr, nil ) error_check(error) return ptr.read_cl_ulong end |
#profiling_command_submit ⇒ Object
Returns the date the command corresponding to Event was submited
116 117 118 119 120 121 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 116 def profiling_command_submit ptr = MemoryPointer::new( :cl_ulong ) error = OpenCL.clGetEventProfilingInfo(self, PROFILING_COMMAND_SUBMIT, ptr.size, ptr, nil ) error_check(error) return ptr.read_cl_ulong end |
#reference_count ⇒ Object
Returns the OpenCL::Event::reference_count info
105 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 105 get_info("Event", :cl_uint, "reference_count") |