summaryrefslogtreecommitdiffstats
path: root/base/profiler.cc
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 23:07:52 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 23:07:52 +0000
commitc5d7f32f2fdae32e4ebf5c67b02026eefecc17b2 (patch)
tree85cce8731ba57fc701e3d49b1b9a9f1b2304eeb6 /base/profiler.cc
parent9165f748223f75790fb7f504de538b3003c27e4f (diff)
downloadchromium_src-c5d7f32f2fdae32e4ebf5c67b02026eefecc17b2.zip
chromium_src-c5d7f32f2fdae32e4ebf5c67b02026eefecc17b2.tar.gz
chromium_src-c5d7f32f2fdae32e4ebf5c67b02026eefecc17b2.tar.bz2
Support controlling the TCMalloc CPU profiler from script in test_shell
Review URL: http://codereview.chromium.org/607008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/profiler.cc')
-rw-r--r--base/profiler.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/base/profiler.cc b/base/profiler.cc
index cff16a5..1f28a73 100644
--- a/base/profiler.cc
+++ b/base/profiler.cc
@@ -5,6 +5,10 @@
#include "base/profiler.h"
#include "base/string_util.h"
+#if defined(USE_TCMALLOC)
+#include "third_party/tcmalloc/chromium/src/google/profiler.h"
+#endif
+
// When actually using quantify, uncomment the following line.
// #define QUANTIFY
@@ -20,12 +24,22 @@ namespace base {
void Profiler::StartRecording() {
#ifdef QUANTIFY
QuantifyStartRecordingData();
+#elif defined(USE_TCMALLOC) && defined(OS_LINUX)
+ ProfilerStart("chrome-profile");
#endif
}
void Profiler::StopRecording() {
#ifdef QUANTIFY
QuantifyStopRecordingData();
+#elif defined(USE_TCMALLOC) && defined(OS_LINUX)
+ ProfilerStop();
+#endif
+}
+
+void Profiler::Flush() {
+#if defined(USE_TCMALLOC) && defined(OS_LINUX)
+ ProfilerFlush();
#endif
}