>
> In the code, before calling the associated `two_ints_and_string`
> tracepoint, and only once:
>
>     tracepoint(my_app, log_statement_field_names, 1,
>                "widget_height", "widget_width", "widget_name", "");
>
> Then:
>
>     tracepoint(my_app, two_ints_and_string, 1, height, width, name);
>
> Then in your Python script you can register the dynamic field names
> when
> you get a `log_statement_field_names` event and use them when you get
> a
> "real" event (not tested):
>
>     id_to_field_names = {}
>
>     # open trace, etc.
>
>     # some loop over the trace's events:
>         if evt.name == 'log_statement_field_names':
>             field_names = (evt['arg1'], evt['arg2'], evt['arg3'],
> evt['arg4'])
>             id_to_field_names[evt['id']] = field_names
>         elif evt.name == 'two_ints_and_string':
>             field_names = id_to_field_names[evt['id']]
>             print('{}: {}'.format(field_names[0], evt['value1']))
>             print('{}: {}'.format(field_names[1], evt['value2']))
>             print('{}: {}'.format(field_names[2], evt['value3']))
>             print()
>
> Now this is a great use case for future extensions of LTTng-UST and/or
> the upcoming CTF 2.
>
> Phil
>
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev@lists.lttng.org
>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
Thanks - I hadn't thought of the Python bindings - I think we could
make that work (maybe wrapping the two tracepoint incantations into a
single macro definition).

Staffan Tj.

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to