* Stats record now contains gc-info fields.
This commit is contained in:
parent
46755415b4
commit
f030e4e11d
BIN
bin/ikarus
BIN
bin/ikarus
Binary file not shown.
|
@ -258,6 +258,16 @@ gc_alloc_new_code(int size, int old_gen, gc_t* gc){
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_to_collect_count(ikpcb* pcb, int bytes){
|
||||
int minor = bytes + pcb->allocation_count_minor;
|
||||
while(minor >= most_bytes_in_minor){
|
||||
minor -= most_bytes_in_minor;
|
||||
pcb->allocation_count_major++;
|
||||
}
|
||||
pcb->allocation_count_minor = minor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -272,8 +282,10 @@ gc_tconc_push_extending(gc_t* gc, ikp tcbucket){
|
|||
}
|
||||
ikp ap =
|
||||
ik_mmap_typed(pagesize,
|
||||
meta_mt[meta_ptrs] | next_gen_tag[0],
|
||||
meta_mt[meta_ptrs] | next_gen_tag[gc->collect_gen],
|
||||
//meta_mt[meta_ptrs] | next_gen_tag[0],
|
||||
gc->pcb);
|
||||
add_to_collect_count(gc->pcb, pagesize);
|
||||
gc->segment_vector = gc->pcb->segment_vector;
|
||||
bzero(ap, pagesize);
|
||||
ikp nap = ap + 2*wordsize;
|
||||
|
@ -351,6 +363,7 @@ static void fix_new_pages(gc_t* gc);
|
|||
|
||||
extern void verify_integrity(ikpcb* pcb, char*);
|
||||
|
||||
|
||||
ikpcb*
|
||||
ik_collect(int mem_req, ikpcb* pcb){
|
||||
#ifndef NDEBUG
|
||||
|
@ -359,17 +372,13 @@ ik_collect(int mem_req, ikpcb* pcb){
|
|||
{ /* ACCOUNTING */
|
||||
int bytes = ((int)pcb->allocation_pointer) -
|
||||
((int)pcb->heap_base);
|
||||
int minor = bytes + pcb->allocation_count_minor;
|
||||
while(minor >= most_bytes_in_minor){
|
||||
minor -= most_bytes_in_minor;
|
||||
pcb->allocation_count_major++;
|
||||
}
|
||||
pcb->allocation_count_minor = minor;
|
||||
add_to_collect_count(pcb, bytes);
|
||||
}
|
||||
|
||||
|
||||
struct rusage t0, t1;
|
||||
|
||||
struct timeval rt0, rt1;
|
||||
gettimeofday(&rt0, 0);
|
||||
getrusage(RUSAGE_SELF, &t0);
|
||||
|
||||
gc_t gc;
|
||||
|
@ -448,28 +457,9 @@ ik_collect(int mem_req, ikpcb* pcb){
|
|||
#ifndef NDEBUG
|
||||
fprintf(stderr, "collect done\n");
|
||||
#endif
|
||||
getrusage(RUSAGE_SELF, &t1);
|
||||
pcb->collect_utime.tv_usec += t1.ru_utime.tv_usec - t0.ru_utime.tv_usec;
|
||||
pcb->collect_utime.tv_sec += t1.ru_utime.tv_sec - t0.ru_utime.tv_sec;
|
||||
if (pcb->collect_utime.tv_usec >= 1000000){
|
||||
pcb->collect_utime.tv_usec -= 1000000;
|
||||
pcb->collect_utime.tv_sec += 1;
|
||||
}
|
||||
else if (pcb->collect_utime.tv_usec < 0){
|
||||
pcb->collect_utime.tv_usec += 1000000;
|
||||
pcb->collect_utime.tv_sec -= 1;
|
||||
}
|
||||
|
||||
pcb->collect_stime.tv_usec += t1.ru_stime.tv_usec - t0.ru_stime.tv_usec;
|
||||
pcb->collect_stime.tv_sec += t1.ru_stime.tv_sec - t0.ru_stime.tv_sec;
|
||||
if (pcb->collect_stime.tv_usec >= 1000000){
|
||||
pcb->collect_stime.tv_usec -= 1000000;
|
||||
pcb->collect_stime.tv_sec += 1;
|
||||
}
|
||||
else if (pcb->collect_stime.tv_usec < 0){
|
||||
pcb->collect_stime.tv_usec += 1000000;
|
||||
pcb->collect_stime.tv_sec -= 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* delete all old heap pages */
|
||||
if(old_heap_pages){
|
||||
|
@ -512,6 +502,44 @@ ik_collect(int mem_req, ikpcb* pcb){
|
|||
#ifndef NDEBUG
|
||||
verify_integrity(pcb, "exit");
|
||||
#endif
|
||||
|
||||
getrusage(RUSAGE_SELF, &t1);
|
||||
gettimeofday(&rt1, 0);
|
||||
|
||||
pcb->collect_utime.tv_usec += t1.ru_utime.tv_usec - t0.ru_utime.tv_usec;
|
||||
pcb->collect_utime.tv_sec += t1.ru_utime.tv_sec - t0.ru_utime.tv_sec;
|
||||
if (pcb->collect_utime.tv_usec >= 1000000){
|
||||
pcb->collect_utime.tv_usec -= 1000000;
|
||||
pcb->collect_utime.tv_sec += 1;
|
||||
}
|
||||
else if (pcb->collect_utime.tv_usec < 0){
|
||||
pcb->collect_utime.tv_usec += 1000000;
|
||||
pcb->collect_utime.tv_sec -= 1;
|
||||
}
|
||||
|
||||
pcb->collect_stime.tv_usec += t1.ru_stime.tv_usec - t0.ru_stime.tv_usec;
|
||||
pcb->collect_stime.tv_sec += t1.ru_stime.tv_sec - t0.ru_stime.tv_sec;
|
||||
if (pcb->collect_stime.tv_usec >= 1000000){
|
||||
pcb->collect_stime.tv_usec -= 1000000;
|
||||
pcb->collect_stime.tv_sec += 1;
|
||||
}
|
||||
else if (pcb->collect_stime.tv_usec < 0){
|
||||
pcb->collect_stime.tv_usec += 1000000;
|
||||
pcb->collect_stime.tv_sec -= 1;
|
||||
}
|
||||
|
||||
pcb->collect_rtime.tv_usec += rt1.tv_usec - rt0.tv_usec;
|
||||
pcb->collect_rtime.tv_sec += rt1.tv_sec - rt0.tv_sec;
|
||||
if (pcb->collect_rtime.tv_usec >= 1000000){
|
||||
pcb->collect_rtime.tv_usec -= 1000000;
|
||||
pcb->collect_rtime.tv_sec += 1;
|
||||
}
|
||||
else if (pcb->collect_rtime.tv_usec < 0){
|
||||
pcb->collect_rtime.tv_usec += 1000000;
|
||||
pcb->collect_rtime.tv_sec -= 1;
|
||||
}
|
||||
|
||||
|
||||
return pcb;
|
||||
}
|
||||
|
||||
|
|
|
@ -921,6 +921,12 @@ ikrt_stats_now(ikp t, ikpcb* pcb){
|
|||
ref(t, off_record_data + 4 * wordsize) = fix(s.tv_sec);
|
||||
ref(t, off_record_data + 5 * wordsize) = fix(s.tv_usec);
|
||||
ref(t, off_record_data + 6 * wordsize) = fix(pcb->collection_id);
|
||||
ref(t, off_record_data + 7 * wordsize) = fix(pcb->collect_utime.tv_sec);
|
||||
ref(t, off_record_data + 8 * wordsize) = fix(pcb->collect_utime.tv_usec);
|
||||
ref(t, off_record_data + 9 * wordsize) = fix(pcb->collect_stime.tv_sec);
|
||||
ref(t, off_record_data + 10 * wordsize) = fix(pcb->collect_stime.tv_usec);
|
||||
ref(t, off_record_data + 11 * wordsize) = fix(pcb->collect_rtime.tv_sec);
|
||||
ref(t, off_record_data + 12 * wordsize) = fix(pcb->collect_rtime.tv_usec);
|
||||
return void_object;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ typedef struct ikpcb{
|
|||
int allocation_count_major;
|
||||
struct timeval collect_utime;
|
||||
struct timeval collect_stime;
|
||||
|
||||
struct timeval collect_rtime;
|
||||
} ikpcb;
|
||||
|
||||
|
||||
|
|
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -4,10 +4,17 @@
|
|||
(import (except (ikarus) time-it))
|
||||
|
||||
(define-record stats
|
||||
(user-secs user-usecs sys-secs sys-usecs real-secs real-usecs collection-id))
|
||||
(user-secs user-usecs
|
||||
sys-secs sys-usecs
|
||||
real-secs real-usecs
|
||||
collection-id
|
||||
gc-user-secs gc-user-usecs
|
||||
gc-sys-secs gc-sys-usecs
|
||||
gc-real-secs gc-real-usecs
|
||||
))
|
||||
|
||||
(define (mk-stats)
|
||||
(make-stats #f #f #f #f #f #f #f))
|
||||
(make-stats #f #f #f #f #f #f #f #f #f #f #f #f #f))
|
||||
|
||||
(define (set-stats! t)
|
||||
(foreign-call "ikrt_stats_now" t))
|
||||
|
|
Loading…
Reference in New Issue