babeltrace2 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,57 @@
|
|
1
|
+
module Babeltrace2
|
2
|
+
|
3
|
+
attach_function :bt_interrupter_create,
|
4
|
+
[],
|
5
|
+
:bt_interrupter_handle
|
6
|
+
|
7
|
+
attach_function :bt_interrupter_set,
|
8
|
+
[ :bt_interrupter_handle ],
|
9
|
+
:void
|
10
|
+
|
11
|
+
attach_function :bt_interrupter_reset,
|
12
|
+
[ :bt_interrupter_handle ],
|
13
|
+
:void
|
14
|
+
|
15
|
+
attach_function :bt_interrupter_is_set,
|
16
|
+
[ :bt_interrupter_handle ],
|
17
|
+
:bt_bool
|
18
|
+
|
19
|
+
attach_function :bt_interrupter_get_ref,
|
20
|
+
[ :bt_interrupter_handle ],
|
21
|
+
:void
|
22
|
+
|
23
|
+
attach_function :bt_interrupter_put_ref,
|
24
|
+
[ :bt_interrupter_handle ],
|
25
|
+
:void
|
26
|
+
|
27
|
+
class BTInterrupter < BTSharedObject
|
28
|
+
@get_ref = :bt_interrupter_get_ref
|
29
|
+
@put_ref = :bt_interrupter_put_ref
|
30
|
+
|
31
|
+
def initialize(handle = nil, retain: true, auto_release: true)
|
32
|
+
if handle
|
33
|
+
super(handle, retain: retain, auto_release: auto_release)
|
34
|
+
else
|
35
|
+
handle = Babeltrace2.bt_interrupter_create()
|
36
|
+
raise Babeltrace2.process_error if handle.null?
|
37
|
+
super(handle)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def set
|
42
|
+
Babeltrace2.bt_interrupter_set(@handle)
|
43
|
+
end
|
44
|
+
alias set! set
|
45
|
+
|
46
|
+
def reset
|
47
|
+
Babeltrace2.bt_interrupter_reset(@handle)
|
48
|
+
end
|
49
|
+
alias reset! reset
|
50
|
+
|
51
|
+
def is_set
|
52
|
+
Babeltrace2.bt_interrupter_is_set(@handle) != BT_FALSE
|
53
|
+
end
|
54
|
+
alias set? is_set
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,374 @@
|
|
1
|
+
module Babeltrace2
|
2
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
|
3
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
4
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
5
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
6
|
+
|
7
|
+
BTMessageIteratorClassCanSeekBeginningMethodStatus =
|
8
|
+
enum :bt_message_iterator_class_can_seek_beginning_method_status,
|
9
|
+
[ :BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_OK,
|
10
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_OK,
|
11
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_AGAIN,
|
12
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_AGAIN,
|
13
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_MEMORY_ERROR,
|
14
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_MEMORY_ERROR,
|
15
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_ERROR,
|
16
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_ERROR ]
|
17
|
+
|
18
|
+
callback :bt_message_iterator_class_can_seek_beginning_method,
|
19
|
+
[ :bt_self_message_iterator_handle,
|
20
|
+
:pointer ],
|
21
|
+
:bt_message_iterator_class_can_seek_beginning_method_status
|
22
|
+
|
23
|
+
def self._wrap_message_iterator_class_can_seek_beginning_method(handle, method)
|
24
|
+
id = handle.to_i
|
25
|
+
method_wrapper = lambda { |self_message_iterator, can_seek_beginning|
|
26
|
+
begin
|
27
|
+
csb = method.call(BTSelfMessageIterator.new(self_message_iterator,
|
28
|
+
retain: false, auto_release: false))
|
29
|
+
can_seek_beginning.write_int(csb ? BT_TRUE : BT_FALSE)
|
30
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_OK
|
31
|
+
rescue Exception => e
|
32
|
+
Babeltrace2.stack_ruby_error(e, source: self_message_iterator)
|
33
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_ERROR
|
34
|
+
end
|
35
|
+
}
|
36
|
+
@@callbacks[id][:can_seek_beginning_method] = method_wrapper
|
37
|
+
method_wrapper
|
38
|
+
end
|
39
|
+
|
40
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
|
41
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
42
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
43
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
44
|
+
BTMessageIteratorClassCanSeekNSFromOriginMethodStatus =
|
45
|
+
enum :bt_message_iterator_class_can_seek_ns_from_origin_method_status,
|
46
|
+
[ :BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK,
|
47
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK,
|
48
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_AGAIN,
|
49
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_AGAIN,
|
50
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_MEMORY_ERROR,
|
51
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_MEMORY_ERROR,
|
52
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR,
|
53
|
+
BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR ]
|
54
|
+
|
55
|
+
callback :bt_message_iterator_class_can_seek_ns_from_origin_method,
|
56
|
+
[ :bt_self_message_iterator_handle,
|
57
|
+
:int64, :pointer ],
|
58
|
+
:bt_message_iterator_class_can_seek_ns_from_origin_method_status
|
59
|
+
|
60
|
+
def self._wrap_message_iterator_class_can_seek_ns_from_origin_method(handle, method)
|
61
|
+
id = handle.to_i
|
62
|
+
method_wrapper = lambda { |self_message_iterator, ns_from_origin, can_seek_beginning|
|
63
|
+
begin
|
64
|
+
csb = method.call(BTSelfMessageIterator.new(self_message_iterator,
|
65
|
+
retain: false, auto_release: false), ns_from_origin)
|
66
|
+
can_seek_beginning.write_int(csb ? BT_TRUE : BT_FALSE)
|
67
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK
|
68
|
+
rescue Exception => e
|
69
|
+
Babeltrace2.stack_ruby_error(e, source: self_message_iterator)
|
70
|
+
:BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR
|
71
|
+
end
|
72
|
+
}
|
73
|
+
@@callbacks[id][:can_seek_ns_from_origin_method] = method_wrapper
|
74
|
+
method_wrapper
|
75
|
+
end
|
76
|
+
|
77
|
+
callback :bt_message_iterator_class_finalize_method,
|
78
|
+
[ :bt_self_message_iterator_handle ],
|
79
|
+
:void
|
80
|
+
|
81
|
+
def self._wrap_message_iterator_class_finalize_method(handle, method)
|
82
|
+
id = handle.to_i
|
83
|
+
method_wrapper = lambda { |self_message_iterator|
|
84
|
+
begin
|
85
|
+
method.call(BTSelfMessageIterator.new(self_message_iterator,
|
86
|
+
retain: false, auto_release: false))
|
87
|
+
rescue Exception => e
|
88
|
+
puts e
|
89
|
+
end
|
90
|
+
}
|
91
|
+
@@callbacks[id][:finalize_method] = method_wrapper
|
92
|
+
method_wrapper
|
93
|
+
end
|
94
|
+
|
95
|
+
BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
|
96
|
+
BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
97
|
+
BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
98
|
+
BTMessageIteratorClassInitializeMethodStatus =
|
99
|
+
enum :bt_message_iterator_class_initialize_method_status,
|
100
|
+
[ :BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK,
|
101
|
+
BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK,
|
102
|
+
:BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR,
|
103
|
+
BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR,
|
104
|
+
:BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_ERROR,
|
105
|
+
BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_ERROR ]
|
106
|
+
|
107
|
+
callback :bt_message_iterator_class_initialize_method,
|
108
|
+
[ :bt_self_message_iterator_handle,
|
109
|
+
:bt_self_message_iterator_configuration_handle,
|
110
|
+
:bt_self_component_port_output_handle ],
|
111
|
+
:bt_message_iterator_class_initialize_method_status
|
112
|
+
|
113
|
+
def self._wrap_message_iterator_class_initialize_method(handle, method)
|
114
|
+
id = handle.to_i
|
115
|
+
method_wrapper = lambda { |self_message_iterator, configuration, port|
|
116
|
+
begin
|
117
|
+
method.call(BTSelfMessageIterator.new(self_message_iterator,
|
118
|
+
retain: false, auto_release: false),
|
119
|
+
BTSelfMessageIteratorConfiguration.new(configuration),
|
120
|
+
BTSelfComponentPortOutput.new(port,
|
121
|
+
retain: false, auto_release: false))
|
122
|
+
:BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK
|
123
|
+
rescue Exception => e
|
124
|
+
Babeltrace2.stack_ruby_error(e, source: self_message_iterator)
|
125
|
+
:BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_ERROR
|
126
|
+
end
|
127
|
+
}
|
128
|
+
@@callbacks[id][:initialize_method] = method_wrapper
|
129
|
+
method_wrapper
|
130
|
+
end
|
131
|
+
|
132
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
|
133
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_END = BT_FUNC_STATUS_END
|
134
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
135
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
136
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
137
|
+
BTMessageIteratorClassNextMethodStatus =
|
138
|
+
enum :bt_message_iterator_class_next_method_status,
|
139
|
+
[ :BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK,
|
140
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK,
|
141
|
+
:BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_END,
|
142
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_END,
|
143
|
+
:BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_AGAIN,
|
144
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_AGAIN,
|
145
|
+
:BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_MEMORY_ERROR,
|
146
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_MEMORY_ERROR,
|
147
|
+
:BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_ERROR,
|
148
|
+
BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_ERROR ]
|
149
|
+
|
150
|
+
callback :bt_message_iterator_class_next_method,
|
151
|
+
[ :bt_self_message_iterator_handle,
|
152
|
+
:bt_message_array_const,
|
153
|
+
:uint64, :pointer ],
|
154
|
+
:bt_message_iterator_class_next_method_status
|
155
|
+
|
156
|
+
def self._wrap_message_iterator_class_next_method(method)
|
157
|
+
lambda { |self_message_iterator, messages, capacity, count|
|
158
|
+
begin
|
159
|
+
mess = method.call(BTSelfMessageIterator.new(self_message_iterator,
|
160
|
+
retain: false, auto_release: false),
|
161
|
+
capacity)
|
162
|
+
if mess.size < capacity
|
163
|
+
mess.each { |m| bt_message_get_ref(m.handle) }
|
164
|
+
messages.write_array_of_pointer(mess.collect(&:handle))
|
165
|
+
count.write_uint64(mess.size)
|
166
|
+
:BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK
|
167
|
+
else
|
168
|
+
puts "Too many messages for capacity"
|
169
|
+
:BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_ERROR
|
170
|
+
end
|
171
|
+
rescue StopIteration
|
172
|
+
:BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_END
|
173
|
+
rescue Exception => e
|
174
|
+
Babeltrace2.stack_ruby_error(e, source: self_message_iterator)
|
175
|
+
:BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_ERROR
|
176
|
+
end
|
177
|
+
}
|
178
|
+
end
|
179
|
+
|
180
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
|
181
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
182
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
183
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
184
|
+
BTMessageIteratorClassSeekBeginningMethodStatus =
|
185
|
+
enum :bt_message_iterator_class_seek_beginning_method_status,
|
186
|
+
[ :BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_OK,
|
187
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_OK,
|
188
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_AGAIN,
|
189
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_AGAIN,
|
190
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_MEMORY_ERROR,
|
191
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_MEMORY_ERROR,
|
192
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_ERROR,
|
193
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_ERROR ]
|
194
|
+
|
195
|
+
callback :bt_message_iterator_class_seek_beginning_method,
|
196
|
+
[ :bt_self_message_iterator_handle ],
|
197
|
+
:bt_message_iterator_class_seek_beginning_method_status
|
198
|
+
|
199
|
+
def self._wrap_message_iterator_class_seek_beginning_method(handle, method)
|
200
|
+
id = handle.to_i
|
201
|
+
method_wrapper = lambda { |self_message_iterator|
|
202
|
+
begin
|
203
|
+
method.call(BTSelfMessageIterator.new(self_message_iterator,
|
204
|
+
retain: false, auto_release: false))
|
205
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_OK
|
206
|
+
rescue Exception => e
|
207
|
+
Babeltrace2.stack_ruby_error(e, source: self_message_iterator)
|
208
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHOD_STATUS_ERROR
|
209
|
+
end
|
210
|
+
}
|
211
|
+
@@callbacks[id][:seek_beginning_method] = method_wrapper
|
212
|
+
method_wrapper
|
213
|
+
end
|
214
|
+
|
215
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
|
216
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
217
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
218
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
219
|
+
BTMessageIteratorClassSeekNSFromOriginMethodStatus =
|
220
|
+
enum :bt_message_iterator_class_seek_ns_from_origin_method_status,
|
221
|
+
[ :BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK,
|
222
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK,
|
223
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_AGAIN,
|
224
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_AGAIN,
|
225
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_MEMORY_ERROR,
|
226
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_MEMORY_ERROR,
|
227
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR,
|
228
|
+
BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR ]
|
229
|
+
|
230
|
+
callback :bt_message_iterator_class_seek_ns_from_origin_method,
|
231
|
+
[ :bt_self_message_iterator_handle,
|
232
|
+
:int64 ],
|
233
|
+
:bt_message_iterator_class_seek_ns_from_origin_method_status
|
234
|
+
|
235
|
+
def self._wrap_message_iterator_class_seek_ns_from_origin_method(handle, method)
|
236
|
+
id = handle.to_i
|
237
|
+
method_wrapper = lambda { |self_message_iterator, ns_from_origin|
|
238
|
+
begin
|
239
|
+
method.call(BTSelfMessageIterator.new(self_message_iterator,
|
240
|
+
retain: false, auto_release: false), ns_from_origin)
|
241
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_OK
|
242
|
+
rescue Exception => e
|
243
|
+
Babeltrace2.stack_ruby_error(e, source: self_message_iterator)
|
244
|
+
:BT_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHOD_STATUS_ERROR
|
245
|
+
end
|
246
|
+
}
|
247
|
+
@@callbacks[id][:seek_ns_from_origin_method] = method_wrapper
|
248
|
+
method_wrapper
|
249
|
+
end
|
250
|
+
|
251
|
+
attach_function :bt_message_iterator_class_create,
|
252
|
+
[ :bt_message_iterator_class_next_method ],
|
253
|
+
:bt_message_iterator_class_handle
|
254
|
+
|
255
|
+
BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
|
256
|
+
BTMessageIteratorClassSetMethodStatus =
|
257
|
+
enum :bt_message_iterator_class_set_method_status,
|
258
|
+
[ :BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK,
|
259
|
+
BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK ]
|
260
|
+
|
261
|
+
attach_function :bt_message_iterator_class_set_finalize_method,
|
262
|
+
[ :bt_message_iterator_class_handle,
|
263
|
+
:bt_message_iterator_class_finalize_method ],
|
264
|
+
:bt_message_iterator_class_set_method_status
|
265
|
+
|
266
|
+
attach_function :bt_message_iterator_class_set_initialize_method,
|
267
|
+
[ :bt_message_iterator_class_handle,
|
268
|
+
:bt_message_iterator_class_initialize_method ],
|
269
|
+
:bt_message_iterator_class_set_method_status
|
270
|
+
|
271
|
+
attach_function :bt_message_iterator_class_set_seek_beginning_methods,
|
272
|
+
[ :bt_message_iterator_class_handle,
|
273
|
+
:bt_message_iterator_class_seek_beginning_method,
|
274
|
+
:bt_message_iterator_class_can_seek_beginning_method ],
|
275
|
+
:bt_message_iterator_class_set_method_status
|
276
|
+
|
277
|
+
attach_function :bt_message_iterator_class_set_seek_ns_from_origin_methods,
|
278
|
+
[ :bt_message_iterator_class_handle,
|
279
|
+
:bt_message_iterator_class_seek_ns_from_origin_method,
|
280
|
+
:bt_message_iterator_class_can_seek_ns_from_origin_method ],
|
281
|
+
:bt_message_iterator_class_set_method_status
|
282
|
+
|
283
|
+
attach_function :bt_message_iterator_class_get_ref,
|
284
|
+
[ :bt_message_iterator_class_handle],
|
285
|
+
:void
|
286
|
+
|
287
|
+
attach_function :bt_message_iterator_class_put_ref,
|
288
|
+
[ :bt_message_iterator_class_handle],
|
289
|
+
:void
|
290
|
+
|
291
|
+
class BTMessageIteratorClass < BTSharedObject
|
292
|
+
CanSeekBeginningMethodStatus = BTMessageIteratorClassCanSeekBeginningMethodStatus
|
293
|
+
CanSeekNSFromOriginMethodStatus = BTMessageIteratorClassCanSeekNSFromOriginMethodStatus
|
294
|
+
InitializeMethodStatus = BTMessageIteratorClassInitializeMethodStatus
|
295
|
+
NextMethodStatus = BTMessageIteratorClassNextMethodStatus
|
296
|
+
SeekBeginningMethodStatus = BTMessageIteratorClassSeekBeginningMethodStatus
|
297
|
+
SeekNSFromOriginMethodStatus = BTMessageIteratorClassSeekNSFromOriginMethodStatus
|
298
|
+
SetMethodStatus = BTMessageIteratorClassSetMethodStatus
|
299
|
+
@get_ref = :bt_message_iterator_class_get_ref
|
300
|
+
@put_ref = :bt_message_iterator_class_put_ref
|
301
|
+
|
302
|
+
def initialize(handle = nil, retain: true, auto_release: true,
|
303
|
+
next_method: nil)
|
304
|
+
if handle
|
305
|
+
super(handle, retain: retain, auto_release: auto_release)
|
306
|
+
else
|
307
|
+
raise ArgumentError, "invalid value for next_method" unless next_method
|
308
|
+
next_method = Babeltrace2._wrap_message_iterator_class_next_method(next_method)
|
309
|
+
handle = Babeltrace2.bt_message_iterator_class_create(next_method)
|
310
|
+
raise Babeltrace2.process_error if handle.null?
|
311
|
+
Babeltrace2._callbacks[handle.to_i][:next_method] = next_method
|
312
|
+
super(handle, retain: false)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
def set_finalize_method(method)
|
317
|
+
method = Babeltrace2._wrap_message_iterator_class_finalize_method(@handle, method)
|
318
|
+
res = Babeltrace2.bt_message_iterator_class_set_finalize_method(@handle, method)
|
319
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK
|
320
|
+
self
|
321
|
+
end
|
322
|
+
|
323
|
+
def finalize_method=(method)
|
324
|
+
set_finalize_method(method)
|
325
|
+
method
|
326
|
+
end
|
327
|
+
|
328
|
+
def set_initialize_method(method)
|
329
|
+
method = Babeltrace2._wrap_message_iterator_class_initialize_method(@handle, method)
|
330
|
+
res = Babeltrace2.bt_message_iterator_class_set_initialize_method(@handle, method)
|
331
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK
|
332
|
+
self
|
333
|
+
end
|
334
|
+
|
335
|
+
def initialize_method=(method)
|
336
|
+
set_initialize_method(method)
|
337
|
+
method
|
338
|
+
end
|
339
|
+
|
340
|
+
def set_seek_beginning_methods(seek_method, can_seek_method: nil)
|
341
|
+
seek_method = Babeltrace2._wrap_message_iterator_class_seek_beginning_method(
|
342
|
+
@handle, seek_method)
|
343
|
+
can_seek_method =
|
344
|
+
Babeltrace2._wrap_message_iterator_class_can_seek_beginning_method(
|
345
|
+
@handle, can_seek_method) if can_seek_method
|
346
|
+
res = Babeltrace2.bt_message_iterator_class_set_seek_beginning_methods(
|
347
|
+
@handle, seek_method, can_seek_method)
|
348
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK
|
349
|
+
self
|
350
|
+
end
|
351
|
+
|
352
|
+
def seek_beginning_method=(seek_method)
|
353
|
+
set_seek_beginning_methods(seek_method)
|
354
|
+
seek_method
|
355
|
+
end
|
356
|
+
|
357
|
+
def set_seek_ns_from_origin_methods(seek_method, can_seek_method: nil)
|
358
|
+
seek_method = Babeltrace2._wrap_message_iterator_class_seek_ns_from_origin_method(
|
359
|
+
@handle, seek_method)
|
360
|
+
can_seek_method =
|
361
|
+
Babeltrace2._wrap_message_iterator_class_can_seek_ns_from_origin_method(
|
362
|
+
@handle, can_seek_method) if can_seek_method
|
363
|
+
res = Babeltrace2.bt_message_iterator_class_set_seek_ns_from_origin_methods(
|
364
|
+
@handle, seek_method, can_seek_method)
|
365
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK
|
366
|
+
self
|
367
|
+
end
|
368
|
+
|
369
|
+
def seek_ns_from_origin_method=(seek_method)
|
370
|
+
set_seek_ns_from_origin_methods(seek_method)
|
371
|
+
seek_method
|
372
|
+
end
|
373
|
+
end
|
374
|
+
end
|
@@ -0,0 +1,253 @@
|
|
1
|
+
module Babeltrace2
|
2
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK = BT_FUNC_STATUS_OK
|
3
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
4
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
5
|
+
BTMessageIteratorCreateFromMessageIteratorStatus =
|
6
|
+
enum :bt_message_iterator_create_from_message_iterator_status,
|
7
|
+
[ :BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK,
|
8
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK,
|
9
|
+
:BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_MEMORY_ERROR,
|
10
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_MEMORY_ERROR,
|
11
|
+
:BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR,
|
12
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR ]
|
13
|
+
|
14
|
+
attach_function :bt_message_iterator_create_from_message_iterator,
|
15
|
+
[ :bt_self_message_iterator_handle,
|
16
|
+
:bt_self_component_port_input_handle,
|
17
|
+
:pointer ],
|
18
|
+
:bt_message_iterator_create_from_message_iterator_status
|
19
|
+
|
20
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK = BT_FUNC_STATUS_OK
|
21
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
22
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
23
|
+
BTMessageIteratorCreateFromSinkComponentStatus =
|
24
|
+
enum :bt_message_iterator_create_from_sink_component_status,
|
25
|
+
[ :BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK,
|
26
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK,
|
27
|
+
:BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_MEMORY_ERROR,
|
28
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_MEMORY_ERROR,
|
29
|
+
:BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR,
|
30
|
+
BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR ]
|
31
|
+
|
32
|
+
attach_function :bt_message_iterator_create_from_sink_component,
|
33
|
+
[ :bt_self_component_sink_handle,
|
34
|
+
:bt_self_component_port_input_handle,
|
35
|
+
:pointer ],
|
36
|
+
:bt_message_iterator_create_from_sink_component_status
|
37
|
+
|
38
|
+
attach_function :bt_message_iterator_borrow_component,
|
39
|
+
[ :bt_message_iterator_handle ],
|
40
|
+
:bt_component_handle
|
41
|
+
|
42
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_OK = BT_FUNC_STATUS_OK
|
43
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_END = BT_FUNC_STATUS_END
|
44
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
45
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
46
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
47
|
+
BTMessageIteratorNextStatus = enum :bt_message_iterator_next_status,
|
48
|
+
[ :BT_MESSAGE_ITERATOR_NEXT_STATUS_OK,
|
49
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_OK,
|
50
|
+
:BT_MESSAGE_ITERATOR_NEXT_STATUS_END,
|
51
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_END,
|
52
|
+
:BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN,
|
53
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN,
|
54
|
+
:BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR,
|
55
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR,
|
56
|
+
:BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR,
|
57
|
+
BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR ]
|
58
|
+
|
59
|
+
attach_function :bt_message_iterator_next,
|
60
|
+
[ :bt_message_iterator_handle,
|
61
|
+
:pointer, :pointer ],
|
62
|
+
:bt_message_iterator_next_status
|
63
|
+
|
64
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_OK = BT_FUNC_STATUS_OK
|
65
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
66
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
67
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
68
|
+
BTMessageIteratorCanSeekBeginningStatus =
|
69
|
+
enum :bt_message_iterator_can_seek_beginning_status,
|
70
|
+
[ :BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_OK,
|
71
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_OK,
|
72
|
+
:BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_AGAIN,
|
73
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_AGAIN,
|
74
|
+
:BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_MEMORY_ERROR,
|
75
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_MEMORY_ERROR,
|
76
|
+
:BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_ERROR,
|
77
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_ERROR ]
|
78
|
+
|
79
|
+
attach_function :bt_message_iterator_can_seek_beginning,
|
80
|
+
[ :bt_message_iterator_handle,
|
81
|
+
:pointer ],
|
82
|
+
:bt_message_iterator_can_seek_beginning_status
|
83
|
+
|
84
|
+
BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK = BT_FUNC_STATUS_OK
|
85
|
+
BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
86
|
+
BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
87
|
+
BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
88
|
+
BTMessageIteratorSeekBeginningStatus =
|
89
|
+
enum :bt_message_iterator_seek_beginning_status,
|
90
|
+
[ :BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK,
|
91
|
+
BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK,
|
92
|
+
:BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_AGAIN,
|
93
|
+
BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_AGAIN,
|
94
|
+
:BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_MEMORY_ERROR,
|
95
|
+
BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_MEMORY_ERROR,
|
96
|
+
:BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_ERROR,
|
97
|
+
BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_ERROR ]
|
98
|
+
|
99
|
+
attach_function :bt_message_iterator_seek_beginning,
|
100
|
+
[ :bt_message_iterator_handle ],
|
101
|
+
:bt_message_iterator_seek_beginning_status
|
102
|
+
|
103
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_OK = BT_FUNC_STATUS_OK
|
104
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
105
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
106
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
107
|
+
BTMessageIteratorCanSeekNSFromOriginStatus =
|
108
|
+
enum :bt_message_iterator_can_seek_ns_from_origin_status,
|
109
|
+
[ :BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_OK,
|
110
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_OK,
|
111
|
+
:BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN,
|
112
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN,
|
113
|
+
:BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR,
|
114
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR,
|
115
|
+
:BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_ERROR,
|
116
|
+
BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_ERROR ]
|
117
|
+
|
118
|
+
attach_function :bt_message_iterator_can_seek_ns_from_origin,
|
119
|
+
[ :bt_message_iterator_handle,
|
120
|
+
:int64, :pointer ],
|
121
|
+
:bt_message_iterator_can_seek_ns_from_origin_status
|
122
|
+
|
123
|
+
BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_OK = BT_FUNC_STATUS_OK
|
124
|
+
BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
|
125
|
+
BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
|
126
|
+
BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_ERROR = BT_FUNC_STATUS_ERROR
|
127
|
+
BTMessageIteratorSeekNSFromOriginStatus =
|
128
|
+
enum :bt_message_iterator_seek_ns_from_origin_status,
|
129
|
+
[ :BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_OK,
|
130
|
+
BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_OK,
|
131
|
+
:BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN,
|
132
|
+
BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN,
|
133
|
+
:BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR,
|
134
|
+
BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR,
|
135
|
+
:BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_ERROR,
|
136
|
+
BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_ERROR ]
|
137
|
+
|
138
|
+
attach_function :bt_message_iterator_seek_ns_from_origin,
|
139
|
+
[ :bt_message_iterator_handle,
|
140
|
+
:int64 ],
|
141
|
+
:bt_message_iterator_seek_ns_from_origin_status
|
142
|
+
|
143
|
+
attach_function :bt_message_iterator_can_seek_forward,
|
144
|
+
[ :bt_message_iterator_handle ],
|
145
|
+
:bt_bool
|
146
|
+
|
147
|
+
attach_function :bt_message_iterator_get_ref,
|
148
|
+
[ :bt_message_iterator_handle ],
|
149
|
+
:void
|
150
|
+
|
151
|
+
attach_function :bt_message_iterator_put_ref,
|
152
|
+
[ :bt_message_iterator_handle ],
|
153
|
+
:void
|
154
|
+
|
155
|
+
class BTMessageIterator < BTSharedObject
|
156
|
+
CreateFromMessageIteratorStatus = BTMessageIteratorCreateFromMessageIteratorStatus
|
157
|
+
CreateFromSinkComponentStatus = BTMessageIteratorCreateFromSinkComponentStatus
|
158
|
+
NextStatus = BTMessageIteratorNextStatus
|
159
|
+
CanSeekBeginningStatus = BTMessageIteratorCanSeekBeginningStatus
|
160
|
+
SeekBeginningStatus = BTMessageIteratorSeekBeginningStatus
|
161
|
+
CanSeekNSFromOriginStatus = BTMessageIteratorCanSeekNSFromOriginStatus
|
162
|
+
@get_ref = :bt_message_iterator_get_ref
|
163
|
+
@put_ref = :bt_message_iterator_put_ref
|
164
|
+
|
165
|
+
def self.create_from_message_iterator(self_message_iterator, port)
|
166
|
+
ptr = FFI::MemoryPointer.new(:pointer)
|
167
|
+
res = Babeltrace2.bt_message_iterator_create_from_message_iterator(self_message_iterator, port, ptr)
|
168
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK
|
169
|
+
BTMessageIterator.new(BTMessageIteratorHandle.new(ptr.read_pointer), retain: false)
|
170
|
+
end
|
171
|
+
|
172
|
+
def create_message_iterator(port)
|
173
|
+
BTMessageIterator.create_from_message_iterator(self, port)
|
174
|
+
end
|
175
|
+
|
176
|
+
def self.create_from_sink_component(self_component_sink, port)
|
177
|
+
ptr = FFI::MemoryPointer.new(:pointer)
|
178
|
+
res = Babeltrace2.bt_message_iterator_create_from_sink_component(self_component_sink, port, ptr)
|
179
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK
|
180
|
+
BTMessageIterator.new(BTMessageIteratorHandle.new(ptr.read_pointer), retain: false)
|
181
|
+
end
|
182
|
+
|
183
|
+
def get_component
|
184
|
+
handle = Babeltrace2.bt_message_iterator_borrow_component(@handle)
|
185
|
+
BTComponent.from_handle(handle)
|
186
|
+
end
|
187
|
+
alias component get_component
|
188
|
+
|
189
|
+
def next_messages
|
190
|
+
ptr_messages = FFI::MemoryPointer.new(:pointer)
|
191
|
+
ptr_count = FFI::MemoryPointer.new(:uint64)
|
192
|
+
while ((res = Babeltrace2.bt_message_iterator_next(@handle, ptr_messages, ptr_count)) == :BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN)
|
193
|
+
puts "waiting"
|
194
|
+
sleep BT_SLEEP_TIME
|
195
|
+
end
|
196
|
+
case res
|
197
|
+
when :BT_MESSAGE_ITERATOR_NEXT_STATUS_OK
|
198
|
+
count = ptr_count.read_uint64
|
199
|
+
messages = ptr_messages.read_pointer
|
200
|
+
return messages.read_array_of_pointer(count).collect { |h|
|
201
|
+
BTMessage.from_handle(BTMessageHandle.new(h), retain: false)
|
202
|
+
}
|
203
|
+
when :BT_MESSAGE_ITERATOR_NEXT_STATUS_END
|
204
|
+
raise StopIteration
|
205
|
+
else
|
206
|
+
raise Babeltrace2.process_error(res)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def can_seek_beginning
|
211
|
+
ptr = FFI::MemoryPointer.new(:int)
|
212
|
+
while ((res = Babeltrace2.bt_message_iterator_can_seek_beginning(@handle, ptr)) == :BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_AGAIN)
|
213
|
+
sleep BT_SLEEP_TIME
|
214
|
+
end
|
215
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_OK
|
216
|
+
ptr.read_int != BT_FALSE
|
217
|
+
end
|
218
|
+
alias can_seek_beginning? can_seek_beginning
|
219
|
+
|
220
|
+
def seek_beginning
|
221
|
+
raise "invalid operation" unless can_seek_beginning?
|
222
|
+
while ((res = Babeltrace2.bt_message_iterator_seek_beginning(@handle)) == :BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_AGAIN)
|
223
|
+
sleep BT_SLEEP_TIME
|
224
|
+
end
|
225
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK
|
226
|
+
self
|
227
|
+
end
|
228
|
+
|
229
|
+
def can_seek_ns_from_origin(ns)
|
230
|
+
ptr = FFI::MemoryPointer.new(:int)
|
231
|
+
while ((res = Babeltrace2.bt_message_iterator_can_seek_ns_from_origin(@handle, ns, ptr)) == :BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN)
|
232
|
+
sleep BT_SLEEP_TIME
|
233
|
+
end
|
234
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_OK
|
235
|
+
ptr.read_int != BT_FALSE
|
236
|
+
end
|
237
|
+
alias can_seek_ns_from_origin? can_seek_ns_from_origin
|
238
|
+
|
239
|
+
def seek_ns_from_origin(ns)
|
240
|
+
raise "invalid operation" unless can_seek_ns_from_origin(ns)
|
241
|
+
while ((res = Babeltrace2.bt_message_iterator_seek_ns_from_origin@handle, ns) == :BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN)
|
242
|
+
sleep BT_SLEEP_TIME
|
243
|
+
end
|
244
|
+
raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_OK
|
245
|
+
self
|
246
|
+
end
|
247
|
+
|
248
|
+
def can_seek_forward
|
249
|
+
Babeltrace2.bt_message_iterator_can_seek_forward(@handle) != BT_FALSE
|
250
|
+
end
|
251
|
+
alias can_seek_forward? can_seek_forward
|
252
|
+
end
|
253
|
+
end
|