1 .\" Copyright (c) 1984 M. K. McKusick
2 .\" Copyright (c) 1984 The Regents of the University of California.
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. Neither the name of the University nor the names of its contributors
14 .\" may be used to endorse or promote products derived from this software
15 .\" without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" @(#)0.t 1.2 (Berkeley) 11/8/90
36 Using gprof to Tune the 4.2BSD Kernel
38 Marshall Kirk McKusick
40 Computer Systems Research Group
41 Computer Science Division
42 Department of Electrical Engineering and Computer Science
43 University of California, Berkeley
44 Berkeley, California 94720
46 This paper describes how the \fIgprof\fP profiler
47 accounts for the running time of called routines
48 in the running time of the routines that call them.
49 It then explains how to configure a profiling kernel on
50 the 4.2 Berkeley Software Distribution of
54 \(dd VAX is a trademark of Digital Equipment Corporation.
56 and discusses tradeoffs in techniques for collecting
58 \fIGprof\fP identifies problems
59 that severely affects the overall performance of the kernel.
60 Once a potential problem areas is identified
61 benchmark programs are devised to highlight the bottleneck.
62 These benchmarks verify that the problem exist and provide
63 a metric against which to validate proposed solutions.
64 Two caches are added to the kernel to alleviate the bottleneck
65 and \fIgprof\fP is used to validates their effectiveness.
72 .tl '\\*(LH'\\*(CH'\\*(RH'
76 .ds LH 4.2BSD Performance
79 .if t .ds CF May 21, 1984
83 .B "TABLE OF CONTENTS"
91 .B "2. The \fIgprof\fP Profiler"
92 \0.1. Data Presentation"
93 \0.1.1. The Flat Profile
94 \0.1.2. The Call Graph Profile
95 \0.2 Profiling the Kernel
99 .B "3. Using \fIgprof\fP to Improve Performance
100 \0.1. Using the Profiler
101 \0.2. An Example of Tuning
117 .if t .ta .6i 2.1i 2.6i
118 .\" 2.94 went to 2.6, 3.64 to 3.30
119 .if n .ta .84i 2.6i 3.30i
122 .if t .ta .5i 1.25i 2.5i
123 .\" 3.5i went to 3.8i
124 .if n .ta .7i 1.75i 3.8i