summaryrefslogtreecommitdiffstats
path: root/base/profiler
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 06:37:07 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 06:37:07 +0000
commit291d774464e6532e32d95e5d7b58fd4fe9c0ab40 (patch)
treea7e07e545f5896d3ce39da6225e9af34bd5a6fcd /base/profiler
parentbc407e962efd421576e6dad7cefde22ef0439f38 (diff)
downloadchromium_src-291d774464e6532e32d95e5d7b58fd4fe9c0ab40.zip
chromium_src-291d774464e6532e32d95e5d7b58fd4fe9c0ab40.tar.gz
chromium_src-291d774464e6532e32d95e5d7b58fd4fe9c0ab40.tar.bz2
Add hook for developers to play with profiler(unofficially)
r=rtenneti BUG=107051 Review URL: http://codereview.chromium.org/8899016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/profiler')
-rw-r--r--base/profiler/scoped_profile.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/base/profiler/scoped_profile.h b/base/profiler/scoped_profile.h
index 2754f5e..8b77d6d 100644
--- a/base/profiler/scoped_profile.h
+++ b/base/profiler/scoped_profile.h
@@ -16,11 +16,31 @@
#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)
+#if defined(GOOGLE_CHROME_BUILD)
-#define TRACK_RUN_IN_IPC_HANDLER(dispatch_function_name) \
- ::tracked_objects::ScopedProfile some_tracking_variable_name( \
+// We don't ship these profiled regions. This is for developer builds only.
+// It allows developers to do some profiling of their code, and see results on
+// their about:profiler page.
+#define TRACK_RUN_IN_THIS_SCOPED_REGION_FOR_DEVELOPER_BUILDS(scope_name) \
+ ((void)0)
+
+#else
+
+#define TRACK_RUN_IN_THIS_SCOPED_REGION_FOR_DEVELOPER_BUILDS(scope_name) \
+ ::tracked_objects::ScopedProfile LINE_BASED_VARIABLE_NAME_FOR_PROFILING( \
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(#scope_name))
+
+#endif
+
+
+
+#define PASTE_LINE_NUMBER_ON_NAME(name, line) name##line
+
+#define LINE_BASED_VARIABLE_NAME_FOR_PROFILING \
+ PASTE_LINE_NUMBER_ON_NAME(some_profiler_variable_, __LINE__)
+
+#define TRACK_RUN_IN_IPC_HANDLER(dispatch_function_name) \
+ ::tracked_objects::ScopedProfile some_tracking_variable_name( \
FROM_HERE_WITH_EXPLICIT_FUNCTION(#dispatch_function_name))