Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ The test runner provides real-time output showing:
- Execution time
- GC time and percentage
- Memory allocation
- RSS (Resident Set Size) memory usage
- RSS (Resident Set Size) memory usage, shown in red once it exceeds the RSS threshold and the worker will be restarted

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was suggested by Claude. I thing it's the right place to bring it up, but I'm not sure I like how it's the only option to have extra details.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a blocker we can always tweak the wording if needed


### Graceful Interruption

Expand Down
15 changes: 10 additions & 5 deletions src/ParallelTestRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ struct TestIOContext
percent_align::Int
alloc_align::Int
rss_align::Int
max_worker_rss::Int
end

function test_IOContext(::Type{<:AbstractTestRecord}, stdout::IO, stderr::IO, lock::ReentrantLock, name_align::Int, verbose::Bool)
function test_IOContext(::Type{<:AbstractTestRecord}, stdout::IO, stderr::IO, lock::ReentrantLock, name_align::Int, verbose::Bool, max_worker_rss::Int)
elapsed_align = textwidth("time (s)")
compile_align = textwidth("Compile")
gc_align = textwidth("GC (s)")
Expand All @@ -180,7 +181,7 @@ function test_IOContext(::Type{<:AbstractTestRecord}, stdout::IO, stderr::IO, lo

return TestIOContext(
stdout, stderr, color, verbose, lock, name_align, elapsed_align, compile_align, gc_align, percent_align,
alloc_align, rss_align
alloc_align, rss_align, max_worker_rss
)
end

Expand Down Expand Up @@ -250,8 +251,12 @@ function print_test_finished(record::AbstractTestRecord, wrkr, test, ctx::TestIO
alloc_str = @sprintf("%5.2f", base.bytes / 2^20)
printstyled(ctx.stdout, lpad(alloc_str, ctx.alloc_align, " "), " │ ", color = :white)

rss_str = @sprintf("%5.2f", memory_usage(record) / 2^20)
printstyled(ctx.stdout, lpad(rss_str, ctx.rss_align, " "), " │\n", color = :white)
mem_use = memory_usage(record)
mem_color = mem_use > ctx.max_worker_rss ? :red : :white
rss_str = @sprintf("%5.2f", mem_use / 2^20)
printstyled(ctx.stdout, lpad(rss_str, ctx.rss_align, " "), color = mem_color)

printstyled(ctx.stdout, " │\n", color = :white)

flush(ctx.stdout)
finally
Expand Down Expand Up @@ -1037,7 +1042,7 @@ function _runtests(mod::Module, args::ParsedArgs;
stderr.lock = print_lock
end

io_ctx = test_IOContext(RecordType, stdout, stderr, print_lock, name_align, !isnothing(args.verbose))
io_ctx = test_IOContext(RecordType, stdout, stderr, print_lock, name_align, !isnothing(args.verbose), max_worker_rss)
print_header(RecordType, io_ctx, testgroupheader, workerheader)

status_lines_visible = Ref(0)
Expand Down