Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: staffan@eternaltraveller.com (Staffan Tjernstrom)
Subject: [lttng-dev] [lttng-ust] [babeltrace] use case question - field names in event classes
Date: Wed, 12 Oct 2016 08:51:46 -0500	[thread overview]
Message-ID: <7110ec441dc2f14caee4a447826c31f7.squirrel@email.powweb.com> (raw)
In-Reply-To: <CAB4xu_0ohmGica3QkEMR2sXNdhmqQvnfethmjHQig3EFaULrhQ@mail.gmail.com>

>
> 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 at 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.



  reply	other threads:[~2016-10-12 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11 14:46 Staffan Tjernstrom
2016-10-12 13:33 ` Philippe Proulx
2016-10-12 13:51   ` Staffan Tjernstrom [this message]
2016-10-12 15:23     ` Julien Desfossez
2016-10-12 15:36       ` Staffan Tjernstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7110ec441dc2f14caee4a447826c31f7.squirrel@email.powweb.com \
    --to=staffan@eternaltraveller.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox