From 793d655770b0c08537ca59641fbaaea2899ac8d0 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 29 Mar 2019 10:21:15 -0600 Subject: [PATCH] cs: limit linklet performance stats to main place Avoids crashes due to a lack of synchronization, and makes Racket CS consistent with Racket. --- racket/src/cs/linklet/performance.ss | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/racket/src/cs/linklet/performance.ss b/racket/src/cs/linklet/performance.ss index 84e94c312f..5e7963b9b0 100644 --- a/racket/src/cs/linklet/performance.ss +++ b/racket/src/cs/linklet/performance.ss @@ -6,6 +6,8 @@ (define current-start-time '()) (define current-gc-start-time '()) +(define performance-thread-id (get-thread-id)) + ;; List keys for passes related to register allocation as recorded by ;; Chez Scheme and reported from `$pass-stats`: (define register-allocation-passes @@ -37,7 +39,8 @@ (define (measure-performance-region label thunk) (cond - [measure-performance? + [(and measure-performance? + (eqv? (get-thread-id) performance-thread-id)) (with-interrupts-disabled (set! current-start-time (cons (current-process-milliseconds) current-start-time)) (set! current-gc-start-time (cons (current-gc-milliseconds) current-gc-start-time)))