kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: michi1@michaelblizek.twilightparadox.com (michi1 at michaelblizek.twilightparadox.com)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How to measure performance inside Kernel?
Date: Thu, 9 Feb 2012 19:12:24 +0100	[thread overview]
Message-ID: <20120209181223.GA2184@grml> (raw)
In-Reply-To: <CA+MoWDrO0PbKfs=qgzthoEuob2uAirOfhjpdU__GLG34eSaqpw@mail.gmail.com>

Hi!

On 10:58 Thu 09 Feb     , Peter Senna Tschudin wrote:
...
> But I want to repeat the tests on specific portion of code, not on
> entire application. Is there a safe way of do something like:
> 
> start_bench ( ?? ); /* start measurement */
> 
> buf_ptr_end = q->bufs[q->num_buffers];
> 
> for (buf_ptr = q->bufs[0]; buf_ptr < buf_ptr_end; ++buf_ptr)
>        buf_ptr->state = VB2_BUF_STATE_DEQUEUED;
> 
> end_bench ( ?? ); /* end measurement */

Yes, you can do this. If you search for a way for time measurement, take a
look at include/linux/ktime.h .

> And is this the correct approach for testing the performance of
> specific portion of Kernel code?

Why not? I would be a be worried about how the cpu-cache effects the
measurement, especially because your benchmark already showed that a
significant time is spent there.

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com

  reply	other threads:[~2012-02-09 18:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09 12:58 How to measure performance inside Kernel? Peter Senna Tschudin
2012-02-09 18:12 ` michi1 at michaelblizek.twilightparadox.com [this message]
2012-02-10 21:47 ` Peter Senna Tschudin
2012-02-10 22:06   ` Jeff Haran
2012-02-11  0:22     ` Peter Senna Tschudin
2012-02-11  3:44       ` Graeme Russ
2012-02-11 13:14         ` Peter Senna Tschudin
2012-02-11 13:57           ` Peter Senna Tschudin
2012-02-12 11:46             ` Mulyadi Santosa
2012-02-13 23:13               ` Peter Senna Tschudin
2012-02-14  3:43                 ` Mulyadi Santosa
2012-02-11  7:34       ` michi1 at michaelblizek.twilightparadox.com
2012-02-11  7:22   ` michi1 at michaelblizek.twilightparadox.com
2012-02-11 13:29     ` Peter Senna Tschudin

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=20120209181223.GA2184@grml \
    --to=michi1@michaelblizek.twilightparadox.com \
    --cc=kernelnewbies@lists.kernelnewbies.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).