Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: src/profiler/sampler.cc

Issue 1709873002: Do not record CPU profile samples when stack collection is failed. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make spoiled samples still contribute to the stats. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/profiler/profile-generator.cc ('k') | test/cctest/test-profile-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/sampler.cc
diff --git a/src/profiler/sampler.cc b/src/profiler/sampler.cc
index 45f1d4d3efcfd726409b16ec2aa80f0b673b0d92..3e9ec55a935058f3c22b206c8dcea02adcb5e6e9 100644
--- a/src/profiler/sampler.cc
+++ b/src/profiler/sampler.cc
@@ -671,6 +671,8 @@ DISABLE_ASAN void TickSample::Init(Isolate* isolate,
if (js_entry_sp == 0) return; // Not executing JS now.
if (pc && IsNoFrameRegion(pc)) {
+ // Can't collect stack. Mark the sample as spoiled.
+ timestamp = base::TimeTicks();
pc = 0;
return;
}
@@ -701,6 +703,12 @@ DISABLE_ASAN void TickSample::Init(Isolate* isolate,
GetStackSample(isolate, regs, record_c_entry_frame,
reinterpret_cast<void**>(&stack[0]), kMaxFramesCount, &info);
frames_count = static_cast<unsigned>(info.frames_count);
+ if (!frames_count) {
+ // It is executing JS but failed to collect a stack trace.
+ // Mark the sample as spoiled.
+ timestamp = base::TimeTicks();
+ pc = 0;
+ }
}
@@ -797,7 +805,7 @@ void Sampler::SampleStack(const v8::RegisterState& state) {
TickSample sample_obj;
if (sample == NULL) sample = &sample_obj;
sample->Init(isolate_, state, TickSample::kIncludeCEntryFrame, true);
- if (is_counting_samples_) {
+ if (is_counting_samples_ && !sample->timestamp.IsNull()) {
if (sample->state == JS) ++js_sample_count_;
if (sample->state == EXTERNAL) ++external_sample_count_;
}
« no previous file with comments | « src/profiler/profile-generator.cc ('k') | test/cctest/test-profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698