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...)
276276 end
277277end
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
286286end
287+ hasevals (params) = haskw (params, :evals )
287288
288289function collectvars (ex:: Expr , vars:: Vector{Symbol} = Symbol[])
289290 if ex. head == :(= )
@@ -593,6 +594,12 @@ information.
593594"""
594595macro 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... )
Original file line number Diff line number Diff 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 #
You can’t perform that action at this time.
0 commit comments