Show execution time of compilation and simulation
This commit is contained in:
parent
42f22147ea
commit
c6c6744b22
@ -205,6 +205,22 @@
|
||||
(out (get-string-all p)))
|
||||
(values (close-pipe p) out)))
|
||||
|
||||
;;;
|
||||
;;; Same as system-to-string but returns execution time (in ms) also
|
||||
;;;
|
||||
(define* (system-to-string-with-time cmd #:key (pwd #f))
|
||||
(let ((start-time (gettimeofday)))
|
||||
(let-values
|
||||
(((status out)
|
||||
(system-to-string cmd #:pwd pwd)))
|
||||
(let ((stop-time (gettimeofday)))
|
||||
(values status out
|
||||
(exact->inexact
|
||||
(- (+ (* (car stop-time) 1000)
|
||||
(/ (cdr stop-time) 1000))
|
||||
(+ (* (car start-time) 1000)
|
||||
(/ (cdr start-time) 1000)))))))))
|
||||
|
||||
;;;
|
||||
;;; Execute system command and capture stdout and stderr to string list
|
||||
;;;
|
||||
@ -218,10 +234,10 @@
|
||||
;;;
|
||||
;;; Make pretty log from executable output
|
||||
;;;
|
||||
(define (exe-log-pretty cmdline status out)
|
||||
(define (exe-log-pretty cmdline status out time)
|
||||
(string-append
|
||||
(format "$ ~a\n" cmdline)
|
||||
(format "Return code: ~a\n" status)
|
||||
(format "Return code: ~a, Exec time: ~a ms\n" status time)
|
||||
(if (string-null? out)
|
||||
"\n"
|
||||
(format "--\n~a\n" out))))
|
||||
@ -339,19 +355,19 @@
|
||||
(let ((cmdline (format "~a -g2012 -s __~a__ -o ~a -c~a"
|
||||
(wrap-exe IVERILOG-EXE iverilog-wrap)
|
||||
top exe-file command-file)))
|
||||
(let-values (((status out)
|
||||
(system-to-string cmdline)))
|
||||
(let-values (((status out time)
|
||||
(system-to-string-with-time cmdline)))
|
||||
(let ((compile-log
|
||||
(exe-log-pretty cmdline status out)))
|
||||
(exe-log-pretty cmdline status out time)))
|
||||
(if (not (zero? status))
|
||||
(values status compile-log)
|
||||
|
||||
;; Execute
|
||||
(let ((cmdline (format "~a -N ~a" (wrap-exe VVP-EXE vvp-wrap) exe-file)))
|
||||
(let-values (((status out)
|
||||
(system-to-string cmdline)))
|
||||
(let-values (((status out time)
|
||||
(system-to-string-with-time cmdline)))
|
||||
(let ((execution-log
|
||||
(exe-log-pretty cmdline status out)))
|
||||
(exe-log-pretty cmdline status out time)))
|
||||
(values status (string-append compile-log execution-log)))))))))))
|
||||
|
||||
;;;
|
||||
@ -364,20 +380,20 @@
|
||||
(cmdline (format "~a -f ~a"
|
||||
(wrap-exe VERILATR-EXE verilator-wrap)
|
||||
command-file)))
|
||||
(let-values (((status out)
|
||||
(system-to-string cmdline)))
|
||||
(let-values (((status out time)
|
||||
(system-to-string-with-time cmdline)))
|
||||
(let ((compile-log
|
||||
(exe-log-pretty cmdline status out)))
|
||||
(exe-log-pretty cmdline status out time)))
|
||||
(if (not (zero? status))
|
||||
(values status compile-log)
|
||||
|
||||
;; Execute
|
||||
(let ((cmdline (wrap-exe (path+ work-dir (format "~a/~a" top top))
|
||||
verilator-sim-wrap)))
|
||||
(let-values (((status out)
|
||||
(system-to-string cmdline)))
|
||||
(let-values (((status out time)
|
||||
(system-to-string-with-time cmdline)))
|
||||
(let ((execution-log
|
||||
(exe-log-pretty cmdline status out)))
|
||||
(exe-log-pretty cmdline status out time)))
|
||||
(values status (string-append compile-log execution-log))))))))))
|
||||
|
||||
;;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user