mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-18 23:32:17 -08:00
Nested TIME calls do not reset the GC counters. This requires reimplementing GC-STATS to have a special input value mean 'resetting the counters'.
This commit is contained in:
parent
3e2e5f9dc3
commit
da11b861eb
3 changed files with 19 additions and 8 deletions
|
|
@ -197,6 +197,10 @@ ECL 11.1.2
|
|||
|
||||
- EXT:GETENV coerces its input argument to type BASE-STRING.
|
||||
|
||||
- The garbage collector would reset the counters on every call to
|
||||
SI:GC-STATS. This made nested TIME calls not to work, as the statistics of
|
||||
the inner call would spoil those of the outer one. This has been fixed.
|
||||
|
||||
;;; Local Variables: ***
|
||||
;;; mode:text ***
|
||||
;;; fill-column:79 ***
|
||||
|
|
|
|||
|
|
@ -1203,13 +1203,6 @@ si_gc_stats(cl_object enable)
|
|||
} else {
|
||||
old_status = Ct;
|
||||
}
|
||||
if (enable == Cnil) {
|
||||
GC_print_stats = 0;
|
||||
cl_core.gc_stats = 0;
|
||||
} else {
|
||||
cl_core.gc_stats = 1;
|
||||
GC_print_stats = (enable == @':full');
|
||||
}
|
||||
if (cl_core.bytes_consed == Cnil) {
|
||||
cl_core.bytes_consed = ecl_alloc_object(t_bignum);
|
||||
mpz_init2(cl_core.bytes_consed->big.big_num, 128);
|
||||
|
|
@ -1219,8 +1212,16 @@ si_gc_stats(cl_object enable)
|
|||
/* We need fresh copies of the bignums */
|
||||
size1 = _ecl_big_plus_fix(cl_core.bytes_consed, 1);
|
||||
size2 = _ecl_big_plus_fix(cl_core.gc_counter, 1);
|
||||
}
|
||||
if (enable == Cnil) {
|
||||
GC_print_stats = 0;
|
||||
cl_core.gc_stats = 0;
|
||||
} else if (enable == MAKE_FIXNUM(0)) {
|
||||
mpz_set_ui(cl_core.bytes_consed->big.big_num, 0);
|
||||
mpz_set_ui(cl_core.gc_counter->big.big_num, 0);
|
||||
} else {
|
||||
cl_core.gc_stats = 1;
|
||||
GC_print_stats = (enable == @':full');
|
||||
}
|
||||
@(return size1 size2 old_status)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ successfully, T is returned, else error."
|
|||
(setf (logical-pathname-translations host) (read in-str)))
|
||||
t)))
|
||||
|
||||
(defparameter *do-time-level* -1)
|
||||
|
||||
(defun do-time (closure)
|
||||
#-boehm-gc
|
||||
(let* ((real-start (get-internal-real-time))
|
||||
|
|
@ -60,7 +62,8 @@ successfully, T is returned, else error."
|
|||
(/ (- run-end run-start) internal-time-units-per-second)
|
||||
(/ (- gc-end gc-start) internal-time-units-per-second))))
|
||||
#+boehm-gc
|
||||
(let* (real-start
|
||||
(let* ((*do-time-level* (1+ *do-time-level*))
|
||||
real-start
|
||||
run-start
|
||||
consed-start
|
||||
gc-no-start
|
||||
|
|
@ -70,6 +73,9 @@ successfully, T is returned, else error."
|
|||
gc-no-end)
|
||||
;; Garbage collection forces the value of counters to be updated
|
||||
(si::gc t)
|
||||
;; If there are no nested calls, we just reset the counters
|
||||
(when (zerop *do-time-level*) (si::gc-stats 0))
|
||||
;; but in general we copy the previous values.
|
||||
(multiple-value-setq (consed-start gc-no-start) (gc-stats t))
|
||||
(setq real-start (get-internal-real-time)
|
||||
run-start (get-internal-run-time))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue