(defmacro report-to-file (filename repeat &body form) (let ((report-out (gensym)) (idx (gensym))) `(with-open-file (,report-out ,filename :direction :output) (let ((*trace-output* ,report-out)) (loop for ,idx from 1 upto ,repeat do (format ,report-out "==== PROF ~A ====~%" ,idx) (time ,@form))))))