Skip to content
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

RFC: Use ScopedValues.jl for TimerOutputs #169

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vchuravy
Copy link

I used TimerOutputs as place to potentially use https://github.com/vchuravy/ScopedValues.jl / JuliaLang/julia#50958

This removes the need for the user to interact directly with TimerOutput variables.

julia> using TimerOutputs

julia> function f()
         @timeit Timer begin
                 @timeit Timer begin
                 end
              end
           end
f (generic function with 1 method)

julia> TimerOutputs.current_timer()
 ────────────────────────────────────────────────────────────────────
                            Time                    Allocations      
                   ───────────────────────   ────────────────────────
  Total measured:          0.00ns                      0.00B         

 Section   ncalls     time    %tot     avg     alloc    %tot      avg
 ────────────────────────────────────────────────────────────────────
 ────────────────────────────────────────────────────────────────────

running f(); TimerOutputs.reset_timer()

julia> f()

julia> TimerOutputs.current_timer()
 ────────────────────────────────────────────────────────────────────
                            Time                    Allocations      
                   ───────────────────────   ────────────────────────
  Total measured:           730ns                       256B         

 Section   ncalls     time    %tot     avg     alloc    %tot      avg
 ────────────────────────────────────────────────────────────────────
 Timer          1    730ns  100.0%   730ns      256B  100.0%     256B
   Timer        1    260ns   35.6%   260ns     0.00B    0.0%    0.00B
 ────────────────────────────────────────────────────────────────────

This is largely just an experiment, and obviously very breaking.
If folks are interested in this I would be happy to cleanup the tests,
and docs.

@KristofferC
Copy link
Owner

Sorry for not commenting on it earlier, totally missed it.

This would make it more similar to Tracy where there is only "one" profiling object where everything goes into? There is some niceness to that but it could potentially also show a lot of unrelated stuff in your dependencies I guess? Could potentially be solved with some filtering in the output function thought?

@vchuravy
Copy link
Author

Yeah this mean by default there is only one root, but we could totally create a new root and not wire it up to the parent.

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