diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-04-03 22:35:21 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-04-03 22:35:21 +0200 |
commit | 1e5d7f41ddede5e6400a2a7762032823d3545df4 (patch) | |
tree | bf53397fbdd2b85c94db72321e7d0e466d02acd5 /tex/context/base/mkiv/core-uti.lua | |
parent | 0175a693fcb853ecce7d49f6564895c2dbfd11f1 (diff) | |
download | context-1e5d7f41ddede5e6400a2a7762032823d3545df4.tar.gz |
2018-04-03 22:30:00
Diffstat (limited to 'tex/context/base/mkiv/core-uti.lua')
-rw-r--r-- | tex/context/base/mkiv/core-uti.lua | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/tex/context/base/mkiv/core-uti.lua b/tex/context/base/mkiv/core-uti.lua index fda66ed73..b281b81a4 100644 --- a/tex/context/base/mkiv/core-uti.lua +++ b/tex/context/base/mkiv/core-uti.lua @@ -384,15 +384,37 @@ statistics.register("jobdata time",function() end end) -statistics.register("callbacks", function() - local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 - local pages = texgetcount('realpageno') - 1 - if pages > 1 then - return format("direct: %s, indirect: %s, total: %s (%i per page)", total-indirect, indirect, total, total/pages) - else - return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) +-- statistics.register("callbacks", function() +-- local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0 +-- local pages = texgetcount('realpageno') - 1 +-- if pages > 1 then +-- return format("direct: %s, indirect: %s, total: %s (%i per page)", total-indirect, indirect, total, total/pages) +-- else +-- return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total) +-- end +-- end) + +function statistics.callbacks() + local c_internal = status.callbacks or 0 + local c_file = status.indirect_callbacks or 0 + local c_direct = status.direct_callbacks or 0 + local c_late = status.late_callbacks or 0 + local c_function = status.function_callbacks or 0 + local c_total = c_internal + c_file + c_direct + c_late + c_function + local n_pages = texgetcount('realpageno') - 1 + local c_average = n_pages > 0 and math.round(c_total/n_pages) or 0 + local s_result = format ( + c_average > 0 and "internal: %s, file: %s, direct: %s, late: %s, function %s, total: %s (%s per page)" + or "internal: %s, file: %s, direct: %s, late: %s, function %s, total: %s", + c_internal, c_file, c_direct, c_late, c_function, c_total, c_average + ) + statistics.callbacks = function() + return s_result end -end) + return s_result +end + +statistics.register("callbacks", statistics.callbacks) statistics.register("randomizer", function() if rmethod and rvalue then @@ -436,7 +458,7 @@ end implement { name = "savevariable", actions = job.variables.save, - arguments = { "string", "string" } + arguments = "2 strings", } implement { |