M
Size: a a a
M
YD
YD
ED
https://tarantool.io/installer.sh
M
DS
AT
M
DS
AT
DS
DS
M
M
MA
M
MA
M
MA
local TOO_LONG_CALL_THRESHOLD = 0.1
local clock = require 'clock'
local json = require 'json'.new()
json.cfg{ encode_use_tostring = true }
local function ftail(fname, args, start, ...)
local run = clock.realtime() - start
if run > TOO_LONG_CALL_THRESHOLD then
log.info("Function call %s(%s) was too long: %0.2fs", fname, json.encode(args), run)
end
return ...
end
local function ftrace(fname, func)
return function(...)
local start = clock.realtime()
return ftail(fname, {...}, start, func(...))
end
end
local function apply_ftrace(name, namespace)
for fname, v in pairs(namespace) do
if type(v) == 'table' then
apply_ftrace(name .. '.' .. fname, v)
elseif type(v) == 'function' and v ~= ftrace then
namespace[fname] = ftrace(name .. '.' .. fname, v)
end
end
end
app.smth.func()
)apply_ftrace('app',app)
M
local TOO_LONG_CALL_THRESHOLD = 0.1
local clock = require 'clock'
local json = require 'json'.new()
json.cfg{ encode_use_tostring = true }
local function ftail(fname, args, start, ...)
local run = clock.realtime() - start
if run > TOO_LONG_CALL_THRESHOLD then
log.info("Function call %s(%s) was too long: %0.2fs", fname, json.encode(args), run)
end
return ...
end
local function ftrace(fname, func)
return function(...)
local start = clock.realtime()
return ftail(fname, {...}, start, func(...))
end
end
local function apply_ftrace(name, namespace)
for fname, v in pairs(namespace) do
if type(v) == 'table' then
apply_ftrace(name .. '.' .. fname, v)
elseif type(v) == 'function' and v ~= ftrace then
namespace[fname] = ftrace(name .. '.' .. fname, v)
end
end
end
app.smth.func()
)apply_ftrace('app',app)