wrong usage message for mlprof

Henry Cejtin henry@sourcelight.com
Fri, 1 Jun 2001 11:15:31 -0700


Although  it  is  really impossible to tell where one function starts
and the
next one finishes, in fact I have never seen a C compiler which put part
of a
function  before  (i.e.,  in  lower  addresses)  than the entry point
for the
function.   The  reason  is  that  there  is  typically  some
register/stack
shuffling  that  goes  on  at function entry, so there would be no
advantage.
I.e., functions start at their entry point.  Where functions  end  is  a
bit
trickier  if  you  don't  look  at static functions since one can have
static
functions in a file both before and after a non-static  function.
Again,  I
haven't  seen very many C compilers that change the order of functions
in a C
file, and since I always write my C  code  top-down,  the  order  is
that  a
function  ends when the next one starts.  (This is certainly what C
profilers
have traditionally done.)  If you do look at static functions  then
this  is
definitely correct.

As to what the difference with and without -s is, in the case I'm
looking at:
with -s it seems to think that 10% of the time or  so  was  spent  in
the  C
procedure  currentTime() (a static function in gc.c).  This clearly
can't be,
and looking at the mlmon.out file using my own tools, there were 0
ticks  in
this function.

As to the magic in mlmon.out files, I would leave it
    MLton prof\n\0
The comment used to claim that it was just
    MLton prof\n
but that wasn't true.  It was 12 bytes long, not 11, and it had to be
that so
that the alignment rules for ints in the struct were maintained.

Any way, I would leave the  magic  because  it  is  a  profiling  file.
The
`mlmon.out' name is just a more traditional file name.