From 4a72221a9cff5d77d85e3595cc1c879177cdff61 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Tue, 4 Jun 2013 17:38:24 -0400 Subject: [PATCH] Return what the profiled code returns. --- collects/profile/contract-profile.rkt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/collects/profile/contract-profile.rkt b/collects/profile/contract-profile.rkt index 92cf724b2e..25b617aaf8 100644 --- a/collects/profile/contract-profile.rkt +++ b/collects/profile/contract-profile.rkt @@ -204,9 +204,11 @@ (define-syntax-rule (contract-profile/user body ...) (let ([sampler (create-sampler (current-thread) 0.005 (current-custodian) (list contract-continuation-mark-key))]) - body ... - (sampler 'stop) - (define samples (sampler 'get-snapshots)) - (define contract-samples (for/list ([s (in-list (sampler 'get-custom-snapshots))]) - (and s (vector-ref s 0)))) - (analyze-contract-samples contract-samples samples))) + (begin0 (begin body ...) + (let () + (sampler 'stop) + (define samples (sampler 'get-snapshots)) + (define contract-samples + (for/list ([s (in-list (sampler 'get-custom-snapshots))]) + (and s (vector-ref s 0)))) + (analyze-contract-samples contract-samples samples)))))