Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/MLRISC/visualization/cfgViewer.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/visualization/cfgViewer.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1172, Fri Mar 22 20:42:01 2002 UTC revision 1173, Sat Mar 23 04:18:51 2002 UTC
# Line 17  Line 17 
17         val CFG.INFO{annotations, ...} = #graph_info g         val CFG.INFO{annotations, ...} = #graph_info g
18         val toString = FMT.toString (!annotations)         val toString = FMT.toString (!annotations)
19         fun graph _ = []         fun graph _ = []
20           val colorScale =
21               Array.fromList
22                 ["#ccffff", "#99ffff", "#66ccff", "#54a9ff", "#ccff99",
23                  "#ffff99", "#ffcc66", "#ff9966", "#cc6666", "#d14949",
24                  "#d14949"]
25    
26         val red = L.COLOR "red"         fun weightRange([], min, max) = (min, max-min)
27         val yellow = L.COLOR "yellow"           | weightRange((_,_,CFG.EDGE{w, ...})::rest, min, max) = let
28         val green = L.COLOR "green"               val wt = !w
29               in
30                 if wt > max then weightRange(rest, min, wt)
31                 else if wt < min then weightRange(rest, wt, max)
32                 else weightRange(rest, min, max)
33               end
34    
35           val (loWt, range) = weightRange( #edges g (), ~1.0, ~1.0)
36    
37         val ENTRY = hd(#entries g ())         val ENTRY = hd(#entries g ())
38         val EXIT  = hd(#exits g ())         val EXIT  = hd(#exits g ())
39    
40           val red = L.COLOR "#ff0000"
41           val yellow = L.COLOR "yellow"
42           val green = L.COLOR "green"
43    
44         fun edge(i,j,CFG.EDGE{w, ...}) =         fun edge(i,j,CFG.EDGE{w, ...}) =
45         let val label = L.LABEL(Real.toString (!w))         let val label = L.LABEL(Real.toString (!w))
46             val color =             val color = let
47                 if i = ENTRY orelse j = EXIT then green (* special edge *)                 val pos = floor (((!w - loWt) * 10.0 )/ range)
48                 else if i+1 = j then yellow (* fallsthru *)              in
49                 else red                 L.COLOR(Array.sub(colorScale, pos))
50                end
51         in  [label, color] end         in  [label, color] end
52    
53         fun title(blknum,ref freq) =         fun title(blknum,ref freq) =

Legend:
Removed from v.1172  
changed lines
  Added in v.1173

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0