From: Ralf Baechle <ralf@linux-mips.org>
To: bora.sahin@ttnet.net.tr
Cc: linux-mips@linux-mips.org
Subject: Re: Measuring time
Date: Sun, 25 Mar 2007 00:54:17 +0000 [thread overview]
Message-ID: <20070325005417.GA692@linux-mips.org> (raw)
In-Reply-To: <200703242025.10303.bora.sahin@ttnet.net.tr>
On Sat, Mar 24, 2007 at 08:25:10PM +0200, bora.sahin@ttnet.net.tr wrote:
> I want to meause the time between irq_enter and my consumer driver read
> routine. How can I do that or which toool should I use?
That's a very specific question so standard tools don't seem to be
applicable. I suggest you simple use the CPU's count register to meassure
the time. It can be used like:
#include <linux/kernel.h>
#include <asm/mipsregs.h>
void foo(void)
{
unsigned int start, end;
start = read_c0_counter();
printk("Goodbye, cruel world ...\n");
end = read_c0_counter();
printk("Time for printk: %d\n", end - start);
}
Note that some very old MIPS processors don't have such a counter. Also
in some cores the counter will increment once per cycle on others it will
increment every 2nd cycle and on yet others such as the RM5230 this is
configurable. So you may want to check your processor manual.
The cp0 counter is the timer of choice for this meassurement because it's
very high resolution and can can be accessed with low overhead making
it ideal for the very short time you want to meassure.
Cheers,
Ralf
prev parent reply other threads:[~2007-03-25 0:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-24 18:25 Measuring time bora.sahin
2007-03-25 0:54 ` Ralf Baechle [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=20070325005417.GA692@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=bora.sahin@ttnet.net.tr \
--cc=linux-mips@linux-mips.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