summaryrefslogtreecommitdiff
path: root/tex/context/base/trac-inf.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-03-13 20:40:18 +0200
committerMarius <mariausol@gmail.com>2013-03-13 20:40:18 +0200
commit81cdb024df2aaf01f5f9d76d956b4c1b80c2ae51 (patch)
treeffa5e7f78a20b108ebc95017de09162024a52e27 /tex/context/base/trac-inf.lua
parent793a738b467b82ff9a5c8d2c7bd3b473ada7feba (diff)
downloadcontext-81cdb024df2aaf01f5f9d76d956b4c1b80c2ae51.tar.gz
beta 2013.03.13 19:31
Diffstat (limited to 'tex/context/base/trac-inf.lua')
-rw-r--r--tex/context/base/trac-inf.lua39
1 files changed, 12 insertions, 27 deletions
diff --git a/tex/context/base/trac-inf.lua b/tex/context/base/trac-inf.lua
index 1d39f24a6..fdc07d97d 100644
--- a/tex/context/base/trac-inf.lua
+++ b/tex/context/base/trac-inf.lua
@@ -15,7 +15,6 @@ local type, tonumber = type, tonumber
local format, lower = string.format, string.lower
local concat = table.concat
local clock = os.gettimeofday or os.clock -- should go in environment
-local write_nl = texio and texio.write_nl or print
statistics = statistics or { }
local statistics = statistics
@@ -116,9 +115,10 @@ function statistics.register(tag,fnc)
end
end
-function statistics.show(reporter)
+local report = logs.reporter("mkiv lua stats")
+
+function statistics.show()
if statistics.enable then
- if not reporter then reporter = function(tag,data,n) write_nl(tag .. " " .. data) end end
-- this code will move
local register = statistics.register
register("luatex banner", function()
@@ -139,39 +139,23 @@ function statistics.show(reporter)
end)
end
end
- collectgarbage("collect")
- register("current memory usage", statistics.memused)
+ -- so far
+ -- collectgarbage("collect")
+ register("current memory usage",statistics.memused)
register("runtime",statistics.runtime)
+ logs.newline() -- initial newline
for i=1,#statusinfo do
local s = statusinfo[i]
local r = s[2]()
if r then
- reporter(s[1],r,n)
+ report("%s: %s",s[1],r)
end
end
- write_nl("") -- final newline
+ -- logs.newline() -- final newline
statistics.enable = false
end
end
-local template, report_statistics, nn = nil, nil, 0 -- we only calcute it once
-
-function statistics.showjobstat(tag,data,n)
- if not logs then
- -- sorry
- elseif type(data) == "table" then
- for i=1,#data do
- statistics.showjobstat(tag,data[i],n)
- end
- else
- if not template or n > nn then
- template, n = format("%%-%ss - %%s",n), nn
- report_statistics = logs.reporter("mkiv lua stats")
- end
- report_statistics(format(template,tag,data))
- end
-end
-
function statistics.memused() -- no math.round yet -)
local round = math.round or math.floor
return format("%s MB (ctx: %s MB)",round(collectgarbage("count")/1000), round(status.luastate_bytes/1000000))
@@ -188,8 +172,9 @@ function statistics.runtime()
return statistics.formatruntime(elapsedtime(statistics))
end
-function statistics.timed(action,report)
- report = report or logs.reporter("system")
+local report = logs.reporter("system")
+
+function statistics.timed(action)
starttiming("run")
action()
stoptiming("run")