]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/doc/psd/18.gprof/intro.me
file: update to 5.34
[FreeBSD/FreeBSD.git] / share / doc / psd / 18.gprof / intro.me
1 .\" Copyright (c) 1982, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)intro.me    8.1 (Berkeley) 6/8/93
29 .\"
30 .sh 1 "Programs to be Profiled"
31 .pp
32 Software research environments
33 normally include many large programs
34 both for  production use and for experimental investigation.
35 These programs are typically modular,
36 in accordance with generally accepted principles
37 of good program design.
38 Often they consist of numerous small routines
39 that implement various abstractions.
40 Sometimes such large programs are written
41 by one programmer 
42 who has understood the requirements for
43 these abstractions, and has programmed them
44 appropriately.
45 More frequently the program has
46 had multiple authors and has
47 evolved over time, changing the demands placed
48 on the implementation of the abstractions without
49 changing the implementation itself.
50 Finally, the program may be assembled from a library
51 of abstraction implementations 
52 unexamined by the programmer.
53 .pp
54 Once a large program is executable,
55 it is often desirable to increase its speed,
56 especially if small portions of the program 
57 are found to dominate its execution time.
58 The purpose of the \fBgprof\fP profiling tool is to 
59 help the user evaluate alternative implementations
60 of abstractions.
61 We developed this tool in response to our efforts 
62 to improve a code generator we were writing [Graham82].
63 .pp
64 The \fBgprof\fP design takes advantage of the fact that the programs
65 to be measured are large, structured and hierarchical.
66 We provide a profile in which the execution time
67 for a set of routines that implement an
68 abstraction is collected and charged
69 to that abstraction.
70 The profile can be used to compare and assess the costs of
71 various implementations.
72 .pp
73 The profiler can be linked into a program without
74 special planning by the programmer.
75 The overhead for using \fBgprof\fP is low;
76 both in terms of added execution time and in the
77 volume of profiling information recorded.