From 9ae2bc9ce6b359ee25db8434eb258bb0e04fb006 Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Sat, 7 Sep 1991 05:31:10 +0000 Subject: [PATCH] Add real time GC statistics gathering and reporting. --- v7/src/runtime/gcnote.scm | 41 +++++++++++++++++++++++-------------- v7/src/runtime/gcstat.scm | 42 ++++++++++++++++++++++++++++---------- v7/src/runtime/runtime.pkg | 6 +++++- v7/src/runtime/version.scm | 6 +++--- v8/src/runtime/runtime.pkg | 6 +++++- 5 files changed, 70 insertions(+), 31 deletions(-) diff --git a/v7/src/runtime/gcnote.scm b/v7/src/runtime/gcnote.scm index c1360cd13..cd82dcc9b 100644 --- a/v7/src/runtime/gcnote.scm +++ b/v7/src/runtime/gcnote.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/gcnote.scm,v 14.6 1989/10/26 06:46:11 cph Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/gcnote.scm,v 14.7 1991/09/07 05:30:43 jinx Exp $ -Copyright (c) 1988, 1989 Massachusetts Institute of Technology +Copyright (c) 1988-1991 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -94,19 +94,30 @@ MIT in each case. |# (write-string (gc-statistic->string statistic))) (define (gc-statistic->string statistic) - (let ((delta-time - (- (gc-statistic/this-gc-end statistic) - (gc-statistic/this-gc-start statistic)))) + (let ((intervals->string + (lambda (start end last-end) + (let ((gc-length (- end start)) + (period (- end last-end))) + (string-append + (number->string (internal-time/ticks->seconds gc-length)) + " (" + (if (zero? period) + "100" + (number->string + (round->exact (* (/ gc-length period) 100)))) + "%)"))))) + (string-append "GC #" (number->string (gc-statistic/meter statistic)) - " took: " - (number->string (internal-time/ticks->seconds delta-time)) - " (" - (number->string - (round->exact - (* (/ delta-time - (- (gc-statistic/this-gc-end statistic) - (gc-statistic/last-gc-end statistic))) - 100))) - "%) free: " + ": took: " + (intervals->string + (gc-statistic/this-gc-start statistic) + (gc-statistic/this-gc-end statistic) + (gc-statistic/last-gc-end statistic)) + " process time, " + (intervals->string + (gc-statistic/this-gc-start-clock statistic) + (gc-statistic/this-gc-end-clock statistic) + (gc-statistic/last-gc-end-clock statistic)) + " real time; free: " (number->string (gc-statistic/heap-left statistic))))) \ No newline at end of file diff --git a/v7/src/runtime/gcstat.scm b/v7/src/runtime/gcstat.scm index 2629ad636..bc4c04a6e 100644 --- a/v7/src/runtime/gcstat.scm +++ b/v7/src/runtime/gcstat.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/gcstat.scm,v 14.3 1990/03/26 19:42:44 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/gcstat.scm,v 14.4 1991/09/07 05:30:57 jinx Exp $ -Copyright (c) 1988 Massachusetts Institute of Technology +Copyright (c) 1988-1991 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -51,17 +51,27 @@ MIT in each case. |# (set! hook/gc-finish recorder/gc-finish)) (define (recorder/gc-start) - (process-time-clock)) - -(define (recorder/gc-finish start-time space-remaining) - (let ((end-time (process-time-clock))) - (increment-non-runtime! (- end-time start-time)) - (statistics-flip start-time end-time space-remaining))) + (set! this-gc-start-clock (real-time-clock)) + (set! this-gc-start (process-time-clock)) + unspecific) + +(define (recorder/gc-finish ignored space-remaining) + ignored + (let* ((end-time (process-time-clock)) + (end-time-clock (real-time-clock))) + (increment-non-runtime! (- end-time this-gc-start)) + (statistics-flip this-gc-start end-time + space-remaining + this-gc-start-clock end-time-clock))) (define timestamp) (define total-gc-time) (define last-gc-start) (define last-gc-end) +(define this-gc-start) +(define this-gc-start-clock) +(define last-gc-start-clock) +(define last-gc-end-clock) (define (gc-timestamp) timestamp) @@ -69,6 +79,8 @@ MIT in each case. |# (define (statistics-reset!) (set! timestamp (cons 1 (1+ (cdr timestamp)))) (set! total-gc-time 0) + (set! last-gc-start-clock false) + (set! last-gc-end-clock (real-time-clock)) (set! last-gc-start false) (set! last-gc-end (process-time-clock)) (reset-recorder! '())) @@ -79,17 +91,25 @@ MIT in each case. |# (this-gc-start false read-only true) (this-gc-end false read-only true) (last-gc-start false read-only true) - (last-gc-end false read-only true)) + (last-gc-end false read-only true) + (this-gc-start-clock false read-only true) + (this-gc-end-clock false read-only true) + (last-gc-start-clock false read-only true) + (last-gc-end-clock false read-only true)) -(define (statistics-flip start-time end-time heap-left) +(define (statistics-flip start-time end-time heap-left start-clock end-clock) (let ((statistic (make-gc-statistic timestamp heap-left start-time end-time - last-gc-start last-gc-end))) + last-gc-start last-gc-end + start-clock end-clock + last-gc-start-clock last-gc-end-clock))) (set! timestamp (cons (1+ (car timestamp)) (cdr timestamp))) (set! total-gc-time (+ (- end-time start-time) total-gc-time)) (set! last-gc-start start-time) (set! last-gc-end end-time) + (set! last-gc-start-clock start-clock) + (set! last-gc-end-clock end-clock) (record-statistic! statistic) (hook/record-statistic! statistic))) diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index dfeda0166..bd4278a6b 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/runtime.pkg,v 14.120 1991/09/02 03:57:21 sybok Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/runtime.pkg,v 14.121 1991/09/07 05:31:10 jinx Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -737,9 +737,13 @@ MIT in each case. |# gc-statistic/heap-left gc-statistic/last-gc-end gc-statistic/last-gc-start + gc-statistic/last-gc-end-clock + gc-statistic/last-gc-start-clock gc-statistic/meter gc-statistic/this-gc-end gc-statistic/this-gc-start + gc-statistic/this-gc-end-clock + gc-statistic/this-gc-start-clock gc-statistics gc-timestamp gctime) diff --git a/v7/src/runtime/version.scm b/v7/src/runtime/version.scm index 1140d0287..d078cc7d0 100644 --- a/v7/src/runtime/version.scm +++ b/v7/src/runtime/version.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/version.scm,v 14.137 1991/08/29 14:23:23 bal Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/version.scm,v 14.138 1991/09/07 05:30:30 jinx Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -45,10 +45,10 @@ MIT in each case. |# '())) (add-system! microcode-system) (add-event-receiver! event:after-restore snarf-microcode-version!) - (add-identification! "Runtime" 14 137)) + (add-identification! "Runtime" 14 138)) (define microcode-system) (define (snarf-microcode-version!) (set-system/version! microcode-system microcode-id/version) - (set-system/modification! microcode-system microcode-id/modification)) + (set-system/modification! microcode-system microcode-id/modification)) \ No newline at end of file diff --git a/v8/src/runtime/runtime.pkg b/v8/src/runtime/runtime.pkg index 905ce4895..560411cc6 100644 --- a/v8/src/runtime/runtime.pkg +++ b/v8/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/runtime.pkg,v 14.120 1991/09/02 03:57:21 sybok Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/runtime.pkg,v 14.121 1991/09/07 05:31:10 jinx Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -737,9 +737,13 @@ MIT in each case. |# gc-statistic/heap-left gc-statistic/last-gc-end gc-statistic/last-gc-start + gc-statistic/last-gc-end-clock + gc-statistic/last-gc-start-clock gc-statistic/meter gc-statistic/this-gc-end gc-statistic/this-gc-start + gc-statistic/this-gc-end-clock + gc-statistic/this-gc-start-clock gc-statistics gc-timestamp gctime) -- 2.25.1