From: Yordan Karadzhov <y.karadz@gmail.com>
To: Matteo Bertolino <matteo.bertolino@huawei.com>,
"linux-trace-users@vger.kernel.org"
<linux-trace-users@vger.kernel.org>
Subject: Re: Kernelshark: funcgraph_exit events don't seem to exit?
Date: Thu, 8 Sep 2022 22:04:19 +0300 [thread overview]
Message-ID: <24b50f34-b1ab-27d5-9c31-89a95d3d9fb5@gmail.com> (raw)
In-Reply-To: <134054c70c58468383174c1f62179fc3@huawei.com>
Hi Matteo,
On 9/7/22 11:08, Matteo Bertolino wrote:
> If that doesn't annoy you too much, may you give me some hints about writing a Kernelshark's plugin?
As I already mentioned, we have a plugin for sched events, so you can
use this plugin as starting point, despite that your plugin will be by
far simpler.
Have a look here
https://git.kernel.org/pub/scm/utils/trace-cmd/kernel-shark.git/tree/src/plugins/sched_events.h
and here
https://git.kernel.org/pub/scm/utils/trace-cmd/kernel-shark.git/tree/src/plugins/sched_events.c
and see how you can define a context object for your plugin and how you
can register a plugin action that will be executed over each entry in
the data that is event of a given type. Example of such action for
sched_switch events:
https://git.kernel.org/pub/scm/utils/trace-cmd/kernel-shark.git/tree/src/plugins/sched_events.c#n102
As a first step, try to register a plugin action for the
'funcgraph_exit' event that will set the 'pid' of the entry to 'idle'
entry->pid = stream->idle_pid
This will be enough to have half of the work done.
You can build your plugin, using the 'BUILD_PLUGIN' macro here:
https://git.kernel.org/pub/scm/utils/trace-cmd/kernel-shark.git/tree/src/plugins/CMakeLists.txt
Let me know when you are ready with this and we will figure out how to
implement the other features that you want.
cheers,
Yordan
prev parent reply other threads:[~2022-09-08 19:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 9:29 Kernelshark: funcgraph_exit events don't seem to exit? Matteo Bertolino
2022-09-06 10:45 ` Yordan Karadzhov
2022-09-06 11:57 ` Matteo Bertolino
2022-09-06 18:01 ` Yordan Karadzhov
2022-09-07 8:08 ` Matteo Bertolino
2022-09-08 19:04 ` Yordan Karadzhov [this message]
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=24b50f34-b1ab-27d5-9c31-89a95d3d9fb5@gmail.com \
--to=y.karadz@gmail.com \
--cc=linux-trace-users@vger.kernel.org \
--cc=matteo.bertolino@huawei.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;
as well as URLs for NNTP newsgroup(s).