diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-02-25 19:46:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-02-25 19:46:00 +0100 |
commit | 8ce9c33634056a6c8b9673c7f14a27cef1f3348f (patch) | |
tree | 2cc2233e523548c9925349ff60b80a6ab5b2f3b1 /tex/context/base/trac-inf.lua | |
parent | 66aa7cfc8c9424ee0fe4e62a83b86dac39dc59a1 (diff) | |
download | context-8ce9c33634056a6c8b9673c7f14a27cef1f3348f.tar.gz |
beta 2010.02.25 19:46
Diffstat (limited to 'tex/context/base/trac-inf.lua')
-rw-r--r-- | tex/context/base/trac-inf.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tex/context/base/trac-inf.lua b/tex/context/base/trac-inf.lua index 84fa5507a..315195012 100644 --- a/tex/context/base/trac-inf.lua +++ b/tex/context/base/trac-inf.lua @@ -25,6 +25,14 @@ function statistics.hastimer(instance) return instance and instance.starttime end +function statistics.resettiming(instance) + if not instance then + notimer = { timing = 0, loadtime = 0 } + else + instance.timing, instance.loadtime = 0, 0 + end +end + function statistics.starttiming(instance) if not instance then notimer = { } @@ -168,3 +176,20 @@ function statistics.timed(action,report) report("total runtime: %s",statistics.elapsedtime(timer)) end +-- where, not really the best spot for this: + +commands = commands or { } + +local timer + +function commands.resettimer() + statistics.resettiming(timer) + statistics.starttiming(timer) +end + +function commands.elapsedtime() + statistics.stoptiming(timer) + tex.sprint(statistics.elapsedtime(timer)) +end + +commands.resettimer() |