Skip to content

Commit e44fe10

Browse files
committed
stats: print percentages only if time itself is shown
1 parent 8f868b6 commit e44fe10

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/testset.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,17 @@ function print_counts(ts::ReTestSet, fmt::Format, depth, align,
379379
time_str = hide_zero(@sprintf("%6.2f", timed.time), "s")
380380
printstyled("| ", time_str, " ", color=:white)
381381
if VERSION >= v"1.6-"
382-
compile_str = hide_zero(@sprintf("%5.1f", timed.compile_time / 10^7 / timed.time), "%")
382+
compile_str = all(==(' '), time_str) ?
383+
' '^6 : # print percentages only if time itself is shown!
384+
# (also, this can result in weird things, like "30663.3%",
385+
# if e.g. there was no @test in the @testset)
386+
hide_zero(@sprintf("%5.1f", timed.compile_time / 10^7 / timed.time), "%")
383387
# can be >= 100% !?
384388
printstyled(compile_str, " ", color=:white)
385389
end
386-
gc_str = hide_zero(@sprintf("%4.1f", 100 * timed.gctime / timed.time), "%")
390+
gc_str = all(==(' '), time_str) ?
391+
' '^5 :
392+
hide_zero(@sprintf("%4.1f", 100 * timed.gctime / timed.time), "%")
387393
printstyled(gc_str, " | ", color=:white)
388394

389395
alloc_str = hide_zero(@sprintf("%6.1f", timed.bytes / 2^20), "M")

0 commit comments

Comments
 (0)