Re: [RFC] [Patch 7/8] statistics infrastructure - exploitationprerequisite

From: Christoph Lameter
Date: Tue May 16 2006 - 22:24:27 EST

On Wed, 17 May 2006, Peter Chubb wrote:

> I measured do_gettimeofday on IA64 at around 120 cycles (mind you that
> was some time ago now, before the last lot of time function revisions
> in the kernel). Whether that's slow or not depends on your application.

What I did for time critical statistics in core vm paths is to use
get_cycles() but associate each cycle value with a processor id when the
measurements starts. If the processor id has changed when we end the
measurement then discard the measurement and just note that we missed one.

Here is a piece of a description for a patch that I have used in the past
for these statistics:


The patch puts three performance counters into critical kernel paths to
show how its done.

The measurements will show up in /proc/perf/all. Processor specific
statistics may be obtained via /proc/perf/<nr-of-processor>. Writing to
will reset all counters. F.e.

echo >/proc/perf/reset

Sample output:

AllocPages 786882 (+ 0) 9.9s(223ns/12.6us/48.6us) 12.9gb(16.4kb/16.4kb/32.8kb)
FaultTime 786855 (+192) 10.4s(198ns/13.2us/323.6us)
PrepZeroPage 786765 (+ 0) 9.2s(549ns/11.7us/48.1us) 12.9gb(16.4kb/16.4kb/16.4kb)

The first countr is the number of times that the time measurement was
performed.(+ xx) is the number of samples that were thrown away since the
processor on which the process is running changed. Cycle counters are not
consistent across different processors.

Then follows the sum of the time spend in the code segment followed in
parenthesesby the minimum / average / maximum time spent there. The
second block are the sizes of data processed. In this sample 12.9 GB was
allocated via AllocPages. Most allocations were 16k = 1 page although
there were also 32K (2 page) allocations.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at