[net.unix] Profiling child processes

psc@lzwi.UUCP (Paul S. R. Chisholm) (06/12/85)

< Smokey the Bar says, "Help stamp out software pirates" [squish!] >

AT&T System V Release 2.0 Unix claims to be able to profile programs
that fork(2) off child processes.  I read that somewhere in the
release notes, and prof(1) implies it:

    The name of the file created by a profiled program is controlled
    by the environment variable PROFDIR.  If PROFDIR does not exit,
    "mon.out" is produced in the directory current when the program
    terminates.  If PROFDIR = string, "string/pid.progname" is
    produced, where progname consists of argv[0] with any path prefix
    removed, and pid is the program's process id.  If PROFDIR =
    nothing, no profiling output is produced.

Indeed, setting PROFDIR does create such a file for the parent process.
Alas, if the parent forks off a child, there doesn't seem to be any
monitor file.

Answers to obvious questions:  Yes, the parent waits on the child.
Yes, the child calls exit(2).  No, the child doesn't do a chdir(2).

Possible work around:  I could have three separate programs, and have
the children of one exec(2) the other two.  I really don't want to do
this.  (This is an AT&T product running on a 3B/2; I don't care if
Berkeley Unix handles this right.)

Any thoughts?
-- 
       -Paul S. R. Chisholm       The above opinions are my own,
       {pegasus,vax135}!lzwi!psc  not necessarily those of any
       {mtgzz,ihnp4}!lznv!psc     telecommunications company.