DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Managing system performance

Kernel profiling

Kernel profiling is a mechanism that allows you to determine where the operating system is spending its time during operation. It consists of commands that control the profiling process and commands that generate reports. (See profiler(1M) for a description of these commands.) The system profiler samples the program counter on every clock interrupt and increments the counter corresponding to the kernel function shown by that value of the program counter.

When enabled, the system profiler initializes the sampling mechanism with the addresses of kernel functions. During initialization, any dynamically loadable kernel modules that are present in memory are locked in place. Likewise, any modules that are later loaded are locked in place if profiling is enabled. Therefore it's important to disable profiling after your measurements are complete; if you don't, the dynamically loaded modules remain resident in memory, decreasing the amount of memory available for other purposes and making your system run slower than usual.

Here's a brief description of the profiling commands:

To operate the system profiler, run either prfdc or prfsnap to collect samples of the profiling counters, and run prfpr to print the profiling results. When profiling is complete, run prfstat off to disable the profiler and unlock the dynamically loadable kernel modules.

For example:

   /usr/sbin/prfsnap temp
     <some time passes, with or without system activity>
   prfsnap temp
   prfpr temp
   prfstat off

If you want the profiler to begin automatically when you boot the system to multiuser state, you can add the following lines to the /etc/init.d/perf file:

   /usr/sbin/prfstat on
The prf shell script is executed during system initialization and the following messages are displayed:
   profiling enabled
   

xxx kernel text addresses loaded

where xxx states how many kernel text addresses are in the current system kernel.
Next topic: Loading the system profiler (prfld)
Previous topic: Reporting application turnaround with timex

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004