lkml.org 
[lkml]   [2000]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[ann] time interval instrumentation tool
Inspired by net/core/profile.c I have put together some infrastructure
(called 'timepegs') which use the Pentium timestamp counter to
precisely measure elapsed time between arbitrary points in kernel code.
Hopefully it will prove useful to someone.

Simple example:

#include <linux/timepeg.h>

foo()
{
TIMEPEG("start_tp");
do_something();
TIMEPEG("stop_tp");
}

< compile, reboot, exercise code under test >

prompt> /usr/local/bin/tpt

Destination Count Average Min Max
start_tp ->
stop_tp 54 17.43 10.33 29.78

stop_tp ->
start_tp 53 24,877.74 30.44 311,667.07


The timepeg code builds a directed graph where the nodes represent
occurrences of the TIMEPEG() macro. The weights on the edges are the
min, max and average number of microseconds between the TIMEPEG()
macros.

The interval between timepegs is recorded on a per-CPU basis. It is
probably not interesting to know the inter-CPU timing between timepeg
traversals (then again, maybe it is).

Sometimes you may wish to know the time interval between two particular
timepegs which have intervening timepegs. For complex graphs this is
tiresome to calculate and may be inaccurate due to loss of path
information. So there is support for 'directed timepegs':

foo()
{
TIMEPEG(entry);
do_something();
TIMEPEG(after_something);
do_something_else();
TIMEPEG(candybar);
do_final_thing();
DTIMEPEG(final_tp, entry);
}

The final macro call here is a directed timepeg. The 'final_tp'
timepeg will tell you the total time to traverse the function foo().

The documentation, 'tpt' tool and a patch against 2.3.49 may be
found at http://www.uow.edu.au/~andrewm/linux/

Caveat #1: I would have liked another day or two to test some corner
cases, but I'll be unwired for the next week or so. Release early...

Caveat #2: Compiled and tested for SMP, but only on a UP.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.059 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site