Allow users of gprof to get per run output files (using the pid)
PR: bin/99800 Submitted by: Peter Jeremy <peterjeremy@optushome.com.au> Reviewed by: jilles (code) Reviewed by: dwhite (doc) Approved by: cperciva MFC after: 1 week
This commit is contained in:
parent
c9f545e5f9
commit
be8490925a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=234819
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user