Added current-time, time?, and time-seconds.
This commit is contained in:
parent
171604d7fc
commit
553c986253
|
@ -78,37 +78,6 @@
|
||||||
(stats-gc-sys-usecs t1) (stats-gc-sys-usecs t0))))
|
(stats-gc-sys-usecs t1) (stats-gc-sys-usecs t0))))
|
||||||
(printf " ~a bytes allocated\n" bytes))
|
(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
|
(define time-it
|
||||||
(case-lambda
|
(case-lambda
|
||||||
[(proc)
|
[(proc)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1182
|
1183
|
||||||
|
|
|
@ -94,6 +94,7 @@
|
||||||
"ikarus.cafe.ss"
|
"ikarus.cafe.ss"
|
||||||
"ikarus.posix.ss"
|
"ikarus.posix.ss"
|
||||||
"ikarus.timer.ss"
|
"ikarus.timer.ss"
|
||||||
|
"ikarus.time-and-date.ss"
|
||||||
"ikarus.bytevectors.ss"
|
"ikarus.bytevectors.ss"
|
||||||
"ikarus.sort.ss"
|
"ikarus.sort.ss"
|
||||||
"ikarus.promises.ss"
|
"ikarus.promises.ss"
|
||||||
|
@ -370,6 +371,9 @@
|
||||||
[expand i]
|
[expand i]
|
||||||
[environment? i]
|
[environment? i]
|
||||||
[time-it i]
|
[time-it i]
|
||||||
|
[current-time i]
|
||||||
|
[time? i]
|
||||||
|
[time-seconds i]
|
||||||
[command-line-arguments i]
|
[command-line-arguments i]
|
||||||
[set-rtd-printer! i]
|
[set-rtd-printer! i]
|
||||||
[make-record-type i]
|
[make-record-type i]
|
||||||
|
|
|
@ -1007,6 +1007,19 @@ ikrt_stats_now(ikp t, ikpcb* pcb){
|
||||||
return void_object;
|
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
|
ikp
|
||||||
ikrt_bytes_allocated(ikpcb* pcb){
|
ikrt_bytes_allocated(ikpcb* pcb){
|
||||||
int bytes_in_heap = ((int) pcb->allocation_pointer) -
|
int bytes_in_heap = ((int) pcb->allocation_pointer) -
|
||||||
|
|
Loading…
Reference in New Issue