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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/control/mlrisc-timing.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/control/mlrisc-timing.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 411 - (view) (download)
Original Path: sml/branches/SMLNJ/src/MLRISC/control/mlrisc-timing.sml

1 : monnier 245 signature MLRISC_TIMING =
2 :     sig
3 :    
4 : monnier 411 val timePhase : string -> ('a -> 'b) -> 'a -> 'b
5 : monnier 245 end
6 :    
7 :     structure MLRISC_Timing : MLRISC_TIMING =
8 :     struct
9 :    
10 : monnier 411 structure C = MLRISC_Control
11 : monnier 245
12 : monnier 411 fun timePhase name f =
13 :     let val timing as ref {gc,usr,sys} = C.getTiming name
14 :     fun run x =
15 :     let val timer = Timer.startCPUTimer()
16 :     fun update timer =
17 :     let val {gc=gc',usr=usr',sys=sys'} = Timer.checkCPUTimer timer
18 :     in timing := {gc=Time.+(gc,gc'),
19 :     usr=Time.+(usr,usr'),
20 :     sys=Time.+(sys,sys')}
21 :     end
22 :     val y = f x handle e => (update timer; raise e)
23 :     in update timer; y
24 :     end
25 :     in run end
26 :    
27 : monnier 245 end

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