aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gmon
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2012-04-29 22:19:58 +0000
committerEitan Adler <eadler@FreeBSD.org>2012-04-29 22:19:58 +0000
commitbe8490925afe186d1e8ed16390feacb7de46359b (patch)
treed21f5c9f8c3c81465e6a87d39ec684b17063d821 /lib/libc/gmon
parentc9f545e5f927a772da862c18ca0de54189fd13e2 (diff)
Notes
Diffstat (limited to 'lib/libc/gmon')
-rw-r--r--lib/libc/gmon/gmon.c7
-rw-r--r--lib/libc/gmon/moncontrol.36
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c
index edf4e2f3d5eb..8f508b065a0d 100644
--- a/lib/libc/gmon/gmon.c
+++ b/lib/libc/gmon/gmon.c
@@ -157,7 +157,12 @@ _mcleanup(void)
}
moncontrol(0);
- snprintf(outname, sizeof(outname), "%s.gmon", _getprogname());
+ if (getenv("PROFIL_USE_PID"))
+ snprintf(outname, sizeof(outname), "%s.%d.gmon",
+ _getprogname(), getpid());
+ else
+ snprintf(outname, sizeof(outname), "%s.gmon", _getprogname());
+
fd = _open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666);
if (fd < 0) {
_warn("_mcleanup: %s", outname);
diff --git a/lib/libc/gmon/moncontrol.3 b/lib/libc/gmon/moncontrol.3
index 7979a71c9fe8..f78ceaefd22d 100644
--- a/lib/libc/gmon/moncontrol.3
+++ b/lib/libc/gmon/moncontrol.3
@@ -98,6 +98,12 @@ however, all functions in that address range will
have their execution time measured.
Profiling begins on return from
.Fn monstartup .
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev PROFIL_USE_PID"
+.It PROFIL_USE_PID
+If set, the pid of the process is inserted into the filename.
.Sh FILES
.Bl -tag -width progname.gmon -compact
.It Pa progname.gmon