summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-02-08 23:01:17 +0000
committerKarl Berry <karl@freefriends.org>2019-02-08 23:01:17 +0000
commit3b0cc990de05db69e604e690e76754217a5a759b (patch)
treece99efc6326a6cad266fa8e6beb59b3d68f93022 /Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua
parentab1456ac100fab623d9d9e62c3ba878930d944aa (diff)
lualibs (7feb19)
git-svn-id: svn://tug.org/texlive/trunk@49982 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua15
1 files changed, 12 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua
index 6c08f34f6e7..7a5c35fd5fa 100644
--- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua
+++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-trac-inf.lua
@@ -253,16 +253,25 @@ end
function statistics.runtime()
stoptiming(statistics)
-- stoptiming(statistics) -- somehow we can start the timer twice, but where
- return statistics.formatruntime(elapsedtime(statistics))
+ local runtime = lua.getruntime and lua.getruntime() or elapsedtime(statistics)
+ return statistics.formatruntime(runtime)
end
local report = logs.reporter("system")
-function statistics.timed(action)
+function statistics.timed(action,all)
starttiming("run")
action()
stoptiming("run")
- report("total runtime: %s seconds",elapsedtime("run"))
+ local runtime = tonumber(elapsedtime("run"))
+ if all then
+ local alltime = tonumber(lua.getruntime and lua.getruntime() or elapsedtime(statistics))
+ if alltime and alltime > 0 then
+ report("total runtime: %0.3f seconds of %0.3f seconds",runtime,alltime)
+ return
+ end
+ end
+ report("total runtime: %0.3f seconds",runtime)
end
-- goodie