Skip to content

Commit 6f38311

Browse files
committed
Profile using cumulative memory
1 parent 1643ee0 commit 6f38311

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

eval/run.rkt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@
5959
(match hint
6060
[#t ; instruction should be reevaluated
6161
(define start-time (current-inexact-milliseconds))
62-
(define start-memory (current-memory-use #f))
62+
(define start-memory (current-memory-use 'cumulative))
6363
(define res
6464
(parameterize ([bf-precision precision])
6565
(apply-instruction instr vregs)))
6666
(define name (object-name (car instr)))
6767
(define time (- (current-inexact-milliseconds) start-time))
68-
(define memory (max 0 (- (current-memory-use #f) start-memory)))
68+
(define memory (- (current-memory-use 'cumulative) start-memory))
6969
(rival-machine-record machine name n precision time memory iter)
7070
res]
7171
[(? integer? _) (vector-ref vregs (list-ref instr hint))] ; result is known
@@ -117,13 +117,13 @@
117117
(define (rival-machine-adjust machine vhint)
118118
(define iter (rival-machine-iteration machine))
119119
(let ([start-time (current-inexact-milliseconds)]
120-
[start-memory (current-memory-use #f)])
120+
[start-memory (current-memory-use 'cumulative)])
121121
(unless (zero? iter)
122122
(backward-pass machine vhint))
123123
(rival-machine-record machine
124124
'adjust
125125
-1
126126
(* iter 1000)
127127
(- (current-inexact-milliseconds) start-time)
128-
(max 0 (- (current-memory-use #f) start-memory))
128+
(- (current-memory-use 'cumulative) start-memory)
129129
iter)))

infra/run-baseline.rkt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229

230230
(define (baseline-machine-adjust machine)
231231
(let ([start-time (current-inexact-milliseconds)]
232-
[start-memory (current-memory-use #f)])
232+
[start-memory (current-memory-use 'cumulative)])
233233
(define new-prec (bf-precision))
234234
(set-baseline-machine-precision! machine new-prec)
235235
(vector-fill! (baseline-machine-precisions machine) new-prec)
@@ -289,7 +289,7 @@
289289
-1
290290
(* iter 1000)
291291
(- (current-inexact-milliseconds) start-time)
292-
(max 0 (- (current-memory-use #f) start-memory))
292+
(- (current-memory-use 'cumulative) start-memory)
293293
iter)))
294294

295295
(define (drop-self-pointers tail-regs n)
@@ -323,13 +323,13 @@
323323
(match hint
324324
[#t
325325
(define start-time (current-inexact-milliseconds))
326-
(define start-memory (current-memory-use #f))
326+
(define start-memory (current-memory-use 'cumulative))
327327
(define res
328328
(parameterize ([bf-precision precision])
329329
(apply-instruction instr vregs)))
330330
(define name (object-name (car instr)))
331331
(define time (- (current-inexact-milliseconds) start-time))
332-
(define memory (max 0 (- (current-memory-use #f) start-memory)))
332+
(define memory (- (current-memory-use 'cumulative) start-memory))
333333
(baseline-machine-record machine name n precision time memory iter)
334334
res]
335335
[(? integer? _) (vector-ref vregs (list-ref instr hint))]

0 commit comments

Comments
 (0)