Commit 9bd74dfd authored by Andrew Comminos's avatar Andrew Comminos Committed by V8 LUCI CQ

[cpu-profiler] Include empty samples when context filter fails

If context filtration fails, ensure that we still include an empty
sample. This ensures that we can properly terminate stacks.

Bug: chromium:956688
Change-Id: I3edeb3434960c420e24827c209055f7c378361bf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3058053Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Andrew Comminos <acomminos@fb.com>
Cr-Commit-Position: refs/heads/master@{#75980}
parent e0a0350a
......@@ -952,11 +952,13 @@ void CpuProfilesCollection::AddPathToCurrentProfiles(
// method, we don't bother minimizing the duration of lock holding,
// e.g. copying contents of the list to a local vector.
current_profiles_semaphore_.Wait();
const ProfileStackTrace empty_path;
for (const std::unique_ptr<CpuProfile>& profile : current_profiles_) {
if (profile->context_filter().Accept(native_context_address)) {
profile->AddPath(timestamp, path, src_line, update_stats,
sampling_interval);
}
// If the context filter check failed, omit the contents of the stack.
bool accepts_context =
profile->context_filter().Accept(native_context_address);
profile->AddPath(timestamp, accepts_context ? path : empty_path, src_line,
update_stats, sampling_interval);
}
current_profiles_semaphore_.Signal();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment