Skip to content

Commit

Permalink
add compile heuristic to all perf macros
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Oct 30, 2019
1 parent b9546c8 commit b36a8c6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ julia> @time begin
"""
macro time(ex)
quote
while false; end # compiler heuristic: compile this block (alter this if the heuristic changes)
local stats = gc_num()
local elapsedtime = time_ns()
local val = $(esc(ex))
Expand Down Expand Up @@ -189,6 +190,7 @@ malloc() calls: 1
"""
macro timev(ex)
quote
while false; end # compiler heuristic: compile this block (alter this if the heuristic changes)
local stats = gc_num()
local elapsedtime = time_ns()
local val = $(esc(ex))
Expand All @@ -214,9 +216,10 @@ julia> @elapsed sleep(0.3)
"""
macro elapsed(ex)
quote
while false; end # compiler heuristic: compile this block (alter this if the heuristic changes)
local t0 = time_ns()
local val = $(esc(ex))
(time_ns()-t0)/1e9
$(esc(ex))
(time_ns() - t0) / 1e9
end
end

Expand Down Expand Up @@ -280,6 +283,7 @@ julia> memallocs.total_time
"""
macro timed(ex)
quote
while false; end # compiler heuristic: compile this block (alter this if the heuristic changes)
local stats = gc_num()
local elapsedtime = time_ns()
local val = $(esc(ex))
Expand Down

0 comments on commit b36a8c6

Please sign in to comment.