Skip to content

Wall-time/all tasks profiler (#55889)#193

Merged
d-netto merged 1 commit intov1.10.2+RAIfrom
dcn-all-task-profiler
Oct 29, 2024
Merged

Wall-time/all tasks profiler (#55889)#193
d-netto merged 1 commit intov1.10.2+RAIfrom
dcn-all-task-profiler

Conversation

@d-netto
Copy link
Copy Markdown

@d-netto d-netto commented Oct 27, 2024

PR Description

Backports JuliaLang#55889.

Checklist

Requirements for merging:

@github-actions github-actions bot added port-to-v1.10 port-to-v1.12 This change should apply to Julia v1.12 builds labels Oct 27, 2024
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.
@d-netto d-netto force-pushed the dcn-all-task-profiler branch from 4cffeca to 2d764a2 Compare October 27, 2024 20:39
@d-netto d-netto added port-to-v1.10 and removed port-to-v1.12 This change should apply to Julia v1.12 builds labels Oct 27, 2024
Copy link
Copy Markdown
Member

@NHDaly NHDaly left a 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! :)

@d-netto
Copy link
Copy Markdown
Author

d-netto commented Oct 29, 2024

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.REPLB123 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

@d-netto d-netto merged commit fc4ae84 into v1.10.2+RAI Oct 29, 2024
@d-netto d-netto deleted the dcn-all-task-profiler branch October 29, 2024 19:21
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.
github-actions bot pushed a commit that referenced this pull request Apr 4, 2026
Stdlib: Tar
URL: https://github.com/JuliaIO/Tar.jl.git
Stdlib branch: master
Julia branch: master
Old commit: e15495e
New commit: 6a61f5c
Julia version: 1.14.0-DEV
Tar version: 1.10.0 (Does not match)
Bump invoked by: @DilumAluthge
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaIO/Tar.jl@e15495e...6a61f5c

```
$ git log --oneline e15495e..6a61f5c
6a61f5c Bump codecov/codecov-action from 4 to 6 (#181)
1a1b323 Bump julia-actions/cache from 2 to 3 (#193)
```

Co-authored-by: DilumAluthge <5619885+DilumAluthge@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants