From: Hannu Niemistö Date: Tue, 7 Nov 2017 14:01:58 +0000 (+0200) Subject: (refs #7606) Timing with task name (Debug module) X-Git-Tag: v1.31.0~51^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=6e089e3ef1f7e6e3bad6c54a3ce19279796bb6cf;p=simantics%2Fplatform.git (refs #7606) Timing with task name (Debug module) Change-Id: I05aee8105315ac0bb8f6eefdca52334b42ce3149 --- diff --git a/bundles/org.simantics.scl.runtime/scl/Debug.scl b/bundles/org.simantics.scl.runtime/scl/Debug.scl index 858f87c80..ba0c7baa9 100644 --- a/bundles/org.simantics.scl.runtime/scl/Debug.scl +++ b/bundles/org.simantics.scl.runtime/scl/Debug.scl @@ -23,6 +23,15 @@ reportTime f = runProc do time = Java.l2d (endTime-beginTime) * 1e-9 print "time \(time) s" result + +reportTimeM :: String -> ( a) -> a +reportTimeM task f = runProc do + beginTime = nanoTime () + result = f + endTime = nanoTime () + time = Java.l2d (endTime-beginTime) * 1e-9 + print "\(task): \(time) s" + result """ Prints the given text and returns