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
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
-
#platform ⇒ Object
Returns the Platform associated with the Event.
-
#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
1565 1566 1567 1568 1569 |
# File 'lib/opencl_ruby_ffi/opencl_ruby_ffi_base_gen.rb', line 1565 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
105 106 107 108 109 110 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 105 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 90 91 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 79 def command_queue @_command_queue ||= begin 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 nil else CommandQueue::new( pt ) end end end |
#command_type ⇒ Object
Returns the OpenCL::Event::command_type info
93 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 93 get_info("Event", :cl_command_type, "command_type", true) |
#context ⇒ Object
95 96 97 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 95 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 |
#platform ⇒ Object
Returns the Platform associated with the Event
100 101 102 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 100 def platform @_platform ||= self.context.platform end |
#profiling_command_end ⇒ Object
Returns the date the command corresponding to Event ended
139 140 141 142 143 144 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 139 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
115 116 117 118 119 120 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 115 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
131 132 133 134 135 136 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 131 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
123 124 125 126 127 128 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 123 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
112 |
# File 'lib/opencl_ruby_ffi/Event.rb', line 112 get_info("Event", :cl_uint, "reference_count") |
Constant Summary collapse
- COMMAND_QUEUE =
0x11D0
- COMMAND_TYPE =
0x11D1
- REFERENCE_COUNT =
0x11D2
- COMMAND_EXECUTION_STATUS =
0x11D3
- CONTEXT =
0x11D4