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/runtime/c-libs/smlnj-time/gettime.c
ViewVC logotype

Annotation of /sml/trunk/src/runtime/c-libs/smlnj-time/gettime.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download) (as text)

1 : monnier 249 /* gettime.c
2 :     *
3 :     * COPYRIGHT (c) 1994 by AT&T Bell Laboratories.
4 :     */
5 :    
6 :     #include "ml-base.h"
7 :     #include "ml-values.h"
8 :     #include "ml-objects.h"
9 :     #include "vproc-state.h"
10 :     #include "ml-state.h"
11 :     #include "ml-timer.h"
12 :     #include "cfun-proto-list.h"
13 :    
14 :     /* _ml_Time_gettime : unit -> (Int32.int * int * Int32.int * int * Int32.int * int)
15 :     *
16 :     * Return the total CPU time, system time and garbage collection time used by this
17 :     * process so far.
18 :     */
19 :     ml_val_t _ml_Time_gettime (ml_state_t *msp, ml_val_t arg)
20 :     {
21 :     Time_t t, s;
22 :     ml_val_t tSec, sSec, gcSec, res;
23 :     vproc_state_t *vsp = msp->ml_vproc;
24 :    
25 :     GetCPUTime (&t, &s);
26 :    
27 :     INT32_ALLOC (msp, tSec, t.seconds);
28 :     INT32_ALLOC (msp, sSec, s.seconds);
29 :     INT32_ALLOC (msp, gcSec, vsp->vp_gcTime->seconds);
30 :     REC_ALLOC6 (msp, res,
31 :     tSec, INT_CtoML(t.uSeconds),
32 :     sSec, INT_CtoML(s.uSeconds),
33 :     gcSec, INT_CtoML(vsp->vp_gcTime->uSeconds));
34 :    
35 :     return res;
36 :    
37 :     } /* end of _ml_Time_gettime */
38 :    

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