Skip to content

Commit f28e3c1

Browse files
committed
try making allocations yellow again
1 parent b82d389 commit f28e3c1

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/trials.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,15 +362,16 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
362362
modulestr = "" # "BenchmarkTools."
363363
avgcolor = :green
364364
medcolor = :blue
365+
alloccolor = :yellow
365366
captioncolor = :light_black
366367
showpercentile = 99 # used both for display time, and to set right cutoff of histogram
367368

368-
allocsstr = if allocs(t) == 0
369-
"0 allocations"
369+
alloc_strings = if allocs(t) == 0
370+
("0 allocations", "")
370371
elseif allocs(t) == 1
371-
"1 allocation, " * prettymemory(memory(t))
372+
("1 allocation, ", prettymemory(memory(t))) # divided in two to colour the second
372373
else
373-
prettycount(allocs(t)) * " allocations, total " * prettymemory(memory(t))
374+
(prettycount(allocs(t)) * " allocations, total ", prettymemory(memory(t)))
374375
end
375376

376377
samplesstr = string(
@@ -394,7 +395,9 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
394395
# Memory
395396
println(io)
396397
printstyled(io, pad, "", boxspace; color=boxcolor)
397-
print(io, allocsstr)
398+
# print(io, allocsstr)
399+
print(io, alloc_strings[1])
400+
printstyled(io, alloc_strings[2]; color=alloccolor)
398401

399402
# GC time
400403
if t.gctimes[1] > 0
@@ -437,7 +440,9 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
437440
println(io)
438441

439442
printstyled(io, pad, "", boxspace; color=boxcolor)
440-
println(io, allocsstr)
443+
# println(io, allocsstr)
444+
print(io, alloc_strings[1])
445+
printstyled(io, alloc_strings[2] * "\n"; color=alloccolor)
441446

442447
if !all(iszero, t.gctimes)
443448
# Mean GC time is just that; then we take the percentage of the mean time

0 commit comments

Comments
 (0)