diff options
author | jb <jb@FreeBSD.org> | 1998-09-05 07:56:36 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 1998-09-05 07:56:36 +0000 |
commit | 0a3d8ac4d3f5422bec355485a8c4e059aaeb5a4b (patch) | |
tree | eb4170eead5df16a40837bdc708121a70bf80fb4 /lib/libc | |
parent | 87d99748469979c351dc440054390c6b72dcd2d8 (diff) | |
download | FreeBSD-src-0a3d8ac4d3f5422bec355485a8c4e059aaeb5a4b.zip FreeBSD-src-0a3d8ac4d3f5422bec355485a8c4e059aaeb5a4b.tar.gz |
Change the profile data file name from gmon.out to progname.gmon
where progname comes from __progname in crt0 or crt1.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gmon/gmon.c | 15 | ||||
-rw-r--r-- | lib/libc/gmon/moncontrol.3 | 6 |
2 files changed, 14 insertions, 7 deletions
diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c index a0f0036..f477822 100644 --- a/lib/libc/gmon/gmon.c +++ b/lib/libc/gmon/gmon.c @@ -35,12 +35,15 @@ static char sccsid[] = "@(#)gmon.c 8.1 (Berkeley) 6/4/93"; #endif -#ifndef __NETBSD_SYSCALLS +#ifndef __alpha__ + #include <sys/param.h> #include <sys/time.h> #include <sys/gmon.h> #include <sys/sysctl.h> +#include <err.h> +#include <errno.h> #include <stdio.h> #include <fcntl.h> #include <unistd.h> @@ -51,6 +54,8 @@ extern char *minbrk asm (".minbrk"); extern char *minbrk asm ("minbrk"); #endif +extern char *__progname; + struct gmonparam _gmonparam = { GMON_PROF_OFF }; static int s_scale; @@ -139,6 +144,7 @@ _mcleanup() struct gmonparam *p = &_gmonparam; struct gmonhdr gmonhdr, *hdr; struct clockinfo clockinfo; + char outname[128]; int mib[2]; size_t size; #ifdef DEBUG @@ -165,15 +171,16 @@ _mcleanup() } moncontrol(0); - fd = open("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666); + snprintf(outname,sizeof(outname),"%s.gmon",__progname); + fd = open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666); if (fd < 0) { - perror("mcount: gmon.out"); + warnx("_mcleanup: %s - %s",outname,strerror(errno)); return; } #ifdef DEBUG log = open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664); if (log < 0) { - perror("mcount: gmon.log"); + perror("_mcleanup: gmon.log"); return; } len = sprintf(buf, "[mcleanup1] kcount 0x%x ssiz %d\n", diff --git a/lib/libc/gmon/moncontrol.3 b/lib/libc/gmon/moncontrol.3 index 92993cd..a35389f 100644 --- a/lib/libc/gmon/moncontrol.3 +++ b/lib/libc/gmon/moncontrol.3 @@ -55,8 +55,8 @@ call-graph execution profiler. In typical operation, profiling begins at program startup and ends when the program calls exit. When the program exits, the profiling data are written to the file -.Em gmon.out , -then +.Em progname.gmon , +where progname is the name of the program, then .Xr gprof 1 can be used to examine the results. .Pp @@ -96,7 +96,7 @@ Profiling begins on return from .Fn monstartup . .Sh FILES .Bl -tag -width Pa -compact -.It Pa gmon.out execution data file +.It Pa progname.gmon execution data file .El .Sh SEE ALSO .Xr cc 1 , |