1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-23 08:15:29 +01:00

@logtime(logger, ex) macro

This commit is contained in:
kalmarek 2017-08-27 19:56:35 +02:00
parent 2724612ea3
commit b781dae356

View File

@ -86,6 +86,19 @@ function ΔandSDPconstraints{T<:GroupElem}(S::Vector{T}, Id::T; radius::Int=2)
return Δ, sdp_constraints return Δ, sdp_constraints
end end
macro logtime(logger, ex)
quote
local stats = Base.gc_num()
local elapsedtime = Base.time_ns()
local val = $(esc(ex))
elapsedtime = Base.time_ns() - elapsedtime
local diff = Base.GC_Diff(Base.gc_num(), stats)
local ts = time_string(elapsedtime, diff.allocd, diff.total_time,
Base.gc_alloc_count(diff))
esc(warn($(esc(logger)), ts))
val
end
end
function timed_msg(t) function timed_msg(t)
elapsed = t[2] elapsed = t[2]