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