From: Douglas Raillard <douglas.raillard@arm.com>
To: Hidenori Kobayashi <hidenorik@chromium.org>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>,
rostedt@goodmis.org,
Nikita Baksalyar <nikita.baksalyar@gmail.com>
Subject: Re: libtraceevent + Rust
Date: Mon, 13 Feb 2023 12:04:36 +0000 [thread overview]
Message-ID: <35fe67d1-0865-486f-bdbe-5eb8e034352d@arm.com> (raw)
In-Reply-To: <20230213051727.hvkd5wgqhxi66gqh@google.com>
Hi Hidenori,
> On 13-02-2023 05:17, Hidenori Kobayashi wrote:
> Hi Douglas,
>
> On Fri, Oct 14, 2022 at 04:16:33PM +0100, Douglas Raillard wrote:
>> Hi everyone,
>>
>> The idea of having some Rust interop for libtraceevent was floated during the
>> Tracing Summit that took place this week.
>>
>> The overall work has two scopes:
>> 1. libtraceevent: low-level helpers to decode event formats and binary buffer pages.
>> 2. high level API that e.g. can consume a trace.dat file and expose an iterator API etc.
>>
>> The current discussion is only about #1. The 2nd part of the work has an
>> entirely different set of constraints as it would aim at integrating in the
>> Rust ecosystem as well as possible without trying to replace anything
>> pre-existent.
>
> Has anyone actually started working on these?
We have, this has been my main focus since around November.
>
> I have a Rust tool that parses the output from trace-cmd to infer the
> internal states of a kernel module. While it serves our needs for now,
> Steven kindly pointed me to this thread and suggested interacting
> directly with the tracefs and using the tracefs libraries for parsing.
>
> So I'd like to know:
> - if this discussion reached a consensus
You are the first one to answer on that thread but the twitter poll from Steven was encouraging. At any
rate, we need it for LISA [1] so I'm making it happen.
> - if there is any publicly available work already
Yes and no: I'm currently developing it as part of LISA but in its own "traceevent" crate,
as added by that PR under tools/analysis/traceevent/:
https://github.com/ARM-software/lisa/pull/1843
This is very much WIP, so far I got:
* A parser for v6 header up to and including the event formats.
Since that requires a C parser, it was a large chunk of the total work.
* A C interpreter as (somewhat) required for array lengths and mostly for the print fmt args.
* a zero-copy I/O layer that can load data from:
* existing in-memory buffer
* Any type implementing Read + Seek
* mmap
Adding support for v7 header should be straightforward except for the I/O that might require adjustment
depending on how compression is implemented.
My current roadmap is:
1. Get to a state where I can share a trace-cmd report equivalent static tool for people to play with on
their own data and report issues.
2. Make a serde backend hooked to it since we need it for LISA (assuming performance is good enough)
3. Figure out exactly how it sits in the libtraceevent ecosystem and maintains it in the
long run, libtraceevent-style C bindings etc.
Note that if and when a serde backend is available, that should bring a conversion to JSON for basically free.
Unless I'm sidetracked by urgent things, 1. and 2. should become available in a few months. I expect 3. to happen
when I have something concrete to show to the world.
[1] LISA: https://github.com/ARM-software/lisa
>
> Thanks,
> Hidenori
Thanks,
Douglas
next prev parent reply other threads:[~2023-02-13 12:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 15:16 libtraceevent + Rust Douglas Raillard
2023-02-13 5:17 ` Hidenori Kobayashi
2023-02-13 12:04 ` Douglas Raillard [this message]
2023-02-14 3:56 ` Hidenori Kobayashi
2023-02-14 10:38 ` Douglas Raillard
2023-02-15 0:36 ` Hidenori Kobayashi
2024-09-20 9:48 ` Douglas Raillard
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=35fe67d1-0865-486f-bdbe-5eb8e034352d@arm.com \
--to=douglas.raillard@arm.com \
--cc=hidenorik@chromium.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=nikita.baksalyar@gmail.com \
--cc=rostedt@goodmis.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).