Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ (3) — Plan9 3rd Edition (Vita Nuova)

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kprof(10.1)

KPROF(3)

NAME

kprof − kernel profiling

SYNOPSIS

­bind -a #T /dev
­/dev/kpctl
­/dev/kpdata

DESCRIPTION

The ­kprof device provides simple profiling data for the operating system kernel.   The data accumulates by recording the program counter of the kernel at each ‘tick’ of the system clock. 

The file ­kpdata holds the accumulated counts as 4-byte integers in big-endian byte order.  The size of the file depends on the size of kernel text.  The first count holds the total number of clock ticks during profiling; the second the number of ticks that occurred while the kernel was running.  The rest each hold the number of ticks the kernel program counter was within the corresponding 8-byte range of kernel text, starting from the base of kernel text. 

The file ­kpctl controls profiling.  Writing the string ­start to ­kpctl begins profiling; ­stop terminates it.  The message ­startclr restarts profiling after zeroing the array of counts. 

Kprof(10.1) formats the data for presentation.

EXAMPLE

The following sh(1) commands define and invoke a function ­sample that runs a given test program with kernel profiling enabled, and copies the result to a server presumed to be mounted on /n/remote. 

fn sample {
echo start >/dev/kpctl
$1
echo stop >/dev/kpctl
cp /dev/kpdata /n/remote/tmp/kpdata
}
bind -a ’#T’ /dev
sample {cp sound /dev/audio}

On the server, the kprof(10.1) command is used to analyse the data:

kprof /usr/inferno/os/mpc/impc /tmp/kpdata

SOURCE

­/os/port/devkprof.c

SEE ALSO

kprof(10.1)

BUGS

It cannot provide times for each node in the dynamic call graph (dynamic profiling). 

Plan 9  —  May 08, 2000

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026