KPROF(3) KPROF(3)
NAME
kprof - kernel profiling
SYNOPSIS
bind -a #K /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 sys-
tem 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 run-
ning. The rest each hold the number of total ticks the ker-
nel spent at any one program counter, indexed by their
offset from the minimum kernel text address.
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.
The program kprof (see prof(1)) formats the data for presen-
tation.
EXAMPLE
The following rc(1) script runs a test program while profil-
ing the kernel and reports the results.
bind -a '#K' /dev
echo start > /dev/kpctl
runtest
echo stop > /dev/kpctl
kprof /386/9pcdisk /dev/kpdata
SOURCE
/sys/src/9/port/devkprof.c
SEE ALSO
prof(1)
/plan9/man/3/