Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ function stop_tracking_time()
compute_context[] = nothing
end

struct TrackTime
obj
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually an NDSparse object -- this is quite useful to filter timings for specific steps (e.g. comm / compute) or specific processes. It would be nice to make a note of how to get to this in the printing? Once taken out, the NDSparse has to be wrapped again in this type to display as it does...

end

Base.show(io::IO, ::MIME"text/plain", t::TrackTime) = show_timings(t.obj, maxdepth=5)

"""
`tracktime(f)`

Expand All @@ -96,8 +102,7 @@ function tracktime(f; profile=false, maxdepth=5)
ctx = compute_context[]
stop_tracking_time()
t = fetch_timings!(ctx, profile=profile)
show_timings(t, maxdepth=maxdepth)
t, res
TrackTime(t), res
end

function fetch_timings!(ctx=get_context(); profile=true)
Expand Down