metababel 0.0.0 → 0.0.2
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 +4 -4
- data/bin/metababel +13 -15
- data/lib/metababel/bt2_stream_classes_generator.rb +9 -0
- data/lib/metababel/version.rb +2 -2
- data/template/downstream.c.erb +21 -1
- data/template/downstream.h.erb +3 -0
- data/template/filter.c.erb +49 -19
- data/template/sink.c.erb +13 -2
- data/template/source.c.erb +20 -4
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d2bc1142062b4ea5582787ac08f4297250cfacf0fd1cfef8a6d43facdbe0c91
|
|
4
|
+
data.tar.gz: 1ca1c72dfb7094af76b7de63b78334e366e90cd1ad9f4749e9b9606fd2c91a6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81c2894b9df348051da07351eede13c30c861e846ed1cd1aa45d6b0d9cd9f0afe1b1a8ee667aa5cec08c825096e86eace166e1d70e7099027ba4d77833491d87
|
|
7
|
+
data.tar.gz: 75b744ab367615c963951248d95828a8e51365efe9024ae6b88be3f72a857e73dc4c7aef0b84f60f39383f53d3978da8e324124acd94a8bc8c28dcc6c370cb63
|
data/bin/metababel
CHANGED
|
@@ -110,35 +110,31 @@ def wrote_creates(folder, t)
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
def wrote_component(options, d, folder)
|
|
113
|
-
|
|
114
113
|
component_dispatchers = [EventInfo.new('initialize_usr_data',
|
|
115
114
|
[GeneratedArg.new('void **', 'usr_data_p')]),
|
|
116
115
|
EventInfo.new('finalize_usr_data',
|
|
117
116
|
[GeneratedArg.new('void *', 'usr_data')]),
|
|
118
117
|
EventInfo.new('read_params',
|
|
119
118
|
[GeneratedArg.new('void *', 'usr_data'),
|
|
120
|
-
GeneratedArg.new('btx_params_t *', 'usr_params')])
|
|
121
|
-
]
|
|
119
|
+
GeneratedArg.new('btx_params_t *', 'usr_params')])]
|
|
122
120
|
|
|
123
|
-
if options[:component_type] ==
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
if options[:component_type] == 'SOURCE'
|
|
122
|
+
component_dispatchers << EventInfo.new('push_usr_messages',
|
|
123
|
+
[GeneratedArg.new('void *', 'usr_data'),
|
|
124
|
+
GeneratedArg.new('btx_source_status_t*', 'status')])
|
|
127
125
|
end
|
|
128
126
|
|
|
129
127
|
d2 = { component_dispatchers: component_dispatchers,
|
|
130
128
|
event_name: 'dummy_event' }
|
|
131
129
|
|
|
132
|
-
erb_render_and_save(d2.update(d).update(:
|
|
133
|
-
erb_render_and_save(d2.update(d).update(:
|
|
130
|
+
erb_render_and_save(d2.update(d).update(options: options), 'component.h', folder)
|
|
131
|
+
erb_render_and_save(d2.update(d).update(options: options), 'component.c', folder)
|
|
134
132
|
end
|
|
135
133
|
|
|
136
|
-
options = { plugin_name: 'metababel',
|
|
137
|
-
component_name: 'btx' }
|
|
138
|
-
|
|
139
134
|
# Display help if no arguments.
|
|
140
135
|
ARGV << '-h' if ARGV.empty?
|
|
141
136
|
|
|
137
|
+
options = {}
|
|
142
138
|
OptionParser.new do |opts|
|
|
143
139
|
opts.banner = 'Usage: example.rb [options]'
|
|
144
140
|
|
|
@@ -187,13 +183,15 @@ OptionParser.new do |opts|
|
|
|
187
183
|
end.parse!
|
|
188
184
|
|
|
189
185
|
raise OptionParser::MissingArgument if options[:component_type].nil?
|
|
186
|
+
options[:plugin_name] ||= "metababel_#{options[:component_type].downcase}"
|
|
187
|
+
options[:component_name] ||= "btx"
|
|
190
188
|
|
|
191
189
|
# Babeltrace can be extended by plugins, which provide one or more component classes.
|
|
192
190
|
base_folder = options[:folder] || "#{options[:component_type]}.#{options[:plugin_name]}.#{options[:component_name]}"
|
|
193
191
|
folder = "#{base_folder}/metababel"
|
|
194
192
|
FileUtils.mkdir_p(folder)
|
|
195
193
|
|
|
196
|
-
d = {:options
|
|
194
|
+
d = { options: options }
|
|
197
195
|
|
|
198
196
|
d[:params_declaration] = ''
|
|
199
197
|
d[:params_definition] = ''
|
|
@@ -207,8 +205,8 @@ if options.key?(:params)
|
|
|
207
205
|
d[:params_definition] = body
|
|
208
206
|
end
|
|
209
207
|
|
|
210
|
-
erb_render_and_save(d, "#{options[:component_type].downcase}.c", base_folder, out_name: "
|
|
211
|
-
erb_render_and_save({options: options}, 'metababel.h', folder, prefix: '')
|
|
208
|
+
erb_render_and_save(d, "#{options[:component_type].downcase}.c", base_folder, out_name: "main.c")
|
|
209
|
+
erb_render_and_save({ options: options }, 'metababel.h', folder, prefix: '')
|
|
212
210
|
|
|
213
211
|
wrote_component(options, d, folder)
|
|
214
212
|
if %w[SOURCE FILTER].include?(options[:component_type])
|
|
@@ -153,6 +153,7 @@ module Babeltrace2Gen
|
|
|
153
153
|
pr "bt_field_class *#{var_pc};"
|
|
154
154
|
@packet_context_field_class.get_declarator(trace_class: trace_class, variable: var_pc)
|
|
155
155
|
pr "bt_stream_class_set_packet_context_field_class(#{variable}, #{var_pc});"
|
|
156
|
+
pr "bt_field_class_put_ref(#{var_pc});"
|
|
156
157
|
end
|
|
157
158
|
end
|
|
158
159
|
|
|
@@ -162,6 +163,7 @@ module Babeltrace2Gen
|
|
|
162
163
|
pr "bt_field_class *#{var_ecc};"
|
|
163
164
|
@event_common_context_field_class.get_declarator(trace_class: trace_class, variable: var_ecc)
|
|
164
165
|
pr "bt_stream_class_set_event_common_context_field_class(#{variable}, #{var_ecc});"
|
|
166
|
+
pr "bt_field_class_put_ref(#{var_ecc});"
|
|
165
167
|
end
|
|
166
168
|
end
|
|
167
169
|
# Need to do is afert packet an devent_common_context because it can refer members to those
|
|
@@ -174,12 +176,16 @@ module Babeltrace2Gen
|
|
|
174
176
|
scope do
|
|
175
177
|
pr "bt_event_class *#{var_name};"
|
|
176
178
|
ec.get_declarator(trace_class: trace_class, variable: var_name, stream_class: variable)
|
|
179
|
+
pr "bt_event_class_put_ref(#{var_name});"
|
|
177
180
|
end
|
|
178
181
|
end
|
|
179
182
|
|
|
180
183
|
bt_set_conditionally(@assigns_automatic_stream_id) do |v|
|
|
181
184
|
pr "bt_stream_class_set_assigns_automatic_stream_id(#{variable}, #{v});"
|
|
182
185
|
end
|
|
186
|
+
|
|
187
|
+
pr "bt_stream_class_put_ref(#{variable});"
|
|
188
|
+
|
|
183
189
|
end
|
|
184
190
|
end
|
|
185
191
|
|
|
@@ -218,6 +224,7 @@ module Babeltrace2Gen
|
|
|
218
224
|
pr "bt_field_class *#{var_name};"
|
|
219
225
|
@specific_context_field_class.get_declarator(trace_class: trace_class, variable: var_name)
|
|
220
226
|
pr "bt_event_class_set_specific_context_field_class(#{variable}, #{var_name});"
|
|
227
|
+
pr "bt_field_class_put_ref(#{var_name});"
|
|
221
228
|
end
|
|
222
229
|
end
|
|
223
230
|
|
|
@@ -227,6 +234,7 @@ module Babeltrace2Gen
|
|
|
227
234
|
pr "bt_field_class *#{var_name};"
|
|
228
235
|
@payload_field_class.get_declarator(trace_class: trace_class, variable: var_name)
|
|
229
236
|
pr "bt_event_class_set_payload_field_class(#{variable}, #{var_name});"
|
|
237
|
+
pr "bt_field_class_put_ref(#{var_name});"
|
|
230
238
|
end
|
|
231
239
|
end
|
|
232
240
|
end
|
|
@@ -588,6 +596,7 @@ module Babeltrace2Gen
|
|
|
588
596
|
pr "bt_field_class *#{var_name};"
|
|
589
597
|
m.field_class.get_declarator(trace_class: trace_class, variable: var_name)
|
|
590
598
|
pr "bt_field_class_structure_append_member(#{variable}, \"#{m.name}\", #{var_name});"
|
|
599
|
+
pr "bt_field_class_put_ref(#{var_name});"
|
|
591
600
|
end
|
|
592
601
|
end
|
|
593
602
|
end
|
data/lib/metababel/version.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
module Metababel
|
|
2
|
-
VERSION = '0.0.
|
|
3
|
-
end
|
|
2
|
+
VERSION = '0.0.2'
|
|
3
|
+
end
|
data/template/downstream.c.erb
CHANGED
|
@@ -48,12 +48,32 @@ bt_trace *btx_downstream_trace_create_rec(bt_trace_class *trace_class) {
|
|
|
48
48
|
{
|
|
49
49
|
bt_stream_class *stream_class =
|
|
50
50
|
bt_trace_class_borrow_stream_class_by_index(trace_class, <%= i %>);
|
|
51
|
-
bt_stream_create(stream_class, trace);
|
|
51
|
+
bt_stream_put_ref(bt_stream_create(stream_class, trace));
|
|
52
52
|
}
|
|
53
53
|
<% end %>
|
|
54
54
|
return trace;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
// Workarround of a bug where gepping trace alive (and not the stream) provoke
|
|
58
|
+
// some segfault
|
|
59
|
+
void btx_streams_get_ref(bt_trace *trace) {
|
|
60
|
+
<% stream_classes.each_with_index do |_,i| %>
|
|
61
|
+
{
|
|
62
|
+
bt_stream *stream = bt_trace_borrow_stream_by_index(trace, <%= i %>);
|
|
63
|
+
bt_stream_get_ref(stream);
|
|
64
|
+
}
|
|
65
|
+
<% end %>
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void btx_streams_put_ref(bt_trace *trace) {
|
|
69
|
+
<% stream_classes.each_with_index do |_,i| %>
|
|
70
|
+
{
|
|
71
|
+
bt_stream *stream = bt_trace_borrow_stream_by_index(trace, <%= i %>);
|
|
72
|
+
bt_stream_put_ref(stream);
|
|
73
|
+
}
|
|
74
|
+
<% end %>
|
|
75
|
+
}
|
|
76
|
+
|
|
57
77
|
void btx_push_messages_stream_beginning(
|
|
58
78
|
bt_self_message_iterator *self_message_iterator,
|
|
59
79
|
btx_message_iterator_t *message_iterator_private_data) {
|
data/template/downstream.h.erb
CHANGED
|
@@ -17,6 +17,9 @@ btx_downstream_trace_class_create_rec(bt_self_component *self_component);
|
|
|
17
17
|
|
|
18
18
|
bt_trace *btx_downstream_trace_create_rec(bt_trace_class *trace_class);
|
|
19
19
|
|
|
20
|
+
void btx_streams_get_ref(bt_trace *trace);
|
|
21
|
+
void btx_streams_put_ref(bt_trace *trace);
|
|
22
|
+
|
|
20
23
|
void btx_push_messages_stream_beginning(
|
|
21
24
|
bt_self_message_iterator *self_message_iterator,
|
|
22
25
|
btx_message_iterator_t *message_iterator_private_data);
|
data/template/filter.c.erb
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* https://babeltrace.org/docs/v2.0/libbabeltrace2/example-simple-flt-cmp-cls.html
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
static
|
|
12
|
+
static char *get_port_name(uint64_t current) {
|
|
13
13
|
int num_len = snprintf(NULL, 0, "in%ld", current);
|
|
14
14
|
char *result = (char *)malloc(num_len + 1);
|
|
15
15
|
sprintf(result, "in%ld", current);
|
|
@@ -91,9 +91,10 @@ filter_message_iterator_next_processing_reading(
|
|
|
91
91
|
/* We are setting the state, so this function will never being call twice */
|
|
92
92
|
bt_message_iterator_put_ref(
|
|
93
93
|
message_iterator_private_data->head_mi->message_iterator);
|
|
94
|
+
struct el_mi *tmp = message_iterator_private_data->head_mi;
|
|
95
|
+
CDL_DELETE(message_iterator_private_data->head_mi, tmp);
|
|
96
|
+
free(tmp);
|
|
94
97
|
|
|
95
|
-
CDL_DELETE(message_iterator_private_data->head_mi,
|
|
96
|
-
message_iterator_private_data->head_mi);
|
|
97
98
|
if (!message_iterator_private_data->head_mi) {
|
|
98
99
|
/* Call Finalize user callback */
|
|
99
100
|
btx_call_callbacks_finalize_usr_data(
|
|
@@ -240,6 +241,7 @@ filter_initialize(bt_self_component_filter *self_component_filter,
|
|
|
240
241
|
|
|
241
242
|
/* Allocate a private data structure */
|
|
242
243
|
common_data_t *common_data = calloc(1, sizeof(common_data_t));
|
|
244
|
+
common_data->btx_params = calloc(1,sizeof(btx_params_t));
|
|
243
245
|
common_data->params = params;
|
|
244
246
|
// Read parameters
|
|
245
247
|
btx_populate_params(common_data);
|
|
@@ -274,9 +276,12 @@ filter_initialize(bt_self_component_filter *self_component_filter,
|
|
|
274
276
|
const uint64_t current =
|
|
275
277
|
bt_component_filter_get_input_port_count(common_data->component);
|
|
276
278
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
279
|
+
{
|
|
280
|
+
char *name = get_port_name(current);
|
|
281
|
+
bt_self_component_filter_add_input_port(self_component_filter, name, NULL,
|
|
282
|
+
NULL);
|
|
283
|
+
free(name);
|
|
284
|
+
}
|
|
280
285
|
bt_self_component_filter_add_output_port(self_component_filter, "out", NULL,
|
|
281
286
|
NULL);
|
|
282
287
|
|
|
@@ -289,17 +294,26 @@ filter_initialize(bt_self_component_filter *self_component_filter,
|
|
|
289
294
|
/* Instantiate a `downstream_trace` of `trace_class` and all the children
|
|
290
295
|
* stream */
|
|
291
296
|
common_data->downstream_trace = btx_downstream_trace_create_rec(trace_class);
|
|
297
|
+
btx_streams_get_ref(common_data->downstream_trace); // ??
|
|
298
|
+
bt_trace_class_put_ref(trace_class);
|
|
299
|
+
|
|
292
300
|
return BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK;
|
|
293
301
|
}
|
|
294
302
|
|
|
295
303
|
bt_component_class_port_connected_method_status
|
|
296
|
-
filter_input_port_connected(bt_self_component_filter *
|
|
304
|
+
filter_input_port_connected(bt_self_component_filter *self_component_filter,
|
|
297
305
|
bt_self_component_port_input *self_port,
|
|
298
306
|
const bt_port_output *other_port) {
|
|
299
307
|
const uint64_t current = bt_component_filter_get_input_port_count(
|
|
300
|
-
bt_self_component_filter_as_component_filter(
|
|
301
|
-
|
|
302
|
-
|
|
308
|
+
bt_self_component_filter_as_component_filter(self_component_filter));
|
|
309
|
+
|
|
310
|
+
{
|
|
311
|
+
char *name = get_port_name(current);
|
|
312
|
+
bt_self_component_filter_add_input_port(self_component_filter, name, NULL,
|
|
313
|
+
NULL);
|
|
314
|
+
free(name);
|
|
315
|
+
}
|
|
316
|
+
|
|
303
317
|
return BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_OK;
|
|
304
318
|
}
|
|
305
319
|
/*
|
|
@@ -342,6 +356,7 @@ filter_message_iterator_initialize(
|
|
|
342
356
|
el_mi *mi = (el_mi *)malloc(sizeof *mi);
|
|
343
357
|
bt_message_iterator_create_from_message_iterator(
|
|
344
358
|
self_message_iterator, self_port, &mi->message_iterator);
|
|
359
|
+
|
|
345
360
|
CDL_APPEND(message_iterator_private_data->head_mi, mi);
|
|
346
361
|
}
|
|
347
362
|
|
|
@@ -359,6 +374,19 @@ filter_message_iterator_initialize(
|
|
|
359
374
|
static void filter_finalize(bt_self_component_filter *self_component_filter) {
|
|
360
375
|
common_data_t *common_data = bt_self_component_get_data(
|
|
361
376
|
bt_self_component_filter_as_self_component(self_component_filter));
|
|
377
|
+
|
|
378
|
+
btx_streams_put_ref(common_data->downstream_trace); // ??
|
|
379
|
+
// We allocate it, we need to put ref
|
|
380
|
+
bt_trace_put_ref(common_data->downstream_trace);
|
|
381
|
+
|
|
382
|
+
// Delete name_to_dispatcher
|
|
383
|
+
name_to_dispatcher_t *current, *tmp;
|
|
384
|
+
HASH_ITER(hh, common_data->name_to_dispatcher, current, tmp) {
|
|
385
|
+
HASH_DEL(common_data->name_to_dispatcher, current);
|
|
386
|
+
utarray_free(current->callbacks);
|
|
387
|
+
free(current);
|
|
388
|
+
}
|
|
389
|
+
|
|
362
390
|
// We allocate it, we need to free it
|
|
363
391
|
free(common_data->btx_params);
|
|
364
392
|
bt_value_put_ref(common_data->params);
|
|
@@ -371,12 +399,14 @@ static void filter_message_iterator_finalize(
|
|
|
371
399
|
btx_message_iterator_t *message_iterator_private_data =
|
|
372
400
|
bt_self_message_iterator_get_data(self_message_iterator);
|
|
373
401
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
402
|
+
{
|
|
403
|
+
struct el *elt, *tmp;
|
|
404
|
+
DL_FOREACH_SAFE(message_iterator_private_data->pool, elt, tmp) {
|
|
405
|
+
DL_DELETE(message_iterator_private_data->pool, elt);
|
|
406
|
+
free(elt);
|
|
407
|
+
}
|
|
378
408
|
}
|
|
379
|
-
|
|
409
|
+
assert(!message_iterator_private_data->head_mi);
|
|
380
410
|
/* Free the allocated structure */
|
|
381
411
|
free(message_iterator_private_data);
|
|
382
412
|
}
|
|
@@ -388,10 +418,10 @@ BT_PLUGIN(<%= options[:plugin_name] %>);
|
|
|
388
418
|
BT_PLUGIN_FILTER_COMPONENT_CLASS(<%= options[:component_name] %>,
|
|
389
419
|
filter_message_iterator_next);
|
|
390
420
|
|
|
391
|
-
BT_PLUGIN_FILTER_COMPONENT_CLASS_INITIALIZE_METHOD(
|
|
392
|
-
|
|
393
|
-
BT_PLUGIN_FILTER_COMPONENT_CLASS_FINALIZE_METHOD(
|
|
394
|
-
|
|
421
|
+
BT_PLUGIN_FILTER_COMPONENT_CLASS_INITIALIZE_METHOD(
|
|
422
|
+
<%= options[:component_name] %>, filter_initialize);
|
|
423
|
+
BT_PLUGIN_FILTER_COMPONENT_CLASS_FINALIZE_METHOD(
|
|
424
|
+
<%= options[:component_name] %>, filter_finalize);
|
|
395
425
|
BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD(
|
|
396
426
|
<%= options[:component_name] %>, filter_message_iterator_initialize);
|
|
397
427
|
BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD(
|
data/template/sink.c.erb
CHANGED
|
@@ -50,6 +50,7 @@ sink_consume(bt_self_component_sink *self_component_sink) {
|
|
|
50
50
|
for (uint64_t i = 0; i < message_count; i++) {
|
|
51
51
|
const bt_message *message = messages[i];
|
|
52
52
|
if (bt_message_get_type(message) != BT_MESSAGE_TYPE_EVENT) {
|
|
53
|
+
bt_message_put_ref(message);
|
|
53
54
|
continue;
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -79,6 +80,7 @@ sink_initialize(bt_self_component_sink *self_component_sink,
|
|
|
79
80
|
const bt_value *params, void *initialize_method_data) {
|
|
80
81
|
/* Allocate a private data structure */
|
|
81
82
|
common_data_t *common_data = calloc(1, sizeof(common_data_t));
|
|
83
|
+
common_data->btx_params = calloc(1,sizeof(btx_params_t));
|
|
82
84
|
common_data->params = params;
|
|
83
85
|
// Read parameters
|
|
84
86
|
btx_populate_params(common_data);
|
|
@@ -118,6 +120,15 @@ static void sink_finalize(bt_self_component_sink *self_component_sink) {
|
|
|
118
120
|
/* Finalize User Data */
|
|
119
121
|
/* Call Finalize user callback */
|
|
120
122
|
btx_call_callbacks_finalize_usr_data(common_data, common_data->usr_data);
|
|
123
|
+
|
|
124
|
+
// Delete name_to_dispatcher
|
|
125
|
+
name_to_dispatcher_t *current, *tmp;
|
|
126
|
+
HASH_ITER(hh, common_data->name_to_dispatcher, current, tmp) {
|
|
127
|
+
HASH_DEL(common_data->name_to_dispatcher, current);
|
|
128
|
+
utarray_free(current->callbacks);
|
|
129
|
+
free(current);
|
|
130
|
+
}
|
|
131
|
+
|
|
121
132
|
// We allocate it, we need to free it
|
|
122
133
|
free(common_data->btx_params);
|
|
123
134
|
bt_value_put_ref(common_data->params);
|
|
@@ -157,8 +168,8 @@ BT_PLUGIN(<%= options[:plugin_name] %>);
|
|
|
157
168
|
/* Add the output component class */
|
|
158
169
|
BT_PLUGIN_SINK_COMPONENT_CLASS(<%= options[:component_name] %>, sink_consume);
|
|
159
170
|
|
|
160
|
-
BT_PLUGIN_SINK_COMPONENT_CLASS_INITIALIZE_METHOD(
|
|
161
|
-
|
|
171
|
+
BT_PLUGIN_SINK_COMPONENT_CLASS_INITIALIZE_METHOD(
|
|
172
|
+
<%= options[:component_name] %>, sink_initialize);
|
|
162
173
|
BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(<%= options[:component_name] %>,
|
|
163
174
|
sink_finalize);
|
|
164
175
|
|
data/template/source.c.erb
CHANGED
|
@@ -93,6 +93,7 @@ source_initialize(bt_self_component_source *self_component_source,
|
|
|
93
93
|
const bt_value *params, void *initialize_method_data) {
|
|
94
94
|
/* Allocate a private data structure */
|
|
95
95
|
common_data_t *common_data = calloc(1, sizeof(common_data_t));
|
|
96
|
+
common_data->btx_params = calloc(1,sizeof(btx_params_t));
|
|
96
97
|
common_data->params = params;
|
|
97
98
|
// Read parameters
|
|
98
99
|
btx_populate_params(common_data);
|
|
@@ -110,6 +111,8 @@ source_initialize(bt_self_component_source *self_component_source,
|
|
|
110
111
|
/* Instantiate a `downstream_trace` of `trace_class` and all the children
|
|
111
112
|
* stream */
|
|
112
113
|
common_data->downstream_trace = btx_downstream_trace_create_rec(trace_class);
|
|
114
|
+
btx_streams_get_ref(common_data->downstream_trace); // ??
|
|
115
|
+
bt_trace_class_put_ref(trace_class);
|
|
113
116
|
|
|
114
117
|
/* Set the component's user data to our private data structure */
|
|
115
118
|
bt_self_component_set_data(self_component, common_data);
|
|
@@ -161,6 +164,19 @@ source_message_iterator_initialize(
|
|
|
161
164
|
static void source_finalize(bt_self_component_source *self_component_source) {
|
|
162
165
|
common_data_t *common_data = bt_self_component_get_data(
|
|
163
166
|
bt_self_component_source_as_self_component(self_component_source));
|
|
167
|
+
|
|
168
|
+
btx_streams_put_ref(common_data->downstream_trace); // ??
|
|
169
|
+
// We allocate it, we need to put ref
|
|
170
|
+
bt_trace_put_ref(common_data->downstream_trace);
|
|
171
|
+
|
|
172
|
+
// Delete name_to_dispatcher
|
|
173
|
+
name_to_dispatcher_t *current, *tmp;
|
|
174
|
+
HASH_ITER(hh, common_data->name_to_dispatcher, current, tmp) {
|
|
175
|
+
HASH_DEL(common_data->name_to_dispatcher, current);
|
|
176
|
+
utarray_free(current->callbacks);
|
|
177
|
+
free(current);
|
|
178
|
+
}
|
|
179
|
+
|
|
164
180
|
// We allocate it, we need to free it
|
|
165
181
|
free(common_data->btx_params);
|
|
166
182
|
bt_value_put_ref(common_data->params);
|
|
@@ -190,10 +206,10 @@ BT_PLUGIN(<%= options[:plugin_name] %>);
|
|
|
190
206
|
BT_PLUGIN_SOURCE_COMPONENT_CLASS(<%= options[:component_name] %>,
|
|
191
207
|
source_message_iterator_next);
|
|
192
208
|
|
|
193
|
-
BT_PLUGIN_SOURCE_COMPONENT_CLASS_INITIALIZE_METHOD(
|
|
194
|
-
|
|
195
|
-
BT_PLUGIN_SOURCE_COMPONENT_CLASS_FINALIZE_METHOD(
|
|
196
|
-
|
|
209
|
+
BT_PLUGIN_SOURCE_COMPONENT_CLASS_INITIALIZE_METHOD(
|
|
210
|
+
<%= options[:component_name] %>, source_initialize);
|
|
211
|
+
BT_PLUGIN_SOURCE_COMPONENT_CLASS_FINALIZE_METHOD(
|
|
212
|
+
<%= options[:component_name] %>, source_finalize);
|
|
197
213
|
BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD(
|
|
198
214
|
<%= options[:component_name] %>, source_message_iterator_initialize);
|
|
199
215
|
BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD(
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metababel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Applencourt
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2023-
|
|
13
|
+
date: 2023-05-01 00:00:00.000000000 Z
|
|
14
14
|
dependencies: []
|
|
15
15
|
description:
|
|
16
16
|
email:
|
|
@@ -55,7 +55,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
56
|
version: '0'
|
|
57
57
|
requirements: []
|
|
58
|
-
|
|
58
|
+
rubyforge_project:
|
|
59
|
+
rubygems_version: 2.7.6.3
|
|
59
60
|
signing_key:
|
|
60
61
|
specification_version: 4
|
|
61
62
|
summary: Helper for creation Babeltrace plugins
|