lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
* [lttng-dev] LTTng event identification
@ 2020-08-13 13:52 Valentin Grigorev via lttng-dev
  2020-08-13 14:42 ` Philippe Proulx via lttng-dev
  0 siblings, 1 reply; 2+ messages in thread
From: Valentin Grigorev via lttng-dev @ 2020-08-13 13:52 UTC (permalink / raw)
  To: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 1747 bytes --]

Hello!

I'm using LTTng live session and Babeltrace 2 C API to analyze events in
online mode.

I would like to route event processing statically (using IDs, without
parsing strings). And currently, I don't understand if it is possible with
LTTng.

Babeltrace 2 C API provides bt_event_class_get_id function, but the only
guarantee about IDs received from this function is "All the event classes
of a given stream class have unique numeric IDs
<https://babeltrace.org/docs/v2.0/libbabeltrace2/group__api-tir-ev-cls.html#api-tir-ev-cls-prop-id>".
And even more, it is mentioned further that stream class can automatically
assign event class IDs in some cases (q.v.
https://babeltrace.org/docs/v2.0/libbabeltrace2/group__api-tir-ev-cls.html).
If I understand correctly, it means, that these IDs are assigned by
Babeltrace library, not by LTTng itself or tracepoint provider, and as
result, the same tracepoints can produce events with different event class
IDs even within the same tracing session. Am I right?

At the same time, in ETW (Event Tracing for Windows) event type is fully
identified by 3 parameters: provider GUID, event id, event version. I would
like to have something like this. At least I need to know that ID for the
same tracepoint is constant, unique within a tracepoint provider, and not
depends on a session configuration, other providers, etc.

Summarizing, I'm interested in the following questions:
  * Do event class IDs depend on a session configuration (which events were
enabled)?
  * If so, maybe there are some other IDs satisfying the above requirements
in LTTng/Babeltrace?
  * Do any IDs for tracepoint providers exist in LTTng? Or parsing event
name is the only way to identify it?

Best regards,
Valentin Grigorev

[-- Attachment #1.2: Type: text/html, Size: 2482 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [lttng-dev] LTTng event identification
  2020-08-13 13:52 [lttng-dev] LTTng event identification Valentin Grigorev via lttng-dev
@ 2020-08-13 14:42 ` Philippe Proulx via lttng-dev
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Proulx via lttng-dev @ 2020-08-13 14:42 UTC (permalink / raw)
  To: Valentin Grigorev; +Cc: lttng-dev

On Thu, Aug 13, 2020 at 9:52 AM Valentin Grigorev via lttng-dev
<lttng-dev@lists.lttng.org> wrote:
>
> Hello!
>
> I'm using LTTng live session and Babeltrace 2 C API to analyze events
> in online mode.
>
> I would like to route event processing statically (using IDs, without
> parsing strings). And currently, I don't understand if it is possible
> with LTTng.
>
> Babeltrace 2 C API provides bt_event_class_get_id function, but the
> only guarantee about IDs received from this function is "All the event
> classes of a given stream class have unique numeric IDs". And even
> more, it is mentioned further that stream class can automatically
> assign event class IDs in some cases (q.v.
> https://babeltrace.org/docs/v2.0/libbabeltrace2/group__api-tir-ev-cls.html).
> If I understand correctly, it means, that these IDs are assigned by
> Babeltrace library, not by LTTng itself or tracepoint provider, and as
> result, the same tracepoints can produce events with different event
> class IDs even within the same tracing session. Am I right?

In LTTng's case, which generates CTF traces, LTTng assigns the event
class IDs. A Babeltrace 2 `src.ctf.lttng-live` component simply uses
them as is to create event class objects. But LTTng assigns those event
class IDs dynamically, so, indeed, there's no guarantee that you'll
always get the same.

We generally use event class names to identify event classes.

>
> At the same time, in ETW (Event Tracing for Windows) event type is
> fully identified by 3 parameters: provider GUID, event id, event
> version. I would like to have something like this. At least I need to
> know that ID for the same tracepoint is constant, unique within a
> tracepoint provider, and not depends on a session configuration, other
> providers, etc.

It is very likely that CTF 2 will introduce a similar concept to
uniquely identify an event class without having to rely on its name
exclusively. Some namespace (based on a domain name and year, for
example; think XML/YAML/etc.) + a name + a version would be a good
start. For example:

    ns: lttng.org/ns/ctf/modules
    name: sched_switch
    version: 3

We could also merge all that into a single URI. I need to reflect on
this with other developers.

>
> Summarizing, I'm interested in the following questions:
>   * Do event class IDs depend on a session configuration (which events were enabled)?

Yes, in that LTTng assigns event class IDs sequentially, as needed,
without any relation to the tracepoints.

>   * If so, maybe there are some other IDs satisfying the above requirements in LTTng/Babeltrace?

No.

>   * Do any IDs for tracepoint providers exist in LTTng? Or parsing event name is the only way to identify it?

The usual strategy is for a Babeltrace 2 component to map event class
IDs to some private event class identifications somewhere (using a hash
table, for example). In LTTng live's case, it's possible that new event
classes appear later, so you need to take this into account.

Then when consuming an event message, the component first tries to find
its class's identification using its class's ID (hash table lookup, for
example). If the component cannot find the event class identification,
it uses its name to determine its identification and then maps its ID to
this identification.

Tell me if you want more details about this strategy.

Hope this helps,

Phil

>
> Best regards,
> Valentin Grigorev
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-13 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 13:52 [lttng-dev] LTTng event identification Valentin Grigorev via lttng-dev
2020-08-13 14:42 ` Philippe Proulx via lttng-dev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).