From 766656086f3dbaa97d30d96564c084a5a77b007e Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 21 Jun 2019 15:47:32 +0200 Subject: Add a couple of functions around timing That don't rely on timing a single function. --- guix-data-service/jobs/load-new-guix-revision.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index bd675e4..2743519 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -40,6 +40,18 @@ action time-taken) result)) +(define (record-start-time action) + (simple-format #t "debug: Starting ~A\n" action) + (cons action + (current-time))) + +(define record-end-time + (match-lambda + ((action . start-time) + (let ((time-taken (- (current-time) start-time))) + (simple-format #t "debug: Finished ~A, took ~A seconds\n" + action time-taken))))) + (define (all-inferior-package-derivations store inf packages) (define inferior-%supported-systems (inferior-eval '(@ (guix packages) %supported-systems) inf)) -- cgit v1.2.3