profiling

Stephen Weeks MLton@sourcelight.com
Thu, 12 Apr 2001 11:00:10 -0700 (PDT)


> 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.)

OK.  I put a #define and this comment in prof.c.

> Anyways, I have the mlprof working with the new profiling information.
...
> 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

Cool.  I integrated both your profiling and x86 stuff without event.  I tried
out the profiling on tak and it works.

> 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.

OK.  I dropped it.

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

Not to mention my mail archive files :-)

I have one suggestion for the profiling output.  I find -d 1 and -d 2 too busy.
How about just printing the first number in each column, like the following?

% $HOME/mlton/src/mlprof/mlprof -d 0 profiling mlprof.out
0.53 seconds of CPU time
tak_0                                      75.47% 
IntInf_smallMul (C)                        22.64% 
<unknown>                                   1.89% 

% $HOME/mlton/src/mlprof/mlprof -d 1 profiling mlprof.out
0.53 seconds of CPU time
tak_0                                              75.47% 
     L_53,L_54                             22.50%
     tak_0                                 17.50%
     L_59,L_73                             15.00%
     L_57,L_72                             15.00%
     L_55,L_71                             10.00%
     L_57                                  10.00%
     L_55                                   7.50%
     L_54                                   2.50%
IntInf_smallMul (C)                                22.64% 
<unknown>                                           1.89% 

% $HOME/mlton/src/mlprof/mlprof -d 2 profiling mlprof.out
0.53 seconds of CPU time
tak_0                                                      75.47% 
     L_53,L_54                                     22.50%
          L_53,L_54                       100.00%
     tak_0                                         17.50%
          statementLimitCheckLoop_1,tak_0  57.14%
          skipGC_2                         42.86%
     L_59,L_73                                     15.00%
          L_59,L_73                       100.00%
     L_57,L_72                                     15.00%
          L_57,L_72                       100.00%
     L_55,L_71                                     10.00%
          L_55,L_71                       100.00%
     L_57                                          10.00%
          noOverflow_6                    100.00%
     L_55                                           7.50%
          noOverflow_7                    100.00%
     L_54                                           2.50%
          noOverflow_8                    100.00%
IntInf_smallMul (C)                                        22.64% 
<unknown>                                                   1.89%