Class: Babeltrace::CTF::Event
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Babeltrace::CTF::Event
- Defined in:
- lib/babeltrace/ctf/events.rb,
lib/babeltrace/ctf/callbacks.rb
Instance Method Summary collapse
- #each_field(scope = :EVENT_FIELDS) ⇒ Object
- #event_name ⇒ Object (also: #name)
- #find_field(field, scope = :EVENT_FIELDS) ⇒ Object
- #get_context ⇒ Object (also: #context)
- #get_cycles ⇒ Object (also: #cycles)
- #get_field(scope, field) ⇒ Object
- #get_field_list(scope) ⇒ Object (also: #field_list)
- #get_handle_id ⇒ Object (also: #handle_id)
- #get_index(field, index) ⇒ Object
- #get_timestamp ⇒ Object (also: #timestamp)
- #get_top_level_scope(scope) ⇒ Object (also: #top_level_scope)
Instance Method Details
#each_field(scope = :EVENT_FIELDS) ⇒ Object
251 252 253 254 255 256 257 258 |
# File 'lib/babeltrace/ctf/events.rb', line 251 def each_field(scope = :EVENT_FIELDS) if block_given? sc = self.top_level_scope(scope) self.field_list(sc).each { |f| yield f } else return to_enum(:each_field, scope) end end |
#event_name ⇒ Object Also known as: name
220 221 222 |
# File 'lib/babeltrace/ctf/events.rb', line 220 def event_name CTF.bt_ctf_event_name(self) end |
#find_field(field, scope = :EVENT_FIELDS) ⇒ Object
260 261 262 263 264 |
# File 'lib/babeltrace/ctf/events.rb', line 260 def find_field(field, scope = :EVENT_FIELDS) sc = self.top_level_scope(scope) d = get_field(sc, field) Definition.create(d) end |
#get_context ⇒ Object Also known as: context
202 203 204 205 206 |
# File 'lib/babeltrace/ctf/events.rb', line 202 def get_context c = CTF.bt_ctf_event_get_context(self) Babeltrace.bt_context_get(c) c end |
#get_cycles ⇒ Object Also known as: cycles
225 226 227 |
# File 'lib/babeltrace/ctf/events.rb', line 225 def get_cycles CTF.bt_ctf_get_cycles(self) end |
#get_field(scope, field) ⇒ Object
246 247 248 249 |
# File 'lib/babeltrace/ctf/events.rb', line 246 def get_field(scope, field) d = CTF.bt_ctf_get_field(self, scope.definition, field) Definition.create(d) end |
#get_field_list(scope) ⇒ Object Also known as: field_list
235 236 237 238 239 240 241 242 243 |
# File 'lib/babeltrace/ctf/events.rb', line 235 def get_field_list(scope) count = FFI::MemoryPointer::new(:uint) list = FFI::MemoryPointer::new(:pointer) res = CTF.bt_ctf_get_field_list(self, scope.definition, list, count) count = count.read(:uint) return [] if count == 0 list = list.read_pointer.read_array_of_pointer(count) list.collect { |p| Internal::Definition::new(p) }.collect { |d| Definition.create(d) } end |
#get_handle_id ⇒ Object Also known as: handle_id
209 210 211 |
# File 'lib/babeltrace/ctf/events.rb', line 209 def get_handle_id CTF.bt_ctf_event_get_handle_id(self) end |
#get_index(field, index) ⇒ Object
266 267 268 269 |
# File 'lib/babeltrace/ctf/events.rb', line 266 def get_index(field, index) d = CTF.bt_ctf_get_index(self, field.definition, index) Definition.create(d) end |
#get_timestamp ⇒ Object Also known as: timestamp
230 231 232 |
# File 'lib/babeltrace/ctf/events.rb', line 230 def Time.at(0, CTF.(self), :nsec) end |
#get_top_level_scope(scope) ⇒ Object Also known as: top_level_scope
214 215 216 217 |
# File 'lib/babeltrace/ctf/events.rb', line 214 def get_top_level_scope(scope) d = CTF.bt_ctf_get_top_level_scope(self, scope) Definition.create(d) end |