1 (* Copyright (C
) 2009 Matthew Fluet
.
2 * Copyright (C
) 1999-2006 Henry Cejtin
, Matthew Fluet
, Suresh
3 * Jagannathan
, and Stephen Weeks
.
5 * MLton is released under a BSD
-style license
.
6 * See the file MLton
-LICENSE for details
.
12 open Pervasive
.LargeInt
14 structure LargeInt
= Pervasive
.LargeInt
20 self
: {utime
: t
, stime
: t
},
21 children
: {utime
: t
, stime
: t
},
22 gc
: {utime
: t
, stime
: t
}
27 val {self
, children
, gc
} = MLton
.Rusage
.rusage ()
28 fun doit ({utime
, stime
, ...} : MLton
.Rusage
.t
)
29 = {utime
= utime
, stime
= stime
}
32 children
= doit children
,
36 val zero
= fromReal
0.0
40 val seconds
= fromSeconds
42 fun minutes m
= seconds (m
* fromInt
60)
44 fun hours h
= minutes (h
* fromInt
60)
46 fun days d
= hours (d
* LargeInt
.fromInt
24)
48 fun weeks w
= days (w
* LargeInt
.fromInt
7)
50 fun years y
= days (y
* LargeInt
.fromInt
365)
52 val {min
, max
, ...} = Relation
.compare compare
54 val layout
= Layout
.str
o toString
56 fun output (t
, out
) = Out
.output (out
, toString t
)
58 fun timeThunk (th
: unit
-> unit
): t
=
60 val {self
= {utime
, stime
}, ...} = times ()
63 val {self
= {utime
, stime
}, ...} = times ()
64 val t
' = utime
+ stime