Class: Babeltrace::Context

Inherits:
FFI::ManagedStruct
  • Object
show all
Defined in:
lib/babeltrace/context.rb,
lib/babeltrace/format.rb

Overview

< ManagedStruct

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr = Babeltrace.bt_context_create) ⇒ Context

Returns a new instance of Context.



4
5
6
# File 'lib/babeltrace/context.rb', line 4

def initialize(ptr = Babeltrace.bt_context_create)
  super(ptr)
end

Class Method Details

.release(ptr) ⇒ Object



8
9
10
# File 'lib/babeltrace/context.rb', line 8

def self.release(ptr)
  Babeltrace.bt_context_put(ptr)
end

Instance Method Details

#add_trace(path:, format: "ctf") ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/babeltrace/context.rb', line 12

def add_trace(path:, format: "ctf")
  handle_id = Babeltrace.bt_context_add_trace(self, path, format, nil, nil, nil)
  case format
  when "ctf"
    return CTF::Trace::new(self, handle_id)
  else
    return Trace::new(self, handle_id)
  end
end

#remove_trace(trace_id) ⇒ Object



22
23
24
# File 'lib/babeltrace/context.rb', line 22

def remove_trace(trace_id)
  Babeltrace.bt_context_remove_trace(self, trace_id)
end