Keep TR and mzc logs separate.

Simplifies post-processing.
This commit is contained in:
Vincent St-Amour 2012-09-12 17:15:24 -04:00
parent 8ace14bad9
commit b751907e24
2 changed files with 13 additions and 13 deletions

View File

@ -156,12 +156,9 @@
;; Log messages produced by the inliner are very raw, unlike the TR logs,
;; which have gone through some aggregation. We do the aggregation here.
(define (post-process-inline-log log profile)
(define-values (inliner-logs tr-logs)
(partition inliner-log-entry? log))
(define hot-functions (and profile (prune-profile profile)))
(define grouped-events
(group-by equal? #:key log-entry-pos ; right file, so that's enough
inliner-logs))
(group-by equal? #:key log-entry-pos log)) ; right file, so that's enough
(define new-inline-log-entries
(for*/list ([g (in-list grouped-events)]
[group (in-value (filter (lambda (x)
@ -246,7 +243,7 @@
kind
(format "Inlining ~a" (format-aggregation-string group))
stx located-stx pos provenance))]))))
(append tr-logs (filter values new-inline-log-entries)))
(filter values new-inline-log-entries))
(define (group-badness group)
(+ (n-failures group) (- (n-out-of-fuels group) (n-successes group))))

View File

@ -27,13 +27,13 @@
;; profile is currently only used to refine the inlining logs
(define (generate-report this profile)
(define-values (TR-log mzc-log) (generate-logs this))
(log->report
(post-process-inline-log
(generate-log this)
profile)))
(append TR-log
(post-process-inline-log mzc-log profile))))
(define (generate-log this)
(define (generate-logs this)
(define file-predicate (make-file-predicate this))
(define input (open-input-text-editor this))
(port-count-lines! input)
@ -51,13 +51,16 @@
(with-intercepted-logging
(lambda (l)
;; From mzc, create a log-entry from the info.
(set! mzc-log (cons (mzc-opt-log-message->log-entry (vector-ref l 1))
mzc-log)))
(define entry (mzc-opt-log-message->log-entry (vector-ref l 1)))
(when (right-file? entry)
(set! mzc-log (cons entry mzc-log))))
(lambda ()
(with-intercepted-logging
(lambda (l)
;; From TR, use the log-entry struct provided.
(set! TR-log (cons (vector-ref l 2) TR-log)))
(define entry (vector-ref l 2))
(when (right-file? entry)
(set! TR-log (cons entry TR-log))))
(lambda ()
(run-inside-optimization-coach-sandbox
this
@ -65,7 +68,7 @@
(void (compile (read-syntax (send this get-port-name) input))))))
'debug 'TR-optimizer))
'debug 'optimizer)
(filter right-file? (append (reverse TR-log) (reverse mzc-log))))
(values (reverse TR-log) (reverse mzc-log)))
;; converts log-entry structs to report-entry structs for further