profiling

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Tue, 10 Apr 2001 21:39:08 -0400 (EDT)


Correction to my previous email; you need to hardwire 
#define EIP	14
rather than 12.  (The /usr/include/sys/regs.h defines EIP as 12, but
/usr/include/sys/ucontext.h defines REG_EIP as 14; actually, ucontext.h
defines it relative to an enum declaration, and I was lazy and assumed
it worked out to 12, because that's what regs.h had, but I was wrong.)

Anyways, I have the mlprof working with the new profiling information.

[fluet@lennon mlprof-native]$ ./mlprof                  
wrong number of args
Usage: mlprof [-d{0|1|2}] [-k] [-s] [-t n] a.out-file gmon.out-file

The -d and -s options are the same from when I described mlprof a few
weeks ago.

The -k option we can probably drop; it stands for "keep" and keeps all the
profiling information, even if no ticks are in that bucket.  It was useful
to just see that all of the labels were be propagated correctly.

The -t n option is useful; it stands for "threshhold" and will suppress
printing any labels that account for < n% of the total running time,
relative to the enclosing function (via the detail levels).  For example:

[fluet@lennon mlprof-native]$ ./mlprof -t 5 -d 1 logic mlprof.out 
61.33 seconds of CPU time
x_52                                                          18.93% 
     loop_11                                          42.81%   8.10% 
     x_52                                             23.69%   4.48% 
<unknown>                                                     15.36% 
x_973                                                         11.77% 
     x_973                                            38.78%   4.57% 
     L_1739,L_275                                     21.05%   2.48% 
     L_1738,L_274                                     10.66%   1.26% 
     L_1742,L_181                                      8.31%   0.98% 
     L_1739                                            7.62%   0.90% 
     L_1741,L_272                                      6.09%   0.72% 
forward (C @ 0x8068480)                                       11.63% 
x_178                                                          8.19% 
     L_105,L_1530                                      8.96%   0.73% 
     L_145,L_1578                                      7.77%   0.64% 
     L_125,L_1554                                      7.37%   0.60% 
     L_135,L_1566                                      7.37%   0.60% 
     L_1518,L_95                                       6.18%   0.51% 
     x_178                                             6.18%   0.51% 
     L_140,L_1572                                      5.18%   0.42% 
oc_2                                                           6.18% 
     oc_2                                             30.87%   1.91% 
     L_1417,L_2909                                    17.94%   1.11% 
     L_1418,L_2908                                    12.40%   0.77% 
     ocs_2                                             9.23%   0.57% 
     L_1416                                            8.18%   0.51% 
     L_1413,L_2910                                     7.92%   0.49% 
     L_1414                                            6.33%   0.39% 
deref_0                                                        6.10% 
     loop_12                                          44.92%   2.74% 
     deref_0                                          18.98%   1.16% 
     L_1451,L_2924                                    17.91%   1.09% 
     L_1452                                            9.09%   0.55% 
     L_1453                                            5.08%   0.31% 
GC_foreachPointerInObject (C)                                  5.84% 


The new profiler code is at:
http://www.cs.cornell.edu/People/fluet/MLton/mlprof-native.tgz

Steve, the src.tgz that I pulled down didn't have two updates to the
x86-codegen directory that I had incorporated into my last snapshot.
These updates add a little more profiling info and group labels better.
They are at:
http://www.cs.cornell.edu/People/fluet/MLton/x86-codegen-update.tgz

(I can hear the smtp deamons and the inbox buffers celbrating the fact
that I finally acquired some web-space to post updates. :)