From fc61ab9fb1dbf51c7f96f7e08d9e52f2c9a58b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 25 Apr 2019 20:35:26 +0200 Subject: Move statprof to encompass all. --- module/main.scm | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'module/main.scm') diff --git a/module/main.scm b/module/main.scm index 924a846c..d6b1d358 100755 --- a/module/main.scm +++ b/module/main.scm @@ -45,7 +45,8 @@ (map generate-recurrence-set repeating)))))) (define options - '((mode (value #t) (single-char #\m)))) + '((mode (value #t) (single-char #\m)) + (statprof (value #f)))) (define (ornull a b) (if (null? a) @@ -53,13 +54,20 @@ (define (main args) (let ((opts (getopt-long args options #:stop-at-first-non-option #t))) - (init - (lambda (c e) - (let ((ropt (ornull (option-ref opts '() '()) - '("term")))) - ((case (string->symbol (car ropt)) - ((none) none-main) - ((html) html-main) - ((term) terminal-main)) - c e ropt)))) + ((lambda (thunk) (if (option-ref opts 'statprof #f) + ((@ (statprof) statprof) + thunk + #:count-calls? #t + #:display-style 'tree) + (thunk))) + (lambda () + (init + (lambda (c e) + (let ((ropt (ornull (option-ref opts '() '()) + '("term")))) + ((case (string->symbol (car ropt)) + ((none) none-main) + ((html) html-main) + ((term) terminal-main)) + c e ropt)))))) (newline))) -- cgit v1.2.3