forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wall-time/all tasks profiler (#55889) #193
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
One limitation of sampling CPU/thread profiles, as is currently done in Julia, is that they primarily capture samples from CPU-intensive tasks. If many tasks are performing IO or contending for concurrency primitives like semaphores, these tasks won’t appear in the profile, as they aren't scheduled on OS threads sampled by the profiler. A wall-time profiler, like the one implemented in this PR, samples tasks regardless of OS thread scheduling. This enables profiling of IO-heavy tasks and detecting areas of heavy contention in the system. Co-developed with @nickrobinson251.
4cffeca
to
2d764a2
Compare
NHDaly
approved these changes
Oct 29, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the tests on the branch locally, since we still don't have CI set up here yet. 😭
Otherwise, LGTM! :)
Tests are passing: julia> Base.runtests(["Profile"])
Running parallel tests with:
nworkers() = 1
nthreads() = 1
Sys.CPU_THREADS = 4
Sys.total_memory() = 64.000 GiB
Sys.free_memory() = 34.233 GiB
Test (Worker) | Time (s) | GC (s) | GC % | Alloc (MB) | RSS (MB)
Profile (1) | started at 2024-10-29T16:18:42.098
Profile (1) | 39.26 | 0.30 | 0.8 | 1768.34 | 1677.02
Test Summary: | Pass Total Time
Overall | 17973 17973 39.9s
SUCCESS and: julia> using Profile
julia> Profile.@profile_walltime sleep(1)
julia> Profile.print()
Overhead ╎ [+additional indent] Count File:Line; Function
=========================================================
╎123 @REPL/src/REPL.jl:386; (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
╎ 123 …ulia-RAI/usr/lib/julia/sys.dylib:?; run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLB…
╎ 123 …ulia-RAI/usr/lib/julia/sys.dylib:?; run_interface(terminal::REPL.Terminals.TextTerminal, m::…
╎ 123 …lia-RAI/usr/lib/julia/sys.dylib:?; (::REPL.var"#do_respond#80"{Bool, Bool, REPL.var"#93#103…
╎ 123 …lia-RAI/usr/lib/julia/sys.dylib:?; eval_with_backend(ast::Any, backend::REPL.REPLBackendRe…
╎ 123 …lia-RAI/usr/lib/julia/sys.dylib:?; take_buffered(c::Channel{Any})
╎ ╎ 123 …ia-RAI/usr/lib/julia/sys.dylib:?; wait(c::Base.GenericCondition{ReentrantLock}; first::B…
╎ ╎ 123 @Base/task.jl:995; wait()
123╎ ╎ 123 …a-RAI/usr/lib/julia/sys.dylib:?; try_yieldto(undo::typeof(Base.ensure_rescheduled))
Total snapshots: 769 |
nickrobinson251
pushed a commit
that referenced
this pull request
Feb 26, 2025
One limitation of sampling CPU/thread profiles, as is currently done in Julia, is that they primarily capture samples from CPU-intensive tasks. If many tasks are performing IO or contending for concurrency primitives like semaphores, these tasks won’t appear in the profile, as they aren't scheduled on OS threads sampled by the profiler. A wall-time profiler, like the one implemented in this PR, samples tasks regardless of OS thread scheduling. This enables profiling of IO-heavy tasks and detecting areas of heavy contention in the system. Co-developed with @nickrobinson251.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
Backports JuliaLang#55889.
Checklist
Requirements for merging:
port-to-*
labels that don't apply.