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

TimespanLogging: Remove worker Id Nesting #387

Closed
Closed
Changes from 1 commit
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
40 changes: 24 additions & 16 deletions lib/TimespanLogging/src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,28 +233,35 @@ function write_event(ml::MultiEventLog, event::Event)
end
end

function get_logs!(ml::MultiEventLog; only_local=false)
logs = Dict{Int,Dict{Symbol,Vector}}()
wkrs = only_local ? myid() : procs()
# FIXME: Log this logic
@sync for p in wkrs
@async begin
logs[p] = remotecall_fetch(p, ml) do ml
mls = get_state(ml)
lock(event_log_lock) do
sublogs = Dict{Symbol,Vector}()
for name in keys(mls.consumers)
sublogs[name] = mls.consumer_logs[name]
mls.consumer_logs[name] = []
function get_logs!(ml::MultiEventLog; only_local=true)
if only_local
# Only return logs from current process
mls = get_state(ml)
return mls.consumer_logs
Copy link
Member

Choose a reason for hiding this comment

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

We need to make a copy of these logs and then empty each vector contained in mls.consumer_logs, as the API of get_logs! is to remove the old logs from mls.consumer_logs so that future calls only include new logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay will fix it

else
# Return logs from all processes
logs = Dict{Int,Dict{Symbol,Vector}}()
wkrs = procs()
@sync for p in wkrs
@async begin
logs[p] = remotecall_fetch(p, ml) do ml
mls = get_state(ml)
lock(event_log_lock) do
sublogs = Dict{Symbol,Vector}()
for name in keys(mls.consumers)
sublogs[name] = mls.consumer_logs[name]
mls.consumer_logs[name] = []
end
sublogs
end
sublogs
end
end
end
end
return logs
return logs
end
Madhupatel08 marked this conversation as resolved.
Show resolved Hide resolved
end


# Core logging operations

empty_prof() = ProfilerResult(UInt[], Dict{UInt64, Vector{Base.StackTraces.StackFrame}}(), UInt[])
Expand Down Expand Up @@ -471,3 +478,4 @@ function summarize_events(time_spent, gc_diff, profiler_samples)
end

summarize_events(xs) = summarize_events(aggregate_events(xs)...)