File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -276,14 +276,15 @@ function prunekwargs(args...)
276
276
end
277
277
end
278
278
279
- function hasevals (params)
279
+ function haskw (params, name :: Symbol )
280
280
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
282
282
return true
283
283
end
284
284
end
285
285
return false
286
286
end
287
+ hasevals (params) = haskw (params, :evals )
287
288
288
289
function collectvars (ex:: Expr , vars:: Vector{Symbol} = Symbol[])
289
290
if ex. head == :(= )
@@ -593,6 +594,12 @@ information.
593
594
"""
594
595
macro bprofile (args... )
595
596
_, 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
596
603
tmp = gensym ()
597
604
return esc (quote
598
605
local $ tmp = $ BenchmarkTools. @benchmarkable $ (args... )
Original file line number Diff line number Diff line change @@ -192,6 +192,14 @@ str = String(take!(io))
192
192
@test occursin (r" BenchmarkTools(\. jl)?/src/execution\. jl:\d +; _run" , str)
193
193
@test ! occursin (r" BenchmarkTools(\. jl)?/src/execution\. jl:\d +; warmup" , str)
194
194
@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)
195
203
196
204
# #######
197
205
# misc #
You can’t perform that action at this time.
0 commit comments