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/branches/idlbasis-devel/src/MLRISC/control/mlrisc-control.sml
ViewVC logotype

Diff of /sml/branches/idlbasis-devel/src/MLRISC/control/mlrisc-control.sml

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

revision 410, Fri Sep 3 00:25:03 1999 UTC revision 411, Fri Sep 3 00:25:03 1999 UTC
# Line 12  Line 12 
12      val ints          : (string * int ref) list ref      val ints          : (string * int ref) list ref
13      val flags         : (string * bool ref) list ref      val flags         : (string * bool ref) list ref
14      val strings       : (string * string ref) list ref      val strings       : (string * string ref) list ref
15        val stringLists   : (string * string list ref) list ref
16      val timings       : (string * cpu_time ref) list ref      val timings       : (string * cpu_time ref) list ref
17    
18          (* Functions to get these *)          (* Functions to get these *)
# Line 19  Line 20 
20      val getInt        : string -> int ref      val getInt        : string -> int ref
21      val getFlag       : string -> bool ref      val getFlag       : string -> bool ref
22      val getString     : string -> string ref      val getString     : string -> string ref
23        val getStringList : string -> string list ref
24      val getTiming     : string -> cpu_time ref      val getTiming     : string -> cpu_time ref
25  end  end
26    
27  structure MLRISC_Control : MLRISC_CONTROL = struct  structure MLRISC_Control : MLRISC_CONTROL =
28    struct
29     type cpu_time = {gc:Time.time,usr:Time.time,sys:Time.time}     type cpu_time = {gc:Time.time,usr:Time.time,sys:Time.time}
30    
31     val mlrisc        = ref false     val mlrisc        = ref false
# Line 31  Line 34 
34    
35     val counters      = ref [] : (string * int ref) list ref     val counters      = ref [] : (string * int ref) list ref
36     val ints          = ref [] : (string * int ref) list ref     val ints          = ref [] : (string * int ref) list ref
37     val flags         = ref [] : (string * bool ref) list ref     val flags         = ref [("mlrisc",mlrisc)] : (string * bool ref) list ref
38     val strings       = ref [] : (string * string ref) list ref     val strings       = ref [] : (string * string ref) list ref
39       val stringLists   = ref [("mlrisc-phases",mlrisc_phases)]
40                             : (string * string list ref) list ref
41     val timings       = ref [] : (string * cpu_time ref) list ref     val timings       = ref [] : (string * cpu_time ref) list ref
42     local     local
43        fun get(list, name:string, [], new) = let        fun get(list,name : string,[],new) =
44               val r = new()               let val r = new() in list := (name,r) :: !list; r end
           in list := (name,r) :: !list; r  
           end  
45          | get(list, name, (n,r)::rest, new) =          | get(list, name, (n,r)::rest, new) =
46               if name = n then r else get(list, name, rest, new)               if name = n then r else get(list, name, rest, new)
47     in     in
# Line 46  Line 49 
49        fun getInt name     = get(ints,name,!ints,fn() => ref 0)        fun getInt name     = get(ints,name,!ints,fn() => ref 0)
50        fun getFlag name    = get(flags,name,!flags,fn() => ref false)        fun getFlag name    = get(flags,name,!flags,fn() => ref false)
51        fun getString name  = get(strings,name,!strings,fn() => ref "")        fun getString name  = get(strings,name,!strings,fn() => ref "")
52          fun getStringList name  = get(stringLists,name,!stringLists,
53                                        fn() => ref [])
54        fun getTiming name  = get(timings,name,!timings,        fun getTiming name  = get(timings,name,!timings,
55                                  fn() => ref {gc =Time.zeroTime,                                  fn() => ref {gc =Time.zeroTime,
56                                               usr=Time.zeroTime,                                               usr=Time.zeroTime,
57                                               sys=Time.zeroTime})                                               sys=Time.zeroTime})
58     end     end
59    
60  end  end

Legend:
Removed from v.410  
changed lines
  Added in v.411

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