Skip to content

Commit 104f4c1

Browse files
authored
Merge pull request #259 from JuliaCI/teh/gcscrub
bprofile: disable gcscrub by default
2 parents e0b2233 + 9d8adea commit 104f4c1

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/execution.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,15 @@ function prunekwargs(args...)
276276
end
277277
end
278278

279-
function hasevals(params)
279+
function haskw(params, name::Symbol)
280280
for p in params
281-
if isa(p, Expr) && p.head == :kw && first(p.args) == :evals
281+
if isa(p, Expr) && p.head == :kw && first(p.args) == name
282282
return true
283283
end
284284
end
285285
return false
286286
end
287+
hasevals(params) = haskw(params, :evals)
287288

288289
function collectvars(ex::Expr, vars::Vector{Symbol} = Symbol[])
289290
if ex.head == :(=)
@@ -593,6 +594,12 @@ information.
593594
"""
594595
macro bprofile(args...)
595596
_, params = prunekwargs(args...)
597+
if !haskw(args, :gctrial)
598+
args = (args..., Expr(:kw, :gctrial, false))
599+
end
600+
if !haskw(args, :gcsample)
601+
args = (args..., Expr(:kw, :gcsample, false))
602+
end
596603
tmp = gensym()
597604
return esc(quote
598605
local $tmp = $BenchmarkTools.@benchmarkable $(args...)

test/ExecutionTests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ str = String(take!(io))
192192
@test occursin(r"BenchmarkTools(\.jl)?/src/execution\.jl:\d+; _run", str)
193193
@test !occursin(r"BenchmarkTools(\.jl)?/src/execution\.jl:\d+; warmup", str)
194194
@test !occursin(r"BenchmarkTools(\.jl)?/src/execution\.jl:\d+; tune!", str)
195+
b = @bprofile 1+1
196+
Profile.print(IOContext(io, :displaysize=>(24,200)))
197+
str = String(take!(io))
198+
@test !occursin("gcscrub", str)
199+
b = @bprofile 1+1 gctrial=true
200+
Profile.print(IOContext(io, :displaysize=>(24,200)))
201+
str = String(take!(io))
202+
@test occursin("gcscrub", str)
195203

196204
########
197205
# misc #

0 commit comments

Comments
 (0)