From: Steven Rostedt <rostedt@goodmis.org>
To: "MOESSBAUER, Felix" <felix.moessbauer@siemens.com>
Cc: "linux-trace-devel@vger.kernel.org"
<linux-trace-devel@vger.kernel.org>,
"Kiszka, Jan" <jan.kiszka@siemens.com>
Subject: Re: libtracecmd API extensions
Date: Thu, 20 Nov 2025 13:08:40 -0500 [thread overview]
Message-ID: <20251120130840.357cbca6@gandalf.local.home> (raw)
In-Reply-To: <ee6cc8b90fb0d71f412645d7671b7130d72fecc2.camel@siemens.com>
On Thu, 20 Nov 2025 12:24:18 +0000
"MOESSBAUER, Felix" <felix.moessbauer@siemens.com> wrote:
> Dear Tracers,
Hello!
>
> 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
So, libtracecmd is still very much a work in progress, of something I never
seem to have the time to work on :-p I don't want to make the mistake I
made with libtraceevent, and have APIs exposed before they are ready. I hate
most of the libtraceevent APIs, but that's because it was ported over to
perf before it was complete, and we got stuck with what we have.
libtracefs was much more planned, and has a better API because of that.
I have lots of ideas for libtracecmd. In fact, the goal is to make
trace-cmd a simple shell of the library, and have every feature of
trace-cmd exposed to other tools. Unfortunately, I just don't have the time
to work on it.
Hence, if you want to add these APIs, I'm more than happy to review any
patches you send my way!
>
> 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)
Hmm, I could have sworn I implemented something like this in the past.
Perhaps I only did it to my local tree. I have lots of updates to trace-cmd
that haven't made it out to public (simply because they are still in debug
form).
There is a way to iterate backwards:
tracecmd_iterate_events_reverse()
That would give you the last event without walking all events.
>
> 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?
>
Yeah, libtraceevent was made to be purely parsing. In fact, there was an
effort to convert it over to flex/bison. But again, time ran out.
That said, if you want to add a feature to create formats, that could
definitely be added.
Cheers,
-- Steve
next prev parent reply other threads:[~2025-11-20 18:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 12:24 libtracecmd API extensions MOESSBAUER, Felix
2025-11-20 18:08 ` Steven Rostedt [this message]
2025-11-21 10:56 ` MOESSBAUER, Felix
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=20251120130840.357cbca6@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=felix.moessbauer@siemens.com \
--cc=jan.kiszka@siemens.com \
--cc=linux-trace-devel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).