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