Thank you, Hans! I am playing with it right now and will try to add a simple example to the wiki. For the time being, I just want to keep some sort of statistics around, also to measure performance of my computers and servers. Since the log file will be read and written to by other programs as well, I'm keeping it very simple, in a text format, so I simplify your code a bit, maybe that's a good starting point for others on the wiki to elaborate. All best Thomas On 11/20/24 9:10 AM, Hans Hagen wrote:
Ah, you're trying to locate bottlenecks ... you need to register timing pretty late, like this:
\startluacode luatex.wrapup ( function() -- print("saving runtime in foo.txt") io.savedata("foo.txt",statistics.elapsedtime(lua.getruntime())) -- local t = { runtime = statistics.elapsedtime(lua.getruntime()), mytime = statistics.elapsedtime("foo"), } print("saving runtime in foo.lua") table.save("foo.lua",t) -- end ) \stopluacode
\starttext
% it's showtime:
runtime : \cldcontext { io.loaddata("foo.txt") }
mytime: \cldcontext { ( table.load("foo.lua") or { } ).mytime }
% let's waste some time:
\ctxlua{statistics.starttiming("foo")} \dorecurse{500}{ \glyphxscale\numexpr1000-#1\relax \samplefile{knuthmath} \blank } \ctxlua{statistics.stoptiming("foo")}
\stoptext
Wikifying a better example probably takes more time than this run,
Hans
-- Prof. Dr. Thomas A. Schmitz Institut für Klassische und Romanische Philologie Universität Bonn Rabinstr. 8 53111 Bonn http://www.philologie.uni-bonn.de/de/personal/schmitz