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

Unified Diff: base/profiler/scoped_profile.h

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/location.h ('k') | base/profiler/scoped_profile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/profiler/scoped_profile.h
===================================================================
--- base/profiler/scoped_profile.h (revision 0)
+++ base/profiler/scoped_profile.h (revision 0)
@@ -0,0 +1,47 @@
+// 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.
+
+
+#ifndef BASE_PROFILER_SCOPED_PROFILE_H_
+#define BASE_PROFILER_SCOPED_PROFILE_H_
+
+//------------------------------------------------------------------------------
+// ScopedProfile provides basic helper functions for profiling a short
+// region of code within a scope. It is separate from the related ThreadData
+// class so that it can be included without much other cruft, and provide the
+// macros listed below.
+
+#include "base/base_export.h"
+#include "base/location.h"
+#include "base/profiler/tracked_time.h"
+
+#define TRACK_RUN_IN_THIS_SCOPED_REGION_FOR_OFFICIAL_BUILDS(variable_name) \
+ ::tracked_objects::ScopedProfile variable_name(FROM_HERE)
+
+#define TRACK_RUN_IN_IPC_HANDLER(dispatch_function_name) \
+ ::tracked_objects::ScopedProfile some_tracking_variable_name( \
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(#dispatch_function_name))
+
+
+namespace tracked_objects {
+class Births;
+
+class BASE_EXPORT ScopedProfile {
+ public:
+ explicit ScopedProfile(const Location& location);
+ ~ScopedProfile();
+
+ // Stop tracing prior to the end destruction of the instance.
+ void StopClockAndTally();
+
+ private:
+ Births* birth_; // Place in code where tracking started.
+ const TrackedTime start_of_run_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedProfile);
+};
+
+} // namespace tracked_objects
+
+#endif // BASE_PROFILER_SCOPED_PROFILE_H_
« no previous file with comments | « base/location.h ('k') | base/profiler/scoped_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698