Check for incomplete blame information and error.

This commit is contained in:
Vincent St-Amour 2014-02-05 15:45:31 -05:00
parent 7d45129fca
commit 11732128b3
2 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,12 @@
(blame-swap b) ; swap back
b))))
(define regular-profile (analyze-samples samples*))
;; all blames must be complete, otherwise we get bogus profiles
(for ([b (in-list all-blames)])
(unless (and (blame-positive b)
(blame-negative b))
(error (string-append "contract-profile: incomplete blame:\n"
(format-blame b)))))
(contract-profile
total-time live-contract-samples all-blames regular-profile))

View File

@ -35,8 +35,8 @@
(lambda () body ...))))
;; for debugging
(define (print-blame b)
(printf (string-append "#<blame positive=~a\n"
(define (format-blame b)
(format (string-append "#<blame positive=~a\n"
" negative=~a\n"
" contract=~a\n"
" value=~a\n"