Move perf-map loading into the Process
#36
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So I ran into a fun bug: the process I'm profiling has a self-update mechanism, so it would first start, find out there's an update, download it and restart itself (with the same PID). The perf map was loaded once for the first process; the whole
Process
is removed with the perf event indicating the execve event. Then theProcess
is recreated, but the perf map isn't reloaded, because we incorrectly marked it as already-loaded before.This moves the code around so it's now the responsibility of the
Process
itself to keep track if it's already loaded the perf map or not, and we do check it once per lifetime ofProcess
. This fixes the bug I was observing, and I can now see the perf maps correctly displayed in the Profiler UI 🥳