forsyth20121205-174063a80cc13 years agoHistory
88 lines · 2.2 KB · Text
RawDownload
.TH KPROF 3 .SH NAMEkprof \- kernel profiling.SH SYNOPSIS.nf.B bind -a #T /dev.sp.B /dev/kpctl.B /dev/kpdata.fi.SH DESCRIPTIONThe.I kprofdevice provides simple profilingdata for the operating system kernel.   The data accumulates byrecording the program counter of the kernel at each `tick' of aprofiling clock. Often this is just the system clock, but may be anindependent higher priority timer which allows profiling of interrupthandlers, dependent on implementation..PPThe file.B kpdataholds the accumulated counts in big-endianbyte order.The size of the file depends on the size of kernel text, and thesize of the individual counts.The first six counts are 4 bytes in size, and are special. Thefirst holds the total number of ticks, the second the number ofticks which fell outside the kernel text, the third the numberof microseconds per tick, the fourth the number of sample buckets,the fifth the size in bytes of each sample bucket, and sixth thelog base 2 of the sample bucket size. Typically the sample sizeis 4, and the log base 2 of the bucket size 3 (8 bytes). The remainderof the file holds the sample buckets. The entire file has size.I "sample bucket size"times.IR "number of sample buckets" .That is, the first six sample buckets are replaced with the specialnumbers..PPThe file.B kpctlcontrols profiling.Writing the string.B startto.B kpctlbegins profiling;.B stopterminates it.  The message.B startclrrestarts profiling after zeroing the array of counts..PP.IR Kprof (10.1)formats the data for presentation..SH EXAMPLEThe following.IR sh (1)commands define and invoke afunction.B samplethat runs a given test program with kernel profiling enabled,and copies the result to a server presumed to be mounted on.BR /n/remote ..sp.EXfn sample {	echo start >/dev/kpctl	$1	echo stop >/dev/kpctl	cp /dev/kpdata /n/remote/tmp/kpdata}bind -a '#T' /devsample {cp sound /dev/audio}.EE.PPOn the server, the.IR kprof (10.1)command is used to analyse the data:.EX	kprof /usr/inferno/os/mpc/impc /tmp/kpdata.EE.SH SOURCE.B /os/port/devkprof.c.SH SEE ALSO.IR kprof (10.1).SH BUGSIt cannot provide times for each node in the dynamic call graph (dynamic profiling).