[MLton] Oprofile on mlton-20041109

Scott A Crosby scrosby@cs.rice.edu
Wed, 24 Nov 2004 19:54:39 -0600


Hello. I recently tested how well mlton works with oprofile. Oprofile
is a whole-system kernel-level profiler that comes built-in in linux
2.6.X kernels.  http://oprofile.sourceforge.net/

Oprofile uses hardware performance counters and can profile many
things such as branch mispredictions, L1/L2 cache misses, CPU time,
misaligned data accesses, TLB misses, and other paramaters. The linux
kernel module records the data and the oprofile user-space tools
('opreport') use debugging symbols from an ELF executable to map them
to functions. With additional line-level debugging symbols, another
tool ('opannotate') can annotate source code at the line
level. Oprofile is extremely non-invasive.

Oprofile appears to work on MLton-generated executables fine, but it
is not too useful. MLton generates non-human readible symbols of the
form 'L_321312' in its ELF executables. Only the C function names in
the runtime are human readible.

Scott


An example of the output from oprofile from a run of MLton-20041109
compiling itself with a 900mb heap is:


root@dragonlight:/usr/local/packages# opcontrol --dump ; opreport -l image:/tmp/mlton-20041109/*mlton-compile* | head -35
CPU: Athlon, speed 1829.84 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Cycles outside of halt state) with a unit mask of 0x00 (No unit mask) count 1000000
samples  %        image name               symbol name
80996    13.2559  mlton-compile            forward
43917     7.1875  mlton-compile            foreachPointerInObject
17382     2.8448  mlton-compile            L_223922
14825     2.4263  mlton-compile            L_223926
14238     2.3302  mlton-compile            objectSize
12864     2.1053  mlton-compile            L_223921
12274     2.0088  mlton-compile            GC_arrayAllocate
9070      1.4844  mlton-compile            __umoddi3
7578      1.2402  mlton-compile            loop_2446
6371      1.0427  mlton-compile            L_223925
6353      1.0397  mlton-compile            mark
5766      0.9437  mlton-compile            updateBackwardPointersAndSlide
5234      0.8566  mlton-compile            forwardInterGenerationalPointers
5109      0.8361  mlton-compile            updateCrossMap
5106      0.8357  mlton-compile            L_223929
5036      0.8242  mlton-compile            updateForwardPointers
4109      0.6725  mlton-compile            L_223931
4103      0.6715  mlton-compile            L_223932
3869      0.6332  mlton-compile            forwardIfInNursery
2805      0.4591  mlton-compile            minorGC
2591      0.4240  mlton-compile            L_369456
2254      0.3689  mlton-compile            L_170683
2242      0.3669  mlton-compile            cheneyCopy
2193      0.3589  mlton-compile            L_223927
1945      0.3183  mlton-compile            L_183261
1673      0.2738  mlton-compile            L_183433
1665      0.2725  mlton-compile            L_296750
1468      0.2403  mlton-compile            L_223933
1461      0.2391  mlton-compile            L_223930