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

FR: merge! which initializes tree_point from passed timer #143

Open
mfherbst opened this issue Jan 28, 2022 · 0 comments
Open

FR: merge! which initializes tree_point from passed timer #143

mfherbst opened this issue Jan 28, 2022 · 0 comments

Comments

@mfherbst
Copy link

mfherbst commented Jan 28, 2022

When doing timings in multi-threaded regions currently using the merge! function requires one to pass exactly the path at which the timings are supposed to be stored. Especially for larger nested timings where moreover the nesting might depend on the call hierarchy this is not convenient.

Apart from the breaking change is there any reason not to have the definition

function Base.merge!(self::TimerOutput, others::TimerOutput...; tree_point = [t.name for t in self.timer_stack])
...
end

such that this pattern

const to = TimerOutput()

function workfunction()
    Threads.@threads for i = 1:100
       tlocal = TimerOutput()
       @timeit tlocal "work" sleep(2)
       merge!(to, tlocal)
    end
end

@timeit to "outer" begin
    @timeit to "inner" begin
        workfunction()
   end
end

would automatically accumulate the timings in the path outer/inner/work?

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

No branches or pull requests

1 participant