[profiler] Skip over empty samples in the CPUSampler
The CpuProfile previously emitted a CpuProfileMaxSamplesCallbackTask if there was a sample where V8 could not resolve the stack. This resulted in a premature "samplebufferfull" events for the self-profiling API. Skipping over samples without a resolved stack solves this issue. Bug: chromium:1334366 Change-Id: If7a375dbf533c391307e8e506b37c0e3705f63b2 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776680 Reviewed-by: Patrick Thier <pthier@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/main@{#81871}
This commit is contained in:
parent
a49fdc7aed
commit
49cbac3093
@ -625,17 +625,16 @@ void CpuProfile::AddPath(base::TimeTicks timestamp,
|
||||
ProfileNode* top_frame_node =
|
||||
top_down_.AddPathFromEnd(path, src_line, update_stats, options_.mode());
|
||||
|
||||
bool is_buffer_full =
|
||||
options_.max_samples() != CpuProfilingOptions::kNoSampleLimit &&
|
||||
samples_.size() >= options_.max_samples();
|
||||
bool should_record_sample =
|
||||
!timestamp.IsNull() && timestamp >= start_time_ &&
|
||||
(options_.max_samples() == CpuProfilingOptions::kNoSampleLimit ||
|
||||
samples_.size() < options_.max_samples());
|
||||
!timestamp.IsNull() && timestamp >= start_time_ && !is_buffer_full;
|
||||
|
||||
if (should_record_sample) {
|
||||
samples_.push_back(
|
||||
{top_frame_node, timestamp, src_line, state_tag, embedder_state_tag});
|
||||
}
|
||||
|
||||
if (!should_record_sample && delegate_ != nullptr) {
|
||||
} else if (is_buffer_full && delegate_ != nullptr) {
|
||||
const auto task_runner = V8::GetCurrentPlatform()->GetForegroundTaskRunner(
|
||||
reinterpret_cast<v8::Isolate*>(profiler_->isolate()));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user