summaryrefslogtreecommitdiffstats
path: root/base/profiler/scoped_profile.cc
diff options
context:
space:
mode:
authorvadimt <vadimt@chromium.org>2014-09-15 12:19:38 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-15 19:24:08 +0000
commit12f0f7db8095f1a5e40fb7227b217ddfc1724116 (patch)
tree91c53ad3932e0b73b5715ab936530007a8b7f831 /base/profiler/scoped_profile.cc
parent2e9bcdf661d0231880bafc4be33f74b6f6b685a8 (diff)
downloadchromium_src-12f0f7db8095f1a5e40fb7227b217ddfc1724116.zip
chromium_src-12f0f7db8095f1a5e40fb7227b217ddfc1724116.tar.gz
chromium_src-12f0f7db8095f1a5e40fb7227b217ddfc1724116.tar.bz2
Creating a framework for suppressing pollution of the profiler data and applying for know cases of pollution.
See the bug. The CL introduces TaskStopwatch that has to be used to measure run time for tasks. It takes care of double-counting run time in the nested-tasks case by subtracting run time of nested tasks from their parents. TaskStopwatch can be also used for subtracting other nested intervals, such as the time while a nested message pump runs. ThreadData::TallyADeath now takes a stopwatch parameter instead of start_time and end_time. This helps avoid mistakes when the interval passed up to the parent for exclusion is different from the interval for the current task duration. BUG=401560 Review URL: https://codereview.chromium.org/445413003 Cr-Commit-Position: refs/heads/master@{#294865}
Diffstat (limited to 'base/profiler/scoped_profile.cc')
-rw-r--r--base/profiler/scoped_profile.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/base/profiler/scoped_profile.cc b/base/profiler/scoped_profile.cc
index 93c86e92..e1edc97 100644
--- a/base/profiler/scoped_profile.cc
+++ b/base/profiler/scoped_profile.cc
@@ -12,8 +12,8 @@ namespace tracked_objects {
ScopedProfile::ScopedProfile(const Location& location)
- : birth_(ThreadData::TallyABirthIfActive(location)),
- start_of_run_(ThreadData::NowForStartOfRun(birth_)) {
+ : birth_(ThreadData::TallyABirthIfActive(location)) {
+ ThreadData::PrepareForStartOfRun(birth_);
}
ScopedProfile::~ScopedProfile() {
@@ -21,10 +21,11 @@ ScopedProfile::~ScopedProfile() {
}
void ScopedProfile::StopClockAndTally() {
+ stopwatch_.Stop();
+
if (!birth_)
return;
- ThreadData::TallyRunInAScopedRegionIfTracking(birth_, start_of_run_,
- ThreadData::NowForEndOfRun());
+ ThreadData::TallyRunInAScopedRegionIfTracking(birth_, stopwatch_);
birth_ = NULL;
}