linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yordan Karadzhov <y.karadz@gmail.com>
To: John Keeping <john@metanate.com>, linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH] kernel-shark: Handle traces with sched_wakeup but not sched_waking
Date: Mon, 27 Sep 2021 12:56:56 +0300	[thread overview]
Message-ID: <3d74a4da-623e-d22f-58e2-ee6617a8c465@gmail.com> (raw)
In-Reply-To: <20210923140643.3975473-1-john@metanate.com>



On 23.09.21 г. 17:06, John Keeping wrote:
> If sched_wakeup or sched_wakeup_new is avaiable but sched_waking is not,
> then define_wakeup_event() returns true even though waking_event_ptr is
> null.
> 
> Change find_wakeup_event() to avoid overwriting the output parameter on
> error so that the define_wakeup_event() returns true iff
> *waking_event_ptr is non-null.
> 
> Signed-off-by: John Keeping <john@metanate.com>

Thanks a lot for helping us to improve KernelShark!

It seems that you are interested in analyzing wakeup latency and you are keen of digging into code, so I would like to 
point you to something new that may be interesting for you.

We are trying to develop Python bindings for the tracing libraries, including libkshark. Here is one very simple example 
script that plots the distribution of the latency and generates a description of a KernelShark session directly showing 
the largest latency:
https://github.com/vmware/trace-cruncher/blob/master/examples/sched_wakeup.py

Note that this example is supposed to demonstrate the Python APIs, not to do something that is particularly useful on 
its own. But you should be able to easily adapt it to your own needs. The installation of the Python module is very 
simple. See the README here:
https://github.com/vmware/trace-cruncher

Please let me know if this is something interesting for you. I will be vary happy to receive patches from you for this 
project as well. I am pretty sure you will find bugs ;-)

Once again, thanks a lot for the KernelShark patches!
Cheers,
Yordan


> ---
>   src/libkshark-tepdata.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
> index 865ca82..9740ed9 100644
> --- a/src/libkshark-tepdata.c
> +++ b/src/libkshark-tepdata.c
> @@ -1868,9 +1868,14 @@ int kshark_tep_find_top_stream(struct kshark_context *kshark_ctx,
>   static bool find_wakeup_event(struct tep_handle *tep, const char *wakeup_name,
>   			      struct tep_event **waking_event_ptr)
>   {
> -	*waking_event_ptr = tep_find_event_by_name(tep, "sched", wakeup_name);
> +	struct tep_event *event;
> +
> +	event = tep_find_event_by_name(tep, "sched", wakeup_name);
> +
> +	if (event)
> +		*waking_event_ptr = event;
>   
> -	return (*waking_event_ptr)? true : false;
> +	return !!event;
>   }
>   
>   /**
> 

      reply	other threads:[~2021-09-27  9:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 14:06 [PATCH] kernel-shark: Handle traces with sched_wakeup but not sched_waking John Keeping
2021-09-27  9:56 ` 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=3d74a4da-623e-d22f-58e2-ee6617a8c465@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=john@metanate.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).