Skip to content

Commit 331eab4

Browse files
committed
Rename to debug-stats
1 parent b21f7ca commit 331eab4

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/ParallelTestRunner.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct TestIOContext
108108
stdout::IO
109109
stderr::IO
110110
color::Bool
111-
debug_timing::Bool
111+
debug_stats::Bool
112112
lock::ReentrantLock
113113
name_align::Int
114114
elapsed_align::Int
@@ -119,7 +119,7 @@ struct TestIOContext
119119
rss_align::Int
120120
end
121121

122-
function test_IOContext(stdout::IO, stderr::IO, lock::ReentrantLock, name_align::Int, debug_timing::Bool)
122+
function test_IOContext(stdout::IO, stderr::IO, lock::ReentrantLock, name_align::Int, debug_stats::Bool)
123123
elapsed_align = textwidth("time (s)")
124124
compile_align = textwidth("Compile")
125125
gc_align = textwidth("GC (s)")
@@ -130,7 +130,7 @@ function test_IOContext(stdout::IO, stderr::IO, lock::ReentrantLock, name_align:
130130
color = get(stdout, :color, false)
131131

132132
return TestIOContext(
133-
stdout, stderr, color, debug_timing, lock, name_align, elapsed_align, compile_align, gc_align, percent_align,
133+
stdout, stderr, color, debug_stats, lock, name_align, elapsed_align, compile_align, gc_align, percent_align,
134134
alloc_align, rss_align
135135
)
136136
end
@@ -141,16 +141,16 @@ function print_header(ctx::TestIOContext, testgroupheader, workerheader)
141141
# header top
142142
printstyled(ctx.stdout, " "^(ctx.name_align + textwidth(testgroupheader) - 3), "")
143143
printstyled(ctx.stdout, " Test |", color = :white)
144-
ctx.debug_timing && printstyled(ctx.stdout, " Init │", color = :white)
145-
VERSION >= v"1.11" && ctx.debug_timing && printstyled(ctx.stdout, " Compile │", color = :white)
144+
ctx.debug_stats && printstyled(ctx.stdout, " Init │", color = :white)
145+
VERSION >= v"1.11" && ctx.debug_stats && printstyled(ctx.stdout, " Compile │", color = :white)
146146
printstyled(ctx.stdout, " ──────────────── CPU ──────────────── │\n", color = :white)
147147

148148
# header bottom
149149
printstyled(ctx.stdout, testgroupheader, color = :white)
150150
printstyled(ctx.stdout, lpad(workerheader, ctx.name_align - textwidth(testgroupheader) + 1), "", color = :white)
151151
printstyled(ctx.stdout, "time (s) │", color = :white)
152-
ctx.debug_timing && printstyled(ctx.stdout, " time (s) │", color = :white)
153-
VERSION >= v"1.11" && ctx.debug_timing && printstyled(ctx.stdout, " (%) │", color = :white)
152+
ctx.debug_stats && printstyled(ctx.stdout, " time (s) │", color = :white)
153+
VERSION >= v"1.11" && ctx.debug_stats && printstyled(ctx.stdout, " (%) │", color = :white)
154154
printstyled(ctx.stdout, " GC (s) │ GC % │ Alloc (MB) │ RSS (MB) │\n", color = :white)
155155
flush(ctx.stdout)
156156
finally
@@ -181,7 +181,7 @@ function print_test_finished(record::TestRecord, wrkr, test, ctx::TestIOContext)
181181
time_str = @sprintf("%7.2f", record.time)
182182
printstyled(ctx.stdout, lpad(time_str, ctx.elapsed_align, " "), "", color = :white)
183183

184-
if ctx.debug_timing
184+
if ctx.debug_stats
185185
# pre-testset time
186186
init_time_str = @sprintf("%7.2f", record.total_time - record.time)
187187
printstyled(ctx.stdout, lpad(init_time_str, ctx.elapsed_align, " "), "", color = :white)
@@ -571,7 +571,7 @@ Fields are
571571
572572
* `jobs::Union{Some{Int}, Nothing}`: the number of jobs
573573
* `verbose::Union{Some{Nothing}, Nothing}`: whether verbose printing was enabled
574-
* `debug_timing::Union{Some{Nothing}, Nothing}`: whether debug timing printing was enabled
574+
* `debug_stats::Union{Some{Nothing}, Nothing}`: whether debug stats printing was enabled
575575
* `quickfail::Union{Some{Nothing}, Nothing}`: whether quick fail was enabled
576576
* `list::Union{Some{Nothing}, Nothing}`: whether tests should be listed
577577
* `custom::Dict{String,Any}`: a dictionary of custom arguments
@@ -580,7 +580,7 @@ Fields are
580580
struct ParsedArgs
581581
jobs::Union{Some{Int}, Nothing}
582582
verbose::Union{Some{Nothing}, Nothing}
583-
debug_timing::Union{Some{Nothing}, Nothing}
583+
debug_stats::Union{Some{Nothing}, Nothing}
584584
quickfail::Union{Some{Nothing}, Nothing}
585585
list::Union{Some{Nothing}, Nothing}
586586

@@ -639,7 +639,7 @@ function parse_args(args; custom::Array{String} = String[])
639639
--verbose Print more information during testing.
640640
--quickfail Fail the entire run as soon as a single test errored.
641641
--jobs=N Launch `N` processes to perform tests.
642-
--debug-timing Print testset initialization timings."""
642+
--debug-stats Print information that could be helpful for debugging testset slowdowns."""
643643

644644
if !isempty(custom)
645645
usage *= "\n\nCustom arguments:"
@@ -654,7 +654,7 @@ function parse_args(args; custom::Array{String} = String[])
654654

655655
jobs = extract_flag!(args, "--jobs"; typ = Int)
656656
verbose = extract_flag!(args, "--verbose")
657-
debug_timing = extract_flag!(args, "--debug-timing")
657+
debug_stats = extract_flag!(args, "--debug-stats")
658658
quickfail = extract_flag!(args, "--quickfail")
659659
list = extract_flag!(args, "--list")
660660

@@ -669,7 +669,7 @@ function parse_args(args; custom::Array{String} = String[])
669669
error("Unknown test options `$(join(optlike_args, " "))` (try `--help` for usage instructions)")
670670
end
671671

672-
return ParsedArgs(jobs, verbose, debug_timing, quickfail, list, custom_args, args)
672+
return ParsedArgs(jobs, verbose, debug_stats, quickfail, list, custom_args, args)
673673
end
674674

675675
"""
@@ -870,7 +870,7 @@ function runtests(mod::Module, args::ParsedArgs;
870870
stderr.lock = print_lock
871871
end
872872

873-
io_ctx = test_IOContext(stdout, stderr, print_lock, name_align, !isnothing(args.debug_timing))
873+
io_ctx = test_IOContext(stdout, stderr, print_lock, name_align, !isnothing(args.debug_stats))
874874
print_header(io_ctx, testgroupheader, workerheader)
875875

876876
status_lines_visible = Ref(0)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ end
2929
@testset "debug timing" begin
3030
io = IOBuffer()
3131
io_color = IOContext(io, :color => true)
32-
runtests(ParallelTestRunner, ["--debug-timing"]; stdout=io_color, stderr=io_color)
32+
runtests(ParallelTestRunner, ["--debug-stats"]; stdout=io_color, stderr=io_color)
3333
str = String(take!(io))
3434

3535
@test contains(str, "time (s)") # timing

0 commit comments

Comments
 (0)