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

SCM Repository

[smlnj] View of /sml/trunk/src/runtime/c-libs/smlnj-time/gettime.c
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 651 - (download) (as text) (annotate)
Thu Jun 1 18:34:03 2000 UTC (20 years, 2 months ago) by monnier
File size: 931 byte(s)
bring revisions from the vendor branch to the trunk
/* gettime.c
 * COPYRIGHT (c) 1994 by AT&T Bell Laboratories.

#include "ml-base.h"
#include "ml-values.h"
#include "ml-objects.h"
#include "vproc-state.h"
#include "ml-state.h"
#include "ml-timer.h"
#include "cfun-proto-list.h"

/* _ml_Time_gettime : unit -> (Int32.int * int * Int32.int * int * Int32.int * int)
 * Return the total CPU time, system time and garbage collection time used by this
 * process so far.
ml_val_t _ml_Time_gettime (ml_state_t *msp, ml_val_t arg)
    Time_t		t, s;
    ml_val_t		tSec, sSec, gcSec, res;
    vproc_state_t	*vsp = msp->ml_vproc;

    GetCPUTime (&t, &s);

    INT32_ALLOC (msp, tSec, t.seconds);
    INT32_ALLOC (msp, sSec, s.seconds);
    INT32_ALLOC (msp, gcSec, vsp->vp_gcTime->seconds);
    REC_ALLOC6 (msp, res,
	tSec, INT_CtoML(t.uSeconds),
	sSec, INT_CtoML(s.uSeconds),
	gcSec, INT_CtoML(vsp->vp_gcTime->uSeconds));

    return res;

} /* end of _ml_Time_gettime */

ViewVC Help
Powered by ViewVC 1.0.0