diff --git a/scheme/ikarus.timer.ss b/scheme/ikarus.timer.ss index 7bbf85c..84f54b4 100644 --- a/scheme/ikarus.timer.ss +++ b/scheme/ikarus.timer.ss @@ -78,37 +78,6 @@ (stats-gc-sys-usecs t1) (stats-gc-sys-usecs t0)))) (printf " ~a bytes allocated\n" bytes)) - (define (print-stats-old message bytes t1 t0) - (define (print-time msg secs usecs) - (if (fx< usecs 0) - (print-time msg (fx- secs 1) (fx+ usecs 1000000)) - (printf " ~a.~a~a~as ~a" - secs - (fxremainder (fxquotient usecs 100000) 10) - (fxremainder (fxquotient usecs 10000) 10) - (fxremainder (fxquotient usecs 1000) 10) - msg))) - (if message - (printf "running stats for ~a:\n" message) - (printf "running stats:\n")) - (let ([collections - (fx- (stats-collection-id t1) (stats-collection-id t0))]) - (case collections - [(0) (display " no collections\n")] - [(1) (display " 1 collection\n")] - [else (printf " ~a collections\n" collections)])) - - (print-time "real" - (fx- (stats-real-secs t1) (stats-real-secs t0)) - (fx- (stats-real-usecs t1) (stats-real-usecs t0))) - (print-time "user" - (fx- (stats-user-secs t1) (stats-user-secs t0)) - (fx- (stats-user-usecs t1) (stats-user-usecs t0))) - (print-time "sys\n" - (fx- (stats-sys-secs t1) (stats-sys-secs t0)) - (fx- (stats-sys-usecs t1) (stats-sys-usecs t0))) - (printf " ~a bytes allocated\n" bytes)) - (define time-it (case-lambda [(proc) diff --git a/scheme/last-revision b/scheme/last-revision index 7fe7c51..10f1cd9 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1182 +1183 diff --git a/scheme/makefile.ss b/scheme/makefile.ss index ec92378..58466e3 100755 --- a/scheme/makefile.ss +++ b/scheme/makefile.ss @@ -94,6 +94,7 @@ "ikarus.cafe.ss" "ikarus.posix.ss" "ikarus.timer.ss" + "ikarus.time-and-date.ss" "ikarus.bytevectors.ss" "ikarus.sort.ss" "ikarus.promises.ss" @@ -370,6 +371,9 @@ [expand i] [environment? i] [time-it i] + [current-time i] + [time? i] + [time-seconds i] [command-line-arguments i] [set-rtd-printer! i] [make-record-type i] diff --git a/src/ikarus-runtime.c b/src/ikarus-runtime.c index 472f5a9..5668b7f 100644 --- a/src/ikarus-runtime.c +++ b/src/ikarus-runtime.c @@ -1007,6 +1007,19 @@ ikrt_stats_now(ikp t, ikpcb* pcb){ return void_object; } +ikp +ikrt_current_time(ikp t){ + struct timeval s; + gettimeofday(&s, 0); + /* this will break in 8,727,224 years if we stay in 32-bit ptrs */ + ref(t, off_record_data + 0*wordsize) = fix(s.tv_sec / 1000000); + ref(t, off_record_data + 1*wordsize) = fix(s.tv_sec % 1000000); + ref(t, off_record_data + 2*wordsize) = fix(s.tv_usec); + return t; +} + + + ikp ikrt_bytes_allocated(ikpcb* pcb){ int bytes_in_heap = ((int) pcb->allocation_pointer) -