Asri-unix.959 net.unix-wizards utcsrgv!utzoo!decvax!ucbvax!ARPAVAX:C70:sri-unix!dan@BBN-UNIX Wed Mar 10 19:32:18 1982 V7, VAX-UNIX profiling bug There's an obscure bug in V7 profiling which has been carried into Berkeley VAX-UNIX. The bug has to do with profiling a child of the process that profiling was turned on in. Under this circumstance, the fork system call is shown--in the child--as taking an enormous amount of time, rendering the percentages meaningless. The reason is the way V7 profiles system calls; it finds out the amount of cpu time used so far before doing the system call, and then, afterwards, subtracts this from the current cpu time. This difference is then added to the appropriate profiling slot. Unfortunately, the current cpu time of a freshly created process is zero, so the subtraction produces a negative number which the profiling software treats as hugely positive. The simplest fix is to change trap() to check whether the old cpu time is more than the new, and do nothing if this is the case. This makes forks "free" to the child, while still showing their expense in the parent process, which is probably the right thing. ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.