[MLton-devel] New release of MLton: call-graphs

Stephen Weeks MLton@mlton.org
Fri, 21 Mar 2003 16:37:55 -0800


> > There is still one thing that puzzles me about the call-graphs. In the
> > attached call-graph, there are two functions (Binarymap peek and find)
> > that aren't connected to the rest of the graph. Shouldn't there always
> > be a connection from <main> to every function?
> 
> There should be, but the default call-stack graphs produced by mlprof will
> remove nodes below the threshold, which can leave the graph disconnected.

With -profile-stack true, the default call-stack graph, -graph
'(thresh-stack x)', should be connected.  Joe, if the graph you sent
was produced with no -graph or -thresh arg, then you have found a bug.

> If you want to see all nodes, you will need to use the option
> -graph 'all'.  But the resulting graph may be too big.  You might try
> -graph '(to (thresh x))' where x is the threshhold you used when producing
> the graph.  That is the default graph option when -profile-stack false is
> used, whereas the default graph option when -profile-stack true is used is
> '(thresh x)'.  (I'm not sure of the reason for the different defaults;
> Stephen set them and probably has an argument for them being that way.)
> If that doesn't explain the disconnect, them I'm not sure why.

I set the defaults so that the default graph, i.e no -thresh or -graph
arg to mlprof, would be connected and rooted at main.  With
-profile-stack true, if some node has a nonzero stack %, then every
node on the path from main that is on stack should also have a
nonzero, and so '(thresh-stack 0.0)' will connect the graph.  With
-profile-stack true, there is no such guarantee, hence I needed the
'(to (thresh 0.0))'.

I just looked through the mlprof sources and noticed that there is an
inconsistency between the documentation and the behavior.
Unfortunately, I left the default with -profile-stack true as '(thresh
0.0)' instead of '(thresh-stack 0.0)'.  So this might explain the
problem Joe is seeing.  In any case, I just checked in a fix.

> There is an asymmetry with what you can accomplish with -graph and -ignore
> options.  (-graph takes a graph expression while -ignore takes a regexp).
> I'm tempted to suggest that we make -ignore also take a graph expression,
> which would let you take:
> -graph "exp"
> that yields a disconnected graph to
> -graph "all" -ignore "(not (exp))"
> that should generate a connected graph.  But, I don't know if there are
> technical issues with accomplishing that.

I don't see an reason why we shouldn't allow -ignore to take a graph
exp.  When using -ignore and -graph, the semantics will be to first
apply the -ignore to eliminate nodes (and connect the predecessors to
successors), and then apply -graph to decide which nodes to display.
It's on the todo.


-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel