|
32 | 32 | profile-instruction |
33 | 33 | profile-number |
34 | 34 | profile-time |
| 35 | + profile-memory |
35 | 36 | profile-precision |
36 | 37 | profile-iteration)) |
37 | 38 |
|
|
191 | 192 | (make-vector (*rival-profile-executions*)) |
192 | 193 | (make-flvector (*rival-profile-executions*)) |
193 | 194 | (make-vector (*rival-profile-executions*)) |
| 195 | + (make-vector (*rival-profile-executions*)) |
194 | 196 | (make-vector (*rival-profile-executions*)))) |
195 | 197 |
|
196 | 198 | ; ------------------------------------------- APPLY -------------------------------------------------- |
|
226 | 228 | (list (ival (or bad? stuck?) (not good?)) hint* hint*-converged?)) |
227 | 229 |
|
228 | 230 | (define (baseline-machine-adjust machine) |
229 | | - (let ([start (current-inexact-milliseconds)]) |
| 231 | + (let ([start-time (current-inexact-milliseconds)] |
| 232 | + [start-memory (current-memory-use #f)]) |
230 | 233 | (define new-prec (bf-precision)) |
231 | 234 | (set-baseline-machine-precision! machine new-prec) |
232 | 235 | (vector-fill! (baseline-machine-precisions machine) new-prec) |
|
285 | 288 | 'adjust |
286 | 289 | -1 |
287 | 290 | (* iter 1000) |
288 | | - (- (current-inexact-milliseconds) start) |
| 291 | + (- (current-inexact-milliseconds) start-time) |
| 292 | + (max 0 (- (current-memory-use #f) start-memory)) |
289 | 293 | iter))) |
290 | 294 |
|
291 | 295 | (define (drop-self-pointers tail-regs n) |
|
318 | 322 | (define out |
319 | 323 | (match hint |
320 | 324 | [#t |
321 | | - (define start (current-inexact-milliseconds)) |
| 325 | + (define start-time (current-inexact-milliseconds)) |
| 326 | + (define start-memory (current-memory-use #f)) |
322 | 327 | (define res |
323 | 328 | (parameterize ([bf-precision precision]) |
324 | 329 | (apply-instruction instr vregs))) |
325 | 330 | (define name (object-name (car instr))) |
326 | | - (define time (- (current-inexact-milliseconds) start)) |
327 | | - (baseline-machine-record machine name n precision time iter) |
| 331 | + (define time (- (current-inexact-milliseconds) start-time)) |
| 332 | + (define memory (max 0 (- (current-memory-use #f) start-memory))) |
| 333 | + (baseline-machine-record machine name n precision time memory iter) |
328 | 334 | res] |
329 | 335 | [(? integer? _) (vector-ref vregs (list-ref instr hint))] |
330 | 336 | [(? ival? _) hint])) |
|
382 | 388 | (define profile-instruction (baseline-machine-profile-instruction machine)) |
383 | 389 | (define profile-number (baseline-machine-profile-number machine)) |
384 | 390 | (define profile-time (baseline-machine-profile-time machine)) |
| 391 | + (define profile-memory (baseline-machine-profile-memory machine)) |
385 | 392 | (define profile-precision (baseline-machine-profile-precision machine)) |
386 | 393 | (define profile-iteration (baseline-machine-profile-iteration machine)) |
387 | 394 | (begin0 (for/vector #:length profile-ptr |
388 | 395 | ([instruction (in-vector profile-instruction 0 profile-ptr)] |
389 | 396 | [number (in-vector profile-number 0 profile-ptr)] |
390 | 397 | [precision (in-vector profile-precision 0 profile-ptr)] |
391 | 398 | [time (in-flvector profile-time 0 profile-ptr)] |
| 399 | + [memory (in-vector profile-memory 0 profile-ptr)] |
392 | 400 | [iter (in-vector profile-iteration 0 profile-ptr)]) |
393 | | - (execution instruction number precision time iter)) |
| 401 | + (execution instruction number precision time memory iter)) |
394 | 402 | (set-baseline-machine-profile-ptr! machine 0))])) |
395 | 403 |
|
396 | | -(define (baseline-machine-record machine name number precision time iter) |
| 404 | +(define (baseline-machine-record machine name number precision time memory iter) |
397 | 405 | (define profile-ptr (baseline-machine-profile-ptr machine)) |
398 | 406 | (define profile-instruction (baseline-machine-profile-instruction machine)) |
399 | 407 | (when (< profile-ptr (vector-length profile-instruction)) |
400 | 408 | (define profile-number (baseline-machine-profile-number machine)) |
401 | 409 | (define profile-time (baseline-machine-profile-time machine)) |
| 410 | + (define profile-memory (baseline-machine-profile-memory machine)) |
402 | 411 | (define profile-precision (baseline-machine-profile-precision machine)) |
403 | 412 | (define profile-iteration (baseline-machine-profile-iteration machine)) |
404 | 413 | (vector-set! profile-instruction profile-ptr name) |
405 | 414 | (vector-set! profile-number profile-ptr number) |
| 415 | + (vector-set! profile-memory profile-ptr memory) |
406 | 416 | (vector-set! profile-precision profile-ptr precision) |
407 | 417 | (vector-set! profile-iteration profile-ptr iter) |
408 | 418 | (flvector-set! profile-time profile-ptr time) |
|
0 commit comments