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_id ⇒ Object (also: #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
265 266 267 268 269 270 271 272 |
# File 'lib/babeltrace/ctf/events.rb', line 265 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
234 235 236 |
# File 'lib/babeltrace/ctf/events.rb', line 234 def event_name CTF.bt_ctf_event_name(self) end |
#find_field(field, scope = :EVENT_FIELDS) ⇒ Object
274 275 276 277 278 |
# File 'lib/babeltrace/ctf/events.rb', line 274 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
216 217 218 219 220 |
# File 'lib/babeltrace/ctf/events.rb', line 216 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
239 240 241 |
# File 'lib/babeltrace/ctf/events.rb', line 239 def get_cycles CTF.bt_ctf_get_cycles(self) end |
#get_field(scope, field) ⇒ Object
260 261 262 263 |
# File 'lib/babeltrace/ctf/events.rb', line 260 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
249 250 251 252 253 254 255 256 257 |
# File 'lib/babeltrace/ctf/events.rb', line 249 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
223 224 225 |
# File 'lib/babeltrace/ctf/events.rb', line 223 def get_handle_id CTF.bt_ctf_event_get_handle_id(self) end |
#get_id ⇒ Object Also known as: id
208 209 210 211 212 213 |
# File 'lib/babeltrace/ctf/events.rb', line 208 def get_id defi = self.top_level_scope(:STREAM_EVENT_HEADER).value id = defi["id"][0] id = defi["v"]["id"] if id == 65535 id end |
#get_index(field, index) ⇒ Object
280 281 282 283 |
# File 'lib/babeltrace/ctf/events.rb', line 280 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
244 245 246 |
# File 'lib/babeltrace/ctf/events.rb', line 244 def Time.at(0, CTF.(self), :nsec) end |
#get_top_level_scope(scope) ⇒ Object Also known as: top_level_scope
228 229 230 231 |
# File 'lib/babeltrace/ctf/events.rb', line 228 def get_top_level_scope(scope) d = CTF.bt_ctf_get_top_level_scope(self, scope) Definition.create(d) end |