summaryrefslogtreecommitdiffstats
path: root/base/profiler.cc
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 21:26:28 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 21:26:28 +0000
commit9b221756628153638da5db1e46ca5ab42e12e88f (patch)
tree908d7ba18dce8eaab48779f2a3371ea78a0f0d91 /base/profiler.cc
parentdb811c343705e846aba6fe47015de1eb5bacaf14 (diff)
downloadchromium_src-9b221756628153638da5db1e46ca5ab42e12e88f.zip
chromium_src-9b221756628153638da5db1e46ca5ab42e12e88f.tar.gz
chromium_src-9b221756628153638da5db1e46ca5ab42e12e88f.tar.bz2
Add API functions to control Quantify, as well as expose these
functions to javascript. Review URL: http://codereview.chromium.org/40255 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/profiler.cc')
-rw-r--r--base/profiler.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/base/profiler.cc b/base/profiler.cc
new file mode 100644
index 0000000..3f19597
--- /dev/null
+++ b/base/profiler.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2009 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.h"
+#include "base/string_util.h"
+
+#ifdef PURIFY
+// this #define is used to prevent people from directly using pure.h
+// instead of profiler.h
+#define PURIFY_PRIVATE_INCLUDE
+#include "base/third_party/purify/pure.h"
+#endif
+
+namespace base {
+
+void Profiler::StartRecording() {
+#ifdef PURIFY
+ QuantifyStartRecordingData();
+#endif
+}
+
+void Profiler::StopRecording() {
+#ifdef PURIFY
+ QuantifyStopRecordingData();
+#endif
+}
+
+void Profiler::ClearData() {
+#ifdef PURIFY
+ QuantifyClearData();
+#endif
+}
+
+void Profiler::SetThreadName(const char *name) {
+#ifdef PURIFY
+ // make a copy since the Quantify function takes a char*, not const char*
+ char buffer[512];
+ base::snprintf(buffer, sizeof(buffer)-1, "%s", name);
+ QuantifySetThreadName(buffer);
+#endif
+}
+
+} // namespace base
+