diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-08-25 20:19:49 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-08-25 20:19:49 +0200 |
commit | b2c10135056be4af1a52ed8ef7b3f1f4017dccc0 (patch) | |
tree | e6f9d9423263865c5c405830c1879aa01287fe37 /tex/context/base/mkiv/trac-log.lua | |
parent | da0b592a10f24f30cabb510a45550b939693d687 (diff) | |
download | context-b2c10135056be4af1a52ed8ef7b3f1f4017dccc0.tar.gz |
2020-08-25 19:59:00
Diffstat (limited to 'tex/context/base/mkiv/trac-log.lua')
-rw-r--r-- | tex/context/base/mkiv/trac-log.lua | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/tex/context/base/mkiv/trac-log.lua b/tex/context/base/mkiv/trac-log.lua index 4917c0ec8..4fbab5cdc 100644 --- a/tex/context/base/mkiv/trac-log.lua +++ b/tex/context/base/mkiv/trac-log.lua @@ -804,14 +804,22 @@ if tex then end local timing = false + local usage = false local lasttime = nil - trackers.register("pages.timing", function(v) -- only for myself (diagnostics) - timing = "" - end) + logs.private = { + enablepagetiming = function() + usage = true + end, + getpagetiming = function() + return type(usage) == "table" and usage + end, + } + + trackers.register("pages.timing", function() timing = "" end) function logs.stop_page_number() -- the first page can includes the initialization so we omit this in average - if timing then + if timing or usage then local elapsed = statistics.currenttime(statistics) local average, page if not lasttime or real < 2 then @@ -822,7 +830,23 @@ if tex then page = elapsed - lasttime end lasttime = elapsed - timing = formatters[", total %0.03f, page %0.03f, average %0.03f"](elapsed,page,average) + if timing then + timing = formatters[", total %0.03f, page %0.03f, average %0.03f"](elapsed,page,average) + end + if usage then + usage = { + page = { + real = real, + user = user, + sub = sub, + }, + time = { + elapsed = elapsed, + page = page, + average = average, + } + } + end end if real <= 0 then report("flushing page%s",timing) |