[ann] time interval instrumentation tool

From: Andrew Morton (andrewm@uow.edu.au)
Date: Mon Mar 06 2000 - 08:57:41 EST


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/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:19 EST