Mercurial > emacs
comparison src/alloc.c @ 49357:90e4c5eeb9a0
(Fgc_status): Print zombie list.
(mark_maybe_object) [GC_MARK_STACK==GC_USE_GCPROS_CHECK_ZOMBIES]:
Fix assignment of zombies.
(Fgarbage_collect) [GC_MARK_STACK==GC_USE_GCPROS_CHECK_ZOMBIES]:
Don't take car of non-cons.
author | Dave Love <fx@gnu.org> |
---|---|
date | Tue, 21 Jan 2003 16:56:13 +0000 |
parents | 2cbb0b823e83 |
children | 668c96afa702 |
comparison
equal
deleted
inserted
replaced
49356:fbabb532002e | 49357:90e4c5eeb9a0 |
---|---|
3335 | 3335 |
3336 DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", | 3336 DEFUN ("gc-status", Fgc_status, Sgc_status, 0, 0, "", |
3337 doc: /* Show information about live and zombie objects. */) | 3337 doc: /* Show information about live and zombie objects. */) |
3338 () | 3338 () |
3339 { | 3339 { |
3340 Lisp_Object args[7]; | 3340 Lisp_Object args[8], zombie_list = Qnil; |
3341 args[0] = build_string ("%d GCs, avg live/zombies = %.2f/%.2f (%f%%), max %d/%d"); | 3341 int i; |
3342 for (i = 0; i < nzombies; i++) | |
3343 zombie_list = Fcons (zombies[i], zombie_list); | |
3344 args[0] = build_string ("%d GCs, avg live/zombies = %.2f/%.2f (%f%%), max %d/%d\nzombies: %S"); | |
3342 args[1] = make_number (ngcs); | 3345 args[1] = make_number (ngcs); |
3343 args[2] = make_float (avg_live); | 3346 args[2] = make_float (avg_live); |
3344 args[3] = make_float (avg_zombies); | 3347 args[3] = make_float (avg_zombies); |
3345 args[4] = make_float (avg_zombies / avg_live / 100); | 3348 args[4] = make_float (avg_zombies / avg_live / 100); |
3346 args[5] = make_number (max_live); | 3349 args[5] = make_number (max_live); |
3347 args[6] = make_number (max_zombies); | 3350 args[6] = make_number (max_zombies); |
3348 return Fmessage (7, args); | 3351 args[7] = zombie_list; |
3352 return Fmessage (8, args); | |
3349 } | 3353 } |
3350 | 3354 |
3351 #endif /* GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES */ | 3355 #endif /* GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES */ |
3352 | 3356 |
3353 | 3357 |
3425 | 3429 |
3426 if (mark_p) | 3430 if (mark_p) |
3427 { | 3431 { |
3428 #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES | 3432 #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES |
3429 if (nzombies < MAX_ZOMBIES) | 3433 if (nzombies < MAX_ZOMBIES) |
3430 zombies[nzombies] = *p; | 3434 zombies[nzombies] = obj; |
3431 ++nzombies; | 3435 ++nzombies; |
3432 #endif | 3436 #endif |
3433 mark_object (&obj); | 3437 mark_object (&obj); |
3434 } | 3438 } |
3435 } | 3439 } |
4340 { | 4344 { |
4341 /* Compute average percentage of zombies. */ | 4345 /* Compute average percentage of zombies. */ |
4342 double nlive = 0; | 4346 double nlive = 0; |
4343 | 4347 |
4344 for (i = 0; i < 7; ++i) | 4348 for (i = 0; i < 7; ++i) |
4345 nlive += XFASTINT (XCAR (total[i])); | 4349 if (CONSP (total[i])) |
4350 nlive += XFASTINT (XCAR (total[i])); | |
4346 | 4351 |
4347 avg_live = (avg_live * ngcs + nlive) / (ngcs + 1); | 4352 avg_live = (avg_live * ngcs + nlive) / (ngcs + 1); |
4348 max_live = max (nlive, max_live); | 4353 max_live = max (nlive, max_live); |
4349 avg_zombies = (avg_zombies * ngcs + nzombies) / (ngcs + 1); | 4354 avg_zombies = (avg_zombies * ngcs + nzombies) / (ngcs + 1); |
4350 max_zombies = max (nzombies, max_zombies); | 4355 max_zombies = max (nzombies, max_zombies); |