libtracecmd API extensions

"MOESSBAUER, Felix" <[email protected]> Thu, 20 Nov 2025 12:24:18 +0000
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
Dear Tracers,

while developing a kernel ftrace to Common Trace Format (CTF) converter
[1], I noticed a couple of aspects of the libtracecmd API I would like
to discuss. In general, I am VERY happy with the libtracefs,
libtraceevent and libtracecmd API. These are great libraries which
really helped to get this implemented easily.

Trace clocks:

- Information about the used trace clock is available in the trace.dat,
however there is no public API to extract it
- A trace clock (e.g. mono) to world-clock snapshot could be added to
the trace.dat to more easily align the trace with other traces

Metadata:

- some metadata (like uname) is already included in the trace.dat,
however the APIs to retrieve it are private: tracecmd_get_uname
- further metadata like a full "uname -a" output and /proc/cmdline
would be helpful

Event time ranges:

- it would be good to have an API to get the first and last event
timestamp per CPU (I'm currently fully walking the events to get that
data)

PS:
We are also looking into writing a converter in the opposite direction
(i.e. CTF -> ftrace binary format / trace.dat), but it looks like the
libtraceevent is a pure parsing library and cannot be used for
synthesizing. Is this true, or did I miss something?

[1] https://github.com/siemens/bt2-ftrace-to-ctf

Best regards,
Felix Moessbauer

-- 
Siemens AG
Linux Expert Center
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany