profiling
Henry Cejtin
henry@sourcelight.com
Mon, 9 Apr 2001 21:41:30 -0500
I have the profiling stuff ready to go, but it isn't clear to me just what I
should #include in the C file. At the moment I have all my usual defines,
(uint, loop, not, etc.). Also I use assert and die.
When it runs, and your program exits normally, it will produce a file called
`mlprof.out'. This file consists of the following:
A 12 byte magic value so you can recognize what the file is:
"MLton prof00"
Note, the is included so that the length is divisible by 4, which
makes things a bit nicer.
The lowest address for which there is a bin.
One more than the highest address for which there is a bin.
The number of ticks that didn't correspond to any bin (i.e., `unknowns').
The bins.
All of these are 4 byte unsigned ints in the native machine format
(little-endian). There is one bin per byte. The bins cover all the code
that is statically linked into the program, but they do not conver any shared
libraries. Each time the interrupt happens (100 Hz), if the program counter
is in this range then the corresponding bin is incremented. If it isn't then
the `unknowns' is incremented.
Note, since there are 4 bytes per bin, they can't possibly overflow until you
have used 2^32 / 100 CPU seconds which is a bit over 1 CPU year.