@@ -135,15 +135,33 @@ tune!(b)
135
135
# test kwargs separated by `,`
136
136
@benchmark (output= sin (x), setup= (x= 1.0 ; output= 0.0 ), teardown= (@test output == sin (x)))
137
137
138
- io = IOBuffer ()
139
- ioctx = IOContext (io, :histmin => 0.5 , :histmax => 8 , :logbins => false )
140
- b = @benchmark x^ 3 setup= (x = rand ()); show (ioctx, MIME (" text/plain" ), b)
141
- b = @benchmark x^ 3.0 setup= (x = rand ()); show (ioctx, MIME (" text/plain" ), b)
142
- str = String (take! (io))
143
- idx = findfirst (r" 0.5 ns +Histogram: frequency by time +8 ns" , str)
144
- @test isa (idx, UnitRange)
145
- idx = findnext ( r" 0.5 ns +Histogram: frequency by time +8 ns" , str, idx[end ]+ 1 )
146
- @test isa (idx, UnitRange)
138
+ for (tf, rex1, rex2) in ((false , r" 0.5 ns +Histogram: frequency by time +8 ns" , r" Histogram: frequency" ),
139
+ (true , r" 0.5 ns +Histogram: log\( frequency\) by time +8 ns" , r" Histogram: log\( frequency\) " ))
140
+ io = IOBuffer ()
141
+ ioctx = IOContext (io, :histmin => 0.5 , :histmax => 8 , :logbins => tf)
142
+ @show tf
143
+ b = @benchmark x^ 3 setup= (x = rand ()); show (ioctx, MIME (" text/plain" ), b)
144
+ b = @benchmark x^ 3.0 setup= (x = rand ()); show (ioctx, MIME (" text/plain" ), b)
145
+ str = String (take! (io))
146
+ idx = findfirst (rex1, str)
147
+ @test isa (idx, UnitRange)
148
+ idx = findnext ( rex1, str, idx[end ]+ 1 )
149
+ @test isa (idx, UnitRange)
150
+ ioctx = IOContext (io, :logbins => tf)
151
+ # A flat distribution won't trigger log by default
152
+ b = BenchmarkTools. Trial (BenchmarkTools. DEFAULT_PARAMETERS, 0.001 * (1 : 100 ) * 1e9 , zeros (100 ), 0 , 0 )
153
+ show (ioctx, MIME (" text/plain" ), b)
154
+ str = String (take! (io))
155
+ idx = findfirst (rex2, str)
156
+ @test isa (idx, UnitRange)
157
+ # A peaked distribution will trigger log by default
158
+ t = [fill (1 , 21 ); 2 ]
159
+ b = BenchmarkTools. Trial (BenchmarkTools. DEFAULT_PARAMETERS, t/ sum (t)* 1e9 * BenchmarkTools. DEFAULT_PARAMETERS. seconds, zeros (100 ), 0 , 0 )
160
+ show (ioctx, MIME (" text/plain" ), b)
161
+ str = String (take! (io))
162
+ idx = findfirst (rex2, str)
163
+ @test isa (idx, UnitRange)
164
+ end
147
165
148
166
# ############
149
167
# @bprofile #
0 commit comments