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

Unified Diff: base/profiler/scoped_profile.cc

Issue 8480014: Support tracking of IPC messages as tasks in profiler (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | « base/profiler/scoped_profile.h ('k') | base/profiler/tracked_time.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/profiler/scoped_profile.cc
===================================================================
--- base/profiler/scoped_profile.cc (revision 0)
+++ base/profiler/scoped_profile.cc (revision 0)
@@ -0,0 +1,31 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/profiler/scoped_profile.h"
+
+#include "base/location.h"
+#include "base/tracked_objects.h"
+
+
+namespace tracked_objects {
+
+
+ScopedProfile::ScopedProfile(const Location& location)
+ : birth_(ThreadData::TallyABirthIfActive(location)),
+ start_of_run_(ThreadData::Now()) {
+}
+
+ScopedProfile::~ScopedProfile() {
+ StopClockAndTally();
+}
+
+void ScopedProfile::StopClockAndTally() {
+ if (!birth_)
+ return;
+ ThreadData::TallyRunInAScopedRegionIfTracking(birth_, start_of_run_,
+ ThreadData::Now());
+ birth_ = NULL;
+}
+
+} // namespace tracked_objects
« no previous file with comments | « base/profiler/scoped_profile.h ('k') | base/profiler/tracked_time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698