aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2023-09-09 02:18:58 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2023-09-09 02:18:58 +0300
commit1cfaa431c1f3c4f417811dcff342c9f28600f13f (patch)
tree463b3ea6405be7bdc6d4d4b8358e787ae6f60f16
parente409cea4435608ad6d53ebffe6a06f34142b1fa7 (diff)
downloadapplause2-1cfaa431c1f3c4f417811dcff342c9f28600f13f.tar.gz
Stream:jdump() prints less unrelated traces now
-rw-r--r--applause.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/applause.lua b/applause.lua
index 96beada..5b8e87e 100644
--- a/applause.lua
+++ b/applause.lua
@@ -500,27 +500,31 @@ function Stream:benchmark()
end
-- Dump bytecode of tick function.
+-- FIXME: Return string instead
function Stream:jbc(out, all)
-- Load the utility library on-demand.
-- Its API is not stable according to luajit docs.
require("jit.bc").dump(self:gtick(), out, all)
end
+-- FIXME: Return string instead
function Stream:jdump(opt, outfile)
local dump = require("jit.dump")
local tick = self:gtick()
+ jit.off(true, true)
+ jit.on(tick, true)
-- Make sure we discard any existing traces to
-- arrive at more or less reproducible results
jit.flush(tick, true)
- jit.on(tick, true)
dump.on(opt, outfile)
- -- FIXME: A single tick() call will not get jit-compiled
+ -- NOTE: A single tick() call may not get JIT-compiled
-- and there appears to be no way to force compilation of a function.
-- Getting any output at all would require saving the stream and
-- force some bulk calculations, so instead we always generate
-- up to 1s of samples here.
+ -- See also the "hotloop" optimization parameter.
local _, err = pcall(function()
for _ = 1, samplerate do tick() end
end)