local profile = require"jit.profile" local function start(period,file) local function cb(thread,samples,vmstate) file:write(profile.dumpstack(thread,"pF l;",-100), vmstate, " ", samples, "\n") end profile.start("vli"..tonumber(period), cb) end local function stop() profile.stop() end return {start=start,stop=stop}