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

Unified Diff: profiler/stack_sampling_profiler.cc

Issue 2045303002: Update to Chromium //base at Chromium commit 3e81715e6d3a4324362635aea46ce1f1a163cca1. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/domokit/base@master
Patch Set: Created 4 years, 6 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 | « profiler/stack_sampling_profiler.h ('k') | profiler/stack_sampling_profiler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: profiler/stack_sampling_profiler.cc
diff --git a/profiler/stack_sampling_profiler.cc b/profiler/stack_sampling_profiler.cc
index 7f12b71e623a56e6359db931cf700d3a5014f9a4..b74f74532c00c9b50da0e3e0b4b0b2d6729b797f 100644
--- a/profiler/stack_sampling_profiler.cc
+++ b/profiler/stack_sampling_profiler.cc
@@ -139,14 +139,14 @@ void StackSamplingProfiler::SamplingThread::ThreadMain() {
// adhering to the sampling intervals. Once we have established users for the
// StackSamplingProfiler and the collected data to judge, we may go the other
// way or make this behavior configurable.
-bool StackSamplingProfiler::SamplingThread::CollectProfile(
+void StackSamplingProfiler::SamplingThread::CollectProfile(
CallStackProfile* profile,
- TimeDelta* elapsed_time) {
+ TimeDelta* elapsed_time,
+ bool* was_stopped) {
ElapsedTimer profile_timer;
- CallStackProfile current_profile;
- native_sampler_->ProfileRecordingStarting(&current_profile.modules);
- current_profile.sampling_period = params_.sampling_interval;
- bool burst_completed = true;
+ native_sampler_->ProfileRecordingStarting(&profile->modules);
+ profile->sampling_period = params_.sampling_interval;
+ *was_stopped = false;
TimeDelta previous_elapsed_sample_time;
for (int i = 0; i < params_.samples_per_burst; ++i) {
if (i != 0) {
@@ -155,24 +155,19 @@ bool StackSamplingProfiler::SamplingThread::CollectProfile(
if (stop_event_.TimedWait(
std::max(params_.sampling_interval - previous_elapsed_sample_time,
TimeDelta()))) {
- burst_completed = false;
+ *was_stopped = true;
break;
}
}
ElapsedTimer sample_timer;
- current_profile.samples.push_back(Sample());
- native_sampler_->RecordStackSample(&current_profile.samples.back());
+ profile->samples.push_back(Sample());
+ native_sampler_->RecordStackSample(&profile->samples.back());
previous_elapsed_sample_time = sample_timer.Elapsed();
}
*elapsed_time = profile_timer.Elapsed();
- current_profile.profile_duration = *elapsed_time;
+ profile->profile_duration = *elapsed_time;
native_sampler_->ProfileRecordingStopped();
-
- if (burst_completed)
- *profile = current_profile;
-
- return burst_completed;
}
// In an analogous manner to CollectProfile() and samples exceeding the expected
@@ -195,9 +190,13 @@ void StackSamplingProfiler::SamplingThread::CollectProfiles(
}
CallStackProfile profile;
- if (!CollectProfile(&profile, &previous_elapsed_profile_time))
+ bool was_stopped = false;
+ CollectProfile(&profile, &previous_elapsed_profile_time, &was_stopped);
+ if (!profile.samples.empty())
+ profiles->push_back(profile);
+
+ if (was_stopped)
return;
- profiles->push_back(profile);
}
}
« no previous file with comments | « profiler/stack_sampling_profiler.h ('k') | profiler/stack_sampling_profiler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698