From 087ba27576bf925136e6199e7c61a404aed7b030 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Thu, 2 Jun 2022 10:49:47 -0400 Subject: [PATCH] [Profile] `threads` here is wrong to use `nthreads` (#45547) Since the `data` argument possibly does not come from the current configuration, we should not use `nthreads` here either to filter out possibly significant data. (cherry picked from commit b46c14e73163715956b35264fae74eaab74240a8) --- stdlib/Profile/src/Profile.jl | 4 ++-- stdlib/Profile/test/runtests.jl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/Profile/src/Profile.jl b/stdlib/Profile/src/Profile.jl index d3d5300c87527..e24544839fc5f 100644 --- a/stdlib/Profile/src/Profile.jl +++ b/stdlib/Profile/src/Profile.jl @@ -220,7 +220,7 @@ The keyword arguments can be any combination of: `:flatc` does the same but also includes collapsing of C frames (may do odd things around `jl_apply`). - `threads::Union{Int,AbstractVector{Int}}` -- Specify which threads to include snapshots from in the report. Note that - this does not control which threads samples are collected on. + this does not control which threads samples are collected on (which may also have been collected on another machine). - `tasks::Union{Int,AbstractVector{Int}}` -- Specify which tasks to include snapshots from in the report. Note that this does not control which tasks samples are collected within. @@ -238,7 +238,7 @@ function print(io::IO, sortedby::Symbol = :filefuncline, groupby::Union{Symbol,AbstractVector{Symbol}} = :none, recur::Symbol = :off, - threads::Union{Int,AbstractVector{Int}} = 1:Threads.nthreads(), + threads::Union{Int,AbstractVector{Int}} = 1:typemax(Int), tasks::Union{UInt,AbstractVector{UInt}} = typemin(UInt):typemax(UInt)) pf = ProfileFormat(;C, combine, maxdepth, mincount, noisefloor, sortedby, recur) diff --git a/stdlib/Profile/test/runtests.jl b/stdlib/Profile/test/runtests.jl index f8f8c52b93123..058158023cd25 100644 --- a/stdlib/Profile/test/runtests.jl +++ b/stdlib/Profile/test/runtests.jl @@ -64,8 +64,8 @@ end iobuf = IOBuffer() with_logger(NullLogger()) do @testset for format in [:flat, :tree] - @testset for threads in [1:Threads.nthreads(), 1, 1:1, 1:2, [1,2]] - @testset for groupby in [:none, :thread, :task, [:thread, :task], [:task, :thread]] + @testset for threads in Any[1:typemax(Int), 1, 1:1, 1:2, [1,2]] + @testset for groupby in Any[:none, :thread, :task, [:thread, :task], [:task, :thread]] Profile.print(iobuf; groupby, threads, format) @test !isempty(String(take!(iobuf))) end