public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* KPROBES: Instrumenting a function's call site
@ 2007-09-25 22:12 Avishay Traeger
  2007-09-26  4:39 ` Ananth N Mavinakayanahalli
  2007-09-26 16:37 ` Abhishek Sagar
  0 siblings, 2 replies; 12+ messages in thread
From: Avishay Traeger @ 2007-09-25 22:12 UTC (permalink / raw)
  To: prasanna, ananth, anil.s.keshavamurthy, davem; +Cc: linux-kernel

Hello,
I am trying to use kprobes to measure the latency of a function by
instrumenting its call site.  Basically, I find the call instruction,
and insert a kprobe with a pre-handler and post-handler at that point.
The pre-handler measures the latency (reads the TSC counter).  The
post-handler measures the latency again, and subtracts the value that
was read in the pre-handler to compute the total latency of the called
function.

So to measure the latency of foo(), I basically want kprobes to do this:
pre_handler();
foo();
post_handler();

The problem is that the latencies that I am getting are consistently low
(~10,000 cycles).  When I manually instrument the functions, the latency
is about 20,000,000 cycles.  Clearly something is not right here.

Is this a known issue?  Instead of using the post-handler, I can try to
add a kprobe to the following instruction with a pre-handler.  I was
just curious if there was something fundamentally wrong with the
approach I took, or maybe a bug that you should be made aware of.

Please CC me on any replies (not subscribed to LKML).

Thanks,
Avishay


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-11-12 10:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-25 22:12 KPROBES: Instrumenting a function's call site Avishay Traeger
2007-09-26  4:39 ` Ananth N Mavinakayanahalli
2007-09-26  9:03   ` Ananth N Mavinakayanahalli
2007-09-26 16:09     ` Avishay Traeger
2007-09-26 17:27       ` Ananth N Mavinakayanahalli
2007-09-26 17:35         ` Avishay Traeger
2007-09-26 16:52   ` Abhishek Sagar
2007-09-26 17:28   ` Keshavamurthy, Anil S
2007-09-26 17:37     ` Avishay Traeger
2007-11-08 19:42   ` Avishay Traeger
2007-11-12 10:27     ` Ananth N Mavinakayanahalli
2007-09-26 16:37 ` Abhishek Sagar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox