babeltrace2 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/babeltrace2.gemspec +13 -0
- data/lib/babeltrace2.rb +49 -0
- data/lib/babeltrace2/error-reporting.rb +432 -0
- data/lib/babeltrace2/func-status.rb +26 -0
- data/lib/babeltrace2/graph/component-class-dev.rb +801 -0
- data/lib/babeltrace2/graph/component-class.rb +134 -0
- data/lib/babeltrace2/graph/component-descriptor-set.rb +78 -0
- data/lib/babeltrace2/graph/component.rb +362 -0
- data/lib/babeltrace2/graph/connection.rb +35 -0
- data/lib/babeltrace2/graph/graph.rb +523 -0
- data/lib/babeltrace2/graph/interrupter.rb +57 -0
- data/lib/babeltrace2/graph/message-iterator-class.rb +374 -0
- data/lib/babeltrace2/graph/message-iterator.rb +253 -0
- data/lib/babeltrace2/graph/message.rb +721 -0
- data/lib/babeltrace2/graph/port.rb +124 -0
- data/lib/babeltrace2/graph/private-query-executor.rb +4 -0
- data/lib/babeltrace2/graph/query-executor.rb +142 -0
- data/lib/babeltrace2/graph/self-component-class.rb +37 -0
- data/lib/babeltrace2/graph/self-component-port.rb +35 -0
- data/lib/babeltrace2/graph/self-component.rb +264 -0
- data/lib/babeltrace2/graph/self-message-iterator.rb +147 -0
- data/lib/babeltrace2/integer-range-set.rb +275 -0
- data/lib/babeltrace2/logging-defs.rb +19 -0
- data/lib/babeltrace2/logging.rb +77 -0
- data/lib/babeltrace2/plugin/plugin-dev.rb +335 -0
- data/lib/babeltrace2/plugin/plugin-loading.rb +459 -0
- data/lib/babeltrace2/trace-ir/clock-class.rb +258 -0
- data/lib/babeltrace2/trace-ir/clock-snapshot.rb +45 -0
- data/lib/babeltrace2/trace-ir/event-class.rb +292 -0
- data/lib/babeltrace2/trace-ir/event.rb +91 -0
- data/lib/babeltrace2/trace-ir/field-class.rb +1416 -0
- data/lib/babeltrace2/trace-ir/field-path.rb +123 -0
- data/lib/babeltrace2/trace-ir/field.rb +871 -0
- data/lib/babeltrace2/trace-ir/packet.rb +57 -0
- data/lib/babeltrace2/trace-ir/stream-class.rb +425 -0
- data/lib/babeltrace2/trace-ir/stream.rb +137 -0
- data/lib/babeltrace2/trace-ir/trace-class.rb +343 -0
- data/lib/babeltrace2/trace-ir/trace.rb +321 -0
- data/lib/babeltrace2/types.rb +667 -0
- data/lib/babeltrace2/util.rb +23 -0
- data/lib/babeltrace2/value.rb +869 -0
- data/lib/babeltrace2/version.rb +126 -0
- metadata +105 -0
@@ -0,0 +1,124 @@
|
|
1
|
+
module Babeltrace2
|
2
|
+
|
3
|
+
BT_PORT_TYPE_INPUT = 1 << 0
|
4
|
+
BT_PORT_TYPE_OUTPUT = 1 << 1
|
5
|
+
BTPortType = enum :bt_port_type,
|
6
|
+
[ :BT_PORT_TYPE_INPUT,
|
7
|
+
BT_PORT_TYPE_INPUT,
|
8
|
+
:BT_PORT_TYPE_OUTPUT,
|
9
|
+
BT_PORT_TYPE_OUTPUT ]
|
10
|
+
|
11
|
+
attach_function :bt_port_get_type,
|
12
|
+
[ :bt_port_handle ],
|
13
|
+
:bt_port_type
|
14
|
+
|
15
|
+
attach_function :bt_port_borrow_connection_const,
|
16
|
+
[ :bt_port_handle ],
|
17
|
+
:bt_connection_handle
|
18
|
+
|
19
|
+
attach_function :bt_port_borrow_component_const,
|
20
|
+
[ :bt_port_handle ],
|
21
|
+
:bt_component_handle
|
22
|
+
|
23
|
+
attach_function :bt_port_get_name,
|
24
|
+
[ :bt_port_handle ],
|
25
|
+
:string
|
26
|
+
|
27
|
+
attach_function :bt_port_is_connected,
|
28
|
+
[ :bt_port_handle ],
|
29
|
+
:bt_bool
|
30
|
+
|
31
|
+
attach_function :bt_port_get_ref,
|
32
|
+
[ :bt_port_handle ],
|
33
|
+
:void
|
34
|
+
|
35
|
+
attach_function :bt_port_put_ref,
|
36
|
+
[ :bt_port_handle ],
|
37
|
+
:void
|
38
|
+
|
39
|
+
class BTPort < BTSharedObject
|
40
|
+
Type = BTPortType
|
41
|
+
@get_ref = :bt_port_get_ref
|
42
|
+
@put_ref = :bt_port_put_ref
|
43
|
+
|
44
|
+
def self.from_handle(handle, retain: true, auto_release: true)
|
45
|
+
case Babeltrace2.bt_port_get_type(handle)
|
46
|
+
when :BT_PORT_TYPE_INPUT
|
47
|
+
handle = BTPortInputHandle.new(handle)
|
48
|
+
BTPortInput
|
49
|
+
when :BT_PORT_TYPE_OUTPUT
|
50
|
+
handle = BTPortOuputHandle.new(handle)
|
51
|
+
BTPortOutput
|
52
|
+
else
|
53
|
+
raise Error.new("Unknown port type")
|
54
|
+
end.new(handle, retain: retain, auto_release: auto_release)
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_type
|
58
|
+
Babeltrace2.bt_port_get_type(@handle)
|
59
|
+
end
|
60
|
+
alias type get_type
|
61
|
+
|
62
|
+
def is_input
|
63
|
+
get_type == :BT_PORT_TYPE_INPUT
|
64
|
+
end
|
65
|
+
alias input? is_input
|
66
|
+
|
67
|
+
def is_output
|
68
|
+
get_type == :BT_PORT_TYPE_OUTPUT
|
69
|
+
end
|
70
|
+
alias output? is_output
|
71
|
+
|
72
|
+
def get_connection
|
73
|
+
handle = Babeltrace2.bt_port_borrow_connection_const(@handle)
|
74
|
+
return nil if handle.null?
|
75
|
+
BTConnection.new(handle, retain: true, auto_release: true)
|
76
|
+
end
|
77
|
+
alias connection get_connection
|
78
|
+
|
79
|
+
def get_component
|
80
|
+
handle = Babeltrace2.bt_port_borrow_component_const(@handle)
|
81
|
+
BTComponent.from_handle(handle)
|
82
|
+
end
|
83
|
+
alias component get_component
|
84
|
+
|
85
|
+
def get_name
|
86
|
+
Babeltrace2.bt_port_get_name(@handle)
|
87
|
+
end
|
88
|
+
alias name get_name
|
89
|
+
|
90
|
+
def is_connected
|
91
|
+
Babeltrace2.bt_port_is_connected(@handle) != BT_FALSE
|
92
|
+
end
|
93
|
+
alias connected? is_connected
|
94
|
+
end
|
95
|
+
|
96
|
+
attach_function :bt_port_input_get_ref,
|
97
|
+
[ :bt_port_input_handle ],
|
98
|
+
:void
|
99
|
+
|
100
|
+
attach_function :bt_port_input_put_ref,
|
101
|
+
[ :bt_port_input_handle ],
|
102
|
+
:void
|
103
|
+
|
104
|
+
class BTPort::Input < BTPort
|
105
|
+
@get_ref = :bt_port_input_get_ref
|
106
|
+
@put_ref = :bt_port_input_put_ref
|
107
|
+
end
|
108
|
+
BTPortInput = BTPort::Input
|
109
|
+
|
110
|
+
attach_function :bt_port_output_get_ref,
|
111
|
+
[ :bt_port_output_handle ],
|
112
|
+
:void
|
113
|
+
|
114
|
+
attach_function :bt_port_output_put_ref,
|
115
|
+
[ :bt_port_output_handle ],
|
116
|
+
:void
|
117
|
+
|
118
|
+
class BTPort::Output < BTPort
|
119
|
+
@get_ref = :bt_port_output_get_ref
|
120
|
+
@put_ref = :bt_port_output_put_ref
|
121
|
+
end
|
122
|
+
BTPortOutput = BTPort::Output
|
123
|
+
|
124
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
module Babeltrace2
|
2
|
+
|
3
|
+
attach_function :bt_query_executor_create,
|
4
|
+
[ :bt_component_class_handle,
|
5
|
+
:string, :bt_value_handle ],
|
6
|
+
:bt_query_executor_handle
|
7
|
+
|
8
|
+
attach_function :bt_query_executor_create_with_method_data,
|
9
|
+
[ :bt_component_class_handle,
|
10
|
+
:string, :bt_value_handle, :pointer ],
|
11
|
+
:bt_query_executor_handle
|
12
|
+
|
13
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_OK = BT_FUNC_STATUS_OK
|
14
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_UNKNOWN_OBJECT = BT_FUNC_STATUS_UNKNOWN_OBJECT
|
15
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
16
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
17
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
18
|
+
BTQueryExecutorQueryStatus = enum :bt_query_executor_query_status,
|
19
|
+
[ :BT_QUERY_EXECUTOR_QUERY_STATUS_OK,
|
20
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_OK,
|
21
|
+
:BT_QUERY_EXECUTOR_QUERY_STATUS_UNKNOWN_OBJECT,
|
22
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_UNKNOWN_OBJECT,
|
23
|
+
:BT_QUERY_EXECUTOR_QUERY_STATUS_AGAIN,
|
24
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_AGAIN,
|
25
|
+
:BT_QUERY_EXECUTOR_QUERY_STATUS_MEMORY_ERROR,
|
26
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_MEMORY_ERROR,
|
27
|
+
:BT_QUERY_EXECUTOR_QUERY_STATUS_ERROR,
|
28
|
+
BT_QUERY_EXECUTOR_QUERY_STATUS_ERROR ]
|
29
|
+
|
30
|
+
attach_function :bt_query_executor_query,
|
31
|
+
[ :bt_query_executor_handle,
|
32
|
+
:pointer ],
|
33
|
+
:bt_query_executor_query_status
|
34
|
+
|
35
|
+
BT_QUERY_EXECUTOR_SET_LOGGING_LEVEL_STATUS_OK = BT_FUNC_STATUS_OK
|
36
|
+
BTQueryExecutorSetLoggingLevelStatus = enum :bt_query_executor_set_logging_level_status,
|
37
|
+
[ :BT_QUERY_EXECUTOR_SET_LOGGING_LEVEL_STATUS_OK,
|
38
|
+
BT_QUERY_EXECUTOR_SET_LOGGING_LEVEL_STATUS_OK ]
|
39
|
+
|
40
|
+
attach_function :bt_query_executor_set_logging_level,
|
41
|
+
[ :bt_query_executor_handle,
|
42
|
+
:bt_logging_level ],
|
43
|
+
:bt_query_executor_set_logging_level_status
|
44
|
+
|
45
|
+
attach_function :bt_query_executor_get_logging_level,
|
46
|
+
[ :bt_query_executor_handle ],
|
47
|
+
:bt_logging_level
|
48
|
+
|
49
|
+
BT_QUERY_EXECUTOR_ADD_INTERRUPTER_STATUS_OK = BT_FUNC_STATUS_OK
|
50
|
+
BT_QUERY_EXECUTOR_ADD_INTERRUPTER_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
51
|
+
BTQueryExecutorAddInterrupterStatus = enum :bt_query_executor_add_interrupter_status,
|
52
|
+
[ :BT_QUERY_EXECUTOR_ADD_INTERRUPTER_STATUS_OK,
|
53
|
+
BT_QUERY_EXECUTOR_ADD_INTERRUPTER_STATUS_OK,
|
54
|
+
:BT_QUERY_EXECUTOR_ADD_INTERRUPTER_STATUS_MEMORY_ERROR,
|
55
|
+
BT_QUERY_EXECUTOR_ADD_INTERRUPTER_STATUS_MEMORY_ERROR ]
|
56
|
+
|
57
|
+
attach_function :bt_query_executor_add_interrupter,
|
58
|
+
[ :bt_query_executor_handle,
|
59
|
+
:bt_interrupter_handle ],
|
60
|
+
:bt_query_executor_add_interrupter_status
|
61
|
+
|
62
|
+
attach_function :bt_query_executor_borrow_default_interrupter,
|
63
|
+
[ :bt_query_executor_handle ],
|
64
|
+
:bt_interrupter_handle
|
65
|
+
|
66
|
+
attach_function :bt_query_executor_is_interrupted,
|
67
|
+
[ :bt_query_executor_handle ],
|
68
|
+
:bt_bool
|
69
|
+
|
70
|
+
attach_function :bt_query_executor_get_ref,
|
71
|
+
[ :bt_query_executor_handle ],
|
72
|
+
:void
|
73
|
+
|
74
|
+
attach_function :bt_query_executor_put_ref,
|
75
|
+
[ :bt_query_executor_handle ],
|
76
|
+
:void
|
77
|
+
|
78
|
+
class BTQueryExecutor < BTSharedObject
|
79
|
+
QueryStatus = BTQueryExecutorQueryStatus
|
80
|
+
SetLoggingLevelStatus = BTQueryExecutorSetLoggingLevelStatus
|
81
|
+
AddInterrupterStatus = BTQueryExecutorAddInterrupterStatus
|
82
|
+
@get_ref = :bt_query_executor_get_ref
|
83
|
+
@put_ref = :bt_query_executor_put_ref
|
84
|
+
|
85
|
+
def initialize(handle = nil, retain: true, auto_release: true,
|
86
|
+
component_class: nil, object_name: nil, params: nil, method_data: nil)
|
87
|
+
if handle
|
88
|
+
super(handle, retain: retain, auto_release: auto_release)
|
89
|
+
else
|
90
|
+
handle = Babeltrace2.bt_query_executor_create_with_method_data(
|
91
|
+
component_class, object_name, BTValue.from_value(params), method_data)
|
92
|
+
raise Babeltrace2.process_error if handle.null?
|
93
|
+
super(handle)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def query
|
98
|
+
ptr = FFI::MemoryPointer.new(:pointer)
|
99
|
+
while ((res = Babeltrace2.bt_query_executor_query(@handle, ptr)) == :BT_QUERY_EXECUTOR_QUERY_STATUS_AGAIN)
|
100
|
+
raise "interrupted by user" if interrupted?
|
101
|
+
sleep BT_SLEEP_TIME
|
102
|
+
end
|
103
|
+
raise Babeltrace2.process_error(res) if res != :BT_QUERY_EXECUTOR_QUERY_STATUS_OK
|
104
|
+
BTValue.from_handle(BTValueHandle.new(ptr.read_pointer), retain: false)
|
105
|
+
end
|
106
|
+
|
107
|
+
def set_logging_level(logging_level)
|
108
|
+
res = Babeltrace2.bt_query_executor_set_logging_level(@handle, logging_level)
|
109
|
+
raise Babeltrace2.process_error(res) if res != :BT_QUERY_EXECUTOR_SET_LOGGING_LEVEL_STATUS_OK
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
def logging_level=(logging_level)
|
114
|
+
res = Babeltrace2.bt_query_executor_set_logging_level(@handle, logging_level)
|
115
|
+
raise Babeltrace2.process_error(res) if res != :BT_QUERY_EXECUTOR_SET_LOGGING_LEVEL_STATUS_OK
|
116
|
+
return logging_level
|
117
|
+
end
|
118
|
+
|
119
|
+
def get_logging_level
|
120
|
+
Babeltrace2.bt_query_executor_get_logging_level(@handle)
|
121
|
+
end
|
122
|
+
alias logging_level get_logging_level
|
123
|
+
|
124
|
+
def add_interrupter(interrupter)
|
125
|
+
res = Babeltrace2.bt_query_executor_add_interrupter(@handle, interrupter)
|
126
|
+
raise Babeltrace2.process_error(res) if res != :BT_QUERY_EXECUTOR_ADD_INTERRUPTER_STATUS_OK
|
127
|
+
self
|
128
|
+
end
|
129
|
+
|
130
|
+
def get_default_interrupter
|
131
|
+
handle = Babeltrace2.bt_query_executor_borrow_default_interrupter(@handle)
|
132
|
+
BTInterrupter.new(handle, retain: true)
|
133
|
+
end
|
134
|
+
alias default_interrupter get_default_interrupter
|
135
|
+
|
136
|
+
def is_interrupted
|
137
|
+
Babeltrace2.bt_query_executor_is_interrupted(@handle) != BT_FALSE
|
138
|
+
end
|
139
|
+
alias interrupted? is_interrupted
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Babeltrace2
|
2
|
+
module BTSelfComponent
|
3
|
+
module Class
|
4
|
+
def self.from_handle(handle, retain: true, auto_release: true)
|
5
|
+
case Babeltrace2.bt_component_class_get_type(handle)
|
6
|
+
when :BT_COMPONENT_CLASS_TYPE_SOURCE
|
7
|
+
handle = BTSelfComponentClassSourceHandle.new(handle)
|
8
|
+
BTSelfComponentClassSource
|
9
|
+
when :BT_COMPONENT_CLASS_TYPE_FILTER
|
10
|
+
handle = BTSelfComponentClassFilterHandle.new(handle)
|
11
|
+
BTSelfComponentClassFilter
|
12
|
+
when :BT_COMPONENT_CLASS_TYPE_SINK
|
13
|
+
handle = BTSelfComponentClassSinkHandle.new(handle)
|
14
|
+
BTSelfComponentClassSink
|
15
|
+
else
|
16
|
+
raise Error.new("Unknown component class type")
|
17
|
+
end.new(handle, retain: retain, auto_release: auto_release)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
BTSelfComponentClass = BTSelfComponent::Class
|
22
|
+
|
23
|
+
class BTSelfComponent::Class::Source < BTComponentClassSource
|
24
|
+
include BTSelfComponent::Class
|
25
|
+
end
|
26
|
+
BTSelfComponentClassSource = BTSelfComponent::Class::Source
|
27
|
+
|
28
|
+
class BTSelfComponent::Class::Filter < BTComponentClassFilter
|
29
|
+
include BTSelfComponent::Class
|
30
|
+
end
|
31
|
+
BTSelfComponentClassFilter = BTSelfComponent::Class::Filter
|
32
|
+
|
33
|
+
class BTSelfComponent::Class::Sink < BTComponentClassSink
|
34
|
+
include BTSelfComponent::Class
|
35
|
+
end
|
36
|
+
BTSelfComponentClassSink = BTSelfComponent::Class::Sink
|
37
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Babeltrace2
|
2
|
+
|
3
|
+
attach_function :bt_self_component_port_borrow_component,
|
4
|
+
[ :bt_self_component_port_handle ],
|
5
|
+
:bt_self_component_handle
|
6
|
+
|
7
|
+
attach_function :bt_self_component_port_get_data,
|
8
|
+
[ :bt_self_component_port_handle ],
|
9
|
+
:pointer
|
10
|
+
|
11
|
+
module BTSelfComponent
|
12
|
+
module Port
|
13
|
+
def get_component
|
14
|
+
handle = Babeltrace2.bt_self_component_port_borrow_component(@handle)
|
15
|
+
BTSelfComponent.from_handle(handle)
|
16
|
+
end
|
17
|
+
alias component get_component
|
18
|
+
|
19
|
+
def get_data
|
20
|
+
Babeltrace2.bt_self_component_port_get_data(@handle)
|
21
|
+
end
|
22
|
+
alias data get_data
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class BTSelfComponent::Port::Input < BTPort::Input
|
27
|
+
include BTSelfComponent::Port
|
28
|
+
end
|
29
|
+
BTSelfComponentPortInput = BTSelfComponent::Port::Input
|
30
|
+
|
31
|
+
class BTSelfComponent::Port::Output < BTPort::Output
|
32
|
+
include BTSelfComponent::Port
|
33
|
+
end
|
34
|
+
BTSelfComponentPortOutput = BTSelfComponent::Port::Output
|
35
|
+
end
|
@@ -0,0 +1,264 @@
|
|
1
|
+
module Babeltrace2
|
2
|
+
|
3
|
+
BT_SELF_COMPONENT_ADD_PORT_STATUS_OK = BT_FUNC_STATUS_OK
|
4
|
+
BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
5
|
+
BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
6
|
+
BTSelfComponentAddPortStatus = enum :bt_self_component_add_port_status,
|
7
|
+
[ :BT_SELF_COMPONENT_ADD_PORT_STATUS_OK,
|
8
|
+
BT_SELF_COMPONENT_ADD_PORT_STATUS_OK,
|
9
|
+
:BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR,
|
10
|
+
BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR,
|
11
|
+
:BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR,
|
12
|
+
BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR ]
|
13
|
+
|
14
|
+
attach_function :bt_self_component_get_data,
|
15
|
+
[ :bt_self_component_handle ],
|
16
|
+
:pointer
|
17
|
+
|
18
|
+
attach_function :bt_self_component_set_data,
|
19
|
+
[ :bt_self_component_handle,
|
20
|
+
:pointer ],
|
21
|
+
:void
|
22
|
+
|
23
|
+
attach_function :bt_self_component_get_graph_mip_version,
|
24
|
+
[ :bt_self_component_handle ],
|
25
|
+
:uint64
|
26
|
+
|
27
|
+
module BTSelfComponent
|
28
|
+
AddPortStatus = BTSelfComponentAddPortStatus
|
29
|
+
|
30
|
+
def self.from_handle(handle, retain: true, auto_release: true)
|
31
|
+
case Babeltrace2.bt_component_get_class_type(handle)
|
32
|
+
when :BT_COMPONENT_CLASS_TYPE_SOURCE
|
33
|
+
handle = BTSelfComponentSourceHandle.new(handle)
|
34
|
+
BTSelfComponentSource
|
35
|
+
when :BT_COMPONENT_CLASS_TYPE_FILTER
|
36
|
+
handle = BTSelfComponentFilterHandle.new(handle)
|
37
|
+
BTSelfComponentFilter
|
38
|
+
when :BT_COMPONENT_CLASS_TYPE_SINK
|
39
|
+
handle = BTSelfComponentSinkHandle.new(handle)
|
40
|
+
BTSelfComponentSink
|
41
|
+
else
|
42
|
+
raise Error.new("Unknown component class type")
|
43
|
+
end.new(handle, retain: retain, auto_release: auto_release)
|
44
|
+
end
|
45
|
+
|
46
|
+
def set_data(user_data)
|
47
|
+
Babeltrace2.bt_self_component_set_data(@handle, user_data)
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
def data=(user_data)
|
52
|
+
set_data(user_data)
|
53
|
+
user_data
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_data
|
57
|
+
Babeltrace2.bt_self_component_get_data(@handle)
|
58
|
+
end
|
59
|
+
alias data get_data
|
60
|
+
|
61
|
+
def get_graph_mip_version
|
62
|
+
Babeltrace2.bt_self_component_get_graph_mip_version(@handle)
|
63
|
+
end
|
64
|
+
alias graph_mip_version get_graph_mip_version
|
65
|
+
|
66
|
+
def create_trace_class
|
67
|
+
BTTraceClass.new(self_component: @handle)
|
68
|
+
end
|
69
|
+
|
70
|
+
def create_clock_class
|
71
|
+
BTClockClass.new(self_component: @handle)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
attach_function :bt_self_component_source_add_output_port,
|
76
|
+
[ :bt_self_component_source_handle,
|
77
|
+
:string, :pointer,
|
78
|
+
:pointer ],
|
79
|
+
:bt_self_component_add_port_status
|
80
|
+
|
81
|
+
attach_function :bt_self_component_source_borrow_output_port_by_index,
|
82
|
+
[ :bt_self_component_source_handle,
|
83
|
+
:uint64 ],
|
84
|
+
:bt_self_component_port_output_handle
|
85
|
+
|
86
|
+
attach_function :bt_self_component_source_borrow_output_port_by_name,
|
87
|
+
[ :bt_self_component_source_handle,
|
88
|
+
:string ],
|
89
|
+
:bt_self_component_port_output_handle
|
90
|
+
|
91
|
+
class BTSelfComponent::Source < BTComponent::Source
|
92
|
+
include BTSelfComponent
|
93
|
+
class Configuration < BTObject
|
94
|
+
end
|
95
|
+
|
96
|
+
def add_output_port(name, user_data: nil)
|
97
|
+
ptr = FFI::MemoryPointer.new(:pointer)
|
98
|
+
res = Babeltrace2.bt_self_component_source_add_output_port(@handle, name, user_data, ptr)
|
99
|
+
raise Babeltrace2.process_error(res) if res != :BT_SELF_COMPONENT_ADD_PORT_STATUS_OK
|
100
|
+
BTSelfComponentPortOutput.new(BTSelfComponentPortOutputHandle.new(ptr.read_pointer),
|
101
|
+
retain: false, auto_release: false)
|
102
|
+
end
|
103
|
+
|
104
|
+
def get_output_port_by_index(index)
|
105
|
+
count = get_output_port_count
|
106
|
+
index += count if index < 0
|
107
|
+
return nil if index >= count || index < 0
|
108
|
+
handle = Babeltrace2.bt_self_component_source_borrow_output_port_by_index(@handle, index)
|
109
|
+
BTSelfComponentPortOutput.new(handle, retain: false, auto_release: false)
|
110
|
+
end
|
111
|
+
|
112
|
+
def get_output_port_by_name(name)
|
113
|
+
handle = Babeltrace2.bt_self_component_source_borrow_output_port_by_name(@handle, name)
|
114
|
+
return nil if handle.null?
|
115
|
+
BTSelfComponentPortOutput.new(handle, retain: false, auto_release: false)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
BTSelfComponentSource = BTSelfComponent::Source
|
119
|
+
BTSelfComponentSourceConfiguration = BTSelfComponent::Source::Configuration
|
120
|
+
|
121
|
+
attach_function :bt_self_component_filter_add_input_port,
|
122
|
+
[ :bt_self_component_filter_handle,
|
123
|
+
:string, :pointer,
|
124
|
+
:pointer ],
|
125
|
+
:bt_self_component_add_port_status
|
126
|
+
|
127
|
+
attach_function :bt_self_component_filter_add_output_port,
|
128
|
+
[ :bt_self_component_filter_handle,
|
129
|
+
:string, :pointer,
|
130
|
+
:pointer ],
|
131
|
+
:bt_self_component_add_port_status
|
132
|
+
|
133
|
+
attach_function :bt_self_component_filter_borrow_output_port_by_index,
|
134
|
+
[ :bt_self_component_filter_handle,
|
135
|
+
:uint64 ],
|
136
|
+
:bt_self_component_port_output_handle
|
137
|
+
|
138
|
+
attach_function :bt_self_component_filter_borrow_output_port_by_name,
|
139
|
+
[ :bt_self_component_filter_handle,
|
140
|
+
:string ],
|
141
|
+
:bt_self_component_port_output_handle
|
142
|
+
|
143
|
+
attach_function :bt_self_component_filter_borrow_input_port_by_index,
|
144
|
+
[ :bt_self_component_filter_handle,
|
145
|
+
:uint64 ],
|
146
|
+
:bt_self_component_port_input_handle
|
147
|
+
|
148
|
+
attach_function :bt_self_component_filter_borrow_input_port_by_name,
|
149
|
+
[ :bt_self_component_filter_handle,
|
150
|
+
:string ],
|
151
|
+
:bt_self_component_port_input_handle
|
152
|
+
|
153
|
+
class BTSelfComponent::Filter < BTComponent::Filter
|
154
|
+
include BTSelfComponent
|
155
|
+
class Configuration < BTObject
|
156
|
+
end
|
157
|
+
|
158
|
+
def add_output_port(name, user_data: nil)
|
159
|
+
ptr = FFI::MemoryPointer.new(:pointer)
|
160
|
+
res = Babeltrace2.bt_self_component_filter_add_output_port(@handle, name, user_data, ptr)
|
161
|
+
raise Babeltrace2.process_error(res) if res != :BT_SELF_COMPONENT_ADD_PORT_STATUS_OK
|
162
|
+
BTSelfComponentPortOutput.new(BTSelfComponentPortOutputHandle.new(ptr.read_pointer),
|
163
|
+
retain: false, auto_release: false)
|
164
|
+
end
|
165
|
+
|
166
|
+
def add_input_port(name, user_data: nil)
|
167
|
+
ptr = FFI::MemoryPointer.new(:pointer)
|
168
|
+
res = Babeltrace2.bt_self_component_filter_add_input_port(@handle, name, user_data, ptr)
|
169
|
+
raise Babeltrace2.process_error(res) if res != :BT_SELF_COMPONENT_ADD_PORT_STATUS_OK
|
170
|
+
BTSelfComponentPortInput.new(BTSelfComponentPortInputHandle.new(ptr.read_pointer),
|
171
|
+
retain: false, auto_release: false)
|
172
|
+
end
|
173
|
+
|
174
|
+
def get_output_port_by_index(index)
|
175
|
+
count = get_output_port_count
|
176
|
+
index += count if index < 0
|
177
|
+
return nil if index >= count || index < 0
|
178
|
+
handle = Babeltrace2.bt_self_component_filter_borrow_output_port_by_index(@handle, index)
|
179
|
+
BTSelfComponentPortOutput.new(handle, retain: false, auto_release: false)
|
180
|
+
end
|
181
|
+
|
182
|
+
def get_output_port_by_name(name)
|
183
|
+
handle = Babeltrace2.bt_self_component_filter_borrow_output_port_by_name(@handle, name)
|
184
|
+
return nil if handle.null?
|
185
|
+
BTSelfComponentPortOutput.new(handle, retain: false, auto_release: false)
|
186
|
+
end
|
187
|
+
|
188
|
+
def get_input_port_by_index(index)
|
189
|
+
count = get_input_port_count
|
190
|
+
index += count if index < 0
|
191
|
+
return nil if index >= count || index < 0
|
192
|
+
handle = Babeltrace2.bt_self_component_filter_borrow_input_port_by_index(@handle, index)
|
193
|
+
BTSelfComponentPortInput.new(handle, retain: false, auto_release: false)
|
194
|
+
end
|
195
|
+
|
196
|
+
def get_input_port_by_name(name)
|
197
|
+
handle = Babeltrace2.bt_self_component_filter_borrow_input_port_by_name(@handle, name)
|
198
|
+
return nil if handle.null?
|
199
|
+
BTSelfComponentPortInput.new(handle, retain: false, auto_release: false)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
BTSelfComponentFilter = BTSelfComponent::Filter
|
203
|
+
BTSelfComponentFilterConfiguration = BTSelfComponent::Filter::Configuration
|
204
|
+
|
205
|
+
attach_function :bt_self_component_sink_add_input_port,
|
206
|
+
[ :bt_self_component_sink_handle,
|
207
|
+
:string, :pointer,
|
208
|
+
:pointer ],
|
209
|
+
:bt_self_component_add_port_status
|
210
|
+
|
211
|
+
attach_function :bt_self_component_sink_borrow_input_port_by_index,
|
212
|
+
[ :bt_self_component_sink_handle,
|
213
|
+
:uint64 ],
|
214
|
+
:bt_self_component_port_input_handle
|
215
|
+
|
216
|
+
attach_function :bt_self_component_sink_borrow_input_port_by_name,
|
217
|
+
[ :bt_self_component_sink_handle,
|
218
|
+
:string ],
|
219
|
+
:bt_self_component_port_input_handle
|
220
|
+
|
221
|
+
attach_function :bt_self_component_sink_is_interrupted,
|
222
|
+
[ :bt_self_component_sink_handle ],
|
223
|
+
:bt_bool
|
224
|
+
|
225
|
+
class BTSelfComponent::Sink < BTComponent::Sink
|
226
|
+
include BTSelfComponent
|
227
|
+
class Configuration < BTObject
|
228
|
+
end
|
229
|
+
|
230
|
+
def add_input_port(name, user_data: nil)
|
231
|
+
ptr = FFI::MemoryPointer.new(:pointer)
|
232
|
+
res = Babeltrace2.bt_self_component_sink_add_input_port(@handle, name, user_data, ptr)
|
233
|
+
raise Babeltrace2.process_error(res) if res != :BT_SELF_COMPONENT_ADD_PORT_STATUS_OK
|
234
|
+
BTSelfComponentPortInput.new(BTSelfComponentPortInputHandle.new(ptr.read_pointer),
|
235
|
+
retain: false, auto_release: false)
|
236
|
+
end
|
237
|
+
|
238
|
+
def get_input_port_by_index(index)
|
239
|
+
count = get_input_port_count
|
240
|
+
index += count if index < 0
|
241
|
+
return nil if index >= count || index < 0
|
242
|
+
handle = Babeltrace2.bt_self_component_sink_borrow_input_port_by_index(@handle, index)
|
243
|
+
BTSelfComponentPortInput.new(handle, retain: false, auto_release: false)
|
244
|
+
end
|
245
|
+
|
246
|
+
def get_input_port_by_name(name)
|
247
|
+
handle = Babeltrace2.bt_self_component_sink_borrow_input_port_by_name(@handle, name)
|
248
|
+
return nil if handle.null?
|
249
|
+
BTSelfComponentPortInput.new(handle, retain: false, auto_release: false)
|
250
|
+
end
|
251
|
+
|
252
|
+
def is_interrupted
|
253
|
+
Babeltrace2.bt_self_component_sink_is_interrupted(@handle) != BT_FALSE
|
254
|
+
end
|
255
|
+
alias interrupted? is_interrupted
|
256
|
+
|
257
|
+
def create_message_iterator(port)
|
258
|
+
BTMessageIterator.create_from_sink_component(self, port)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
BTSelfComponentSink = BTSelfComponent::Sink
|
262
|
+
BTSelfComponentSinkConfiguration = BTSelfComponent::Sink::Configuration
|
263
|
+
|
264
|
+
end
|