Skip to content

Commit c6878f2

Browse files
committed
more
1 parent 3318ae0 commit c6878f2

File tree

2 files changed

+2
-38
lines changed

2 files changed

+2
-38
lines changed

src/trials.jl

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
470470

471471
# Here nextfloat() ensures both endpoints included, will only matter for
472472
# artificial cases such as: Trial(Parameters(), [3,4,5], [0,0,0], 0, 0)
473-
fences = range(histmin, nextfloat(histmax), length=histwidth)
473+
fences = range(histmin, nextfloat(float(histmax)), length=histwidth)
474474
bins = histogram_bindata(t.times, fences)
475475
# Last bin is everything right of last fence, introduce a gap for printing:
476476
_lastbin = pop!(bins)
@@ -574,39 +574,3 @@ function Base.show(io::IO, ::MIME"text/plain", t::TrialJudgement)
574574
end
575575

576576

577-
#=
578-
# Some visual checks, designed so that mean/median should hit a bar
579-
580-
using BenchmarkTools: Trial, Parameters
581-
Trial(Parameters(), [pi * 10^9], [0], 0, 0) # one sample
582-
583-
# mean == median, one bar
584-
Trial(Parameters(), [pi, pi], [0, 0], 0, 0)
585-
Trial(Parameters(), fill(101, 33), vcat(zeros(32), 50), 0, 0)
586-
587-
# mean == median, three bars -- wrong highlighting before
588-
Trial(Parameters(), [3,4,5], [0,0,0], 0, 0)
589-
590-
# three bars, including mean not median -- wrong highlighting before
591-
Trial(Parameters(), pi * [1,3,4,4], [0,0,0,100], 1, 1)
592-
593-
# three bars, including median & both quartiles, not mean -- wrong before
594-
Trial(Parameters(), 99.9 * [1,1,3,14,16], [0,0,99,0,0], 222, 2)
595-
596-
# same, but smaller range. Note also max GC is not max
597-
Trial(Parameters(), 999 .+ [1,1,3,14,16], [0,0,123,0,0], 45e6, 7)
598-
599-
600-
# Check that auto-sizing stops on very small widths:
601-
io = IOContext(stdout, :displaysize => (25,30))
602-
show(io, MIME("text/plain"), Trial(Parameters(), [3,4,5], [0,0,0], 0, 0))
603-
show(io, MIME("text/plain"), Trial(Parameters(), repeat(100 * [3,4,5], 10^6), zeros(3*10^6), 0, 0))
604-
605-
io = IOContext(stdout, :displaysize => (25,50), :logbins => true) # this is wider
606-
show(io, MIME("text/plain"), Trial(Parameters(), 100 * [3,4,5], [0,0,0], 0, 0))
607-
608-
# Check that data off the left is OK, and median still highlighted:
609-
io = IOContext(stdout, :histmin => 200.123)
610-
show(io, MIME("text/plain"), Trial(Parameters(), 99.9 * [1,1,3,14,16], [0,0,99,0,0], 222, 2))
611-
612-
=#

test/TrialsTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,13 @@ s123 = sprint(show, "text/plain", t123)
271271
@test contains(s123, "▁▁█▁▁") # has a histogram, mostly zero
272272
@test contains(s123, "▁▁▁█ ▁\n") # 3.0 fits in last bin, not the overflow
273273
@test endswith(s123, "3 ns +") # right endpoint rounded to 3, no decimals
274-
@test contains(s123, "┌ Trial:") # box starting at the type
275274
@test contains(s123, "3 samples, each 1 evaluation") # caption
276275

277276
t456 = BenchmarkTools.Trial(BenchmarkTools.Parameters(), 100 * [1,1,3,14,16.], [0,0,2,0,0.], 456, 7)
278277
s456 = sprint(show, "text/plain", t456)
279278
@test contains(s456, "7 allocations, total 456 bytes")
280279
@test contains(s456, "GC time: mean 0.400 ns (0.06%), max 2.000 ns (0.67%)")
280+
@test contains(s456, "┌ Trial:") # box starting at the type
281281
@test contains(s456, "│ ◔ ") # 1st quartile lines up with bar
282282
@test contains(s456, "│ █▁▁▁▁▁▁▁")
283283
@test contains(s456, "└ 100 ns ") # box closing + left endpoint without decimals

0 commit comments

Comments
 (0)