diff options
author | jmz <jmz@FreeBSD.org> | 1999-05-23 00:37:56 +0000 |
---|---|---|
committer | jmz <jmz@FreeBSD.org> | 1999-05-23 00:37:56 +0000 |
commit | 664ece1203712c55ddab8529abd6803ab19e9803 (patch) | |
tree | 3ea28e5d6788b0822975dc8e1750d52827e90754 /usr.bin | |
parent | e7d8972c4b2d32d37412c38bf5ae67f4ea5a2a52 (diff) | |
download | FreeBSD-src-664ece1203712c55ddab8529abd6803ab19e9803.zip FreeBSD-src-664ece1203712c55ddab8529abd6803ab19e9803.tar.gz |
Construct the profile file name from the name of the executable. A program
compiled with -pg and run will generate a file <executable-filename>.gmon,
not gmon.out.
PR: bin/8426
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/gprof/gprof.1 | 20 | ||||
-rw-r--r-- | usr.bin/gprof/gprof.c | 6 | ||||
-rw-r--r-- | usr.bin/gprof/gprof.h | 1 |
3 files changed, 13 insertions, 14 deletions
diff --git a/usr.bin/gprof/gprof.1 b/usr.bin/gprof/gprof.1 index dc6f369..02eea62 100644 --- a/usr.bin/gprof/gprof.1 +++ b/usr.bin/gprof/gprof.1 @@ -40,15 +40,13 @@ .Sh SYNOPSIS .Nm gprof .Op options -.Op Ar a.out Op Ar gmon.out ... +.Op Ar a.out Op Ar a.out.gmon ... .Sh DESCRIPTION .Nm Gprof produces an execution profile of C, Pascal, or Fortran77 programs. The effect of called routines is incorporated in the profile of each caller. The profile data is taken from the call graph profile file -.Pf ( Pa gmon.out -default) which is created by programs -that are compiled with the +which is created by programs that are compiled with the .Fl pg option of .Xr cc 1 , @@ -63,8 +61,10 @@ that are compiled for profiling. reads the given object file (the default is .Pa a.out) and establishes the relation between it's symbol table -and the call graph profile from -.Pa gmon.out . +and the call graph profile. The default graph profile file name is the name +of the executable with the suffix +.Pa .gmon +appended. If more than one profile file is specified, the .Nm gprof @@ -231,10 +231,10 @@ This is useful with the option for discovering which routines were never called. .El .Sh FILES -.Bl -tag -width gmon.sum -compact +.Bl -tag -width a.out.gmon -compact .It Pa a.out The namelist and text space. -.It Pa gmon.out +.It Pa a.out.gmon Dynamic call graph and profile. .It Pa gmon.sum Summarized dynamic call graph and profile. @@ -295,6 +295,4 @@ the execution of the profiling routine, in which case all is lost. The profiled program must call .Xr exit 3 or return normally for the profiling information to be saved -in the -.Pa gmon.out -file. +in the graph profile file. diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c index 0d4d63f..a5c6140 100644 --- a/usr.bin/gprof/gprof.c +++ b/usr.bin/gprof/gprof.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)gprof.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: gprof.c,v 1.7 1998/08/08 17:48:26 jdp Exp $"; + "$Id: gprof.c,v 1.8 1998/09/07 23:31:59 jdp Exp $"; #endif /* not lint */ #include <err.h> @@ -155,7 +155,9 @@ main(argc, argv) gmonname = *argv; argv++; } else { - gmonname = GMONNAME; + gmonname = (char *) malloc(strlen(a_outname)+6); + strcpy(gmonname, a_outname); + strcat(gmonname, ".gmon"); } /* * get information from the executable file. diff --git a/usr.bin/gprof/gprof.h b/usr.bin/gprof/gprof.h index ce164d5..e426473 100644 --- a/usr.bin/gprof/gprof.h +++ b/usr.bin/gprof/gprof.h @@ -84,7 +84,6 @@ char *a_outname; #define A_OUTNAME "a.out" char *gmonname; -#define GMONNAME "gmon.out" #define GMONSUM "gmon.sum" /* |