summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 22:06:49 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 22:06:49 +0000
commit1a838cc4824267a5282c6f4eb748e4cb5d8749f4 (patch)
tree7f7d901b9de92f18cac382cb999a194c0f9322ea /base
parent768ff9204ffa2ffc490eeec19236de1921da94aa (diff)
downloadchromium_src-1a838cc4824267a5282c6f4eb748e4cb5d8749f4.zip
chromium_src-1a838cc4824267a5282c6f4eb748e4cb5d8749f4.tar.gz
chromium_src-1a838cc4824267a5282c6f4eb748e4cb5d8749f4.tar.bz2
Revert 133773 - [UMA] Add performance profile data to UMA uploads.
BUG=103480 TEST=unit_test --gtest_filter=MetricsLogTest.* Review URL: http://codereview.chromium.org/9702015 TBR=isherman@chromium.org Review URL: https://chromiumcodereview.appspot.com/10169039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133779 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/profiler/alternate_timer.cc15
-rw-r--r--base/profiler/alternate_timer.h21
-rw-r--r--base/tracked_objects.cc18
3 files changed, 31 insertions, 23 deletions
diff --git a/base/profiler/alternate_timer.cc b/base/profiler/alternate_timer.cc
index abf9180..05a983c 100644
--- a/base/profiler/alternate_timer.cc
+++ b/base/profiler/alternate_timer.cc
@@ -6,25 +6,20 @@
#include "base/logging.h"
-namespace {
-
-tracked_objects::NowFunction* g_time_function = NULL;
-
-} // anonymous namespace
-
namespace tracked_objects {
+static NowFunction* g_time_function = NULL;
+
const char kAlternateProfilerTime[] = "CHROME_PROFILER_TIME";
// Set an alternate timer function to replace the OS time function when
// profiling.
void SetAlternateTimeSource(NowFunction* now_function) {
- DCHECK_EQ(reinterpret_cast<NowFunction*>(NULL), g_time_function);
+ DCHECK_EQ(g_time_function, reinterpret_cast<NowFunction*>(NULL));
g_time_function = now_function;
}
-NowFunction* GetAlternateTimeSource() {
+extern NowFunction* GetAlternateTimeSource() {
return g_time_function;
}
-
-} // namespace tracked_objects
+} // tracked_objects
diff --git a/base/profiler/alternate_timer.h b/base/profiler/alternate_timer.h
index 778dc62..883b24f 100644
--- a/base/profiler/alternate_timer.h
+++ b/base/profiler/alternate_timer.h
@@ -5,31 +5,32 @@
// This is a glue file, which allows third party code to call into our profiler
// without having to include most any functions from base.
+
#ifndef BASE_PROFILER_ALTERNATE_TIMER_H_
#define BASE_PROFILER_ALTERNATE_TIMER_H_
-#include "base/base_export.h"
-
namespace tracked_objects {
// Provide type for an alternate timer function.
typedef unsigned int NowFunction();
-// Environment variable name that is used to activate alternate timer profiling
-// (such as using TCMalloc allocations to provide a pseudo-timer) for tasks
-// instead of wall clock profiling.
-extern const char kAlternateProfilerTime[];
-
// Set an alternate timer function to replace the OS time function when
// profiling. Typically this is called by an allocator that is providing a
// function that indicates how much memory has been allocated on any given
// thread.
-void SetAlternateTimeSource(NowFunction* now_function);
+extern void SetAlternateTimeSource(NowFunction* now_function);
// Gets the pointer to a function that was set via SetAlternateTimeSource().
// Returns NULL if no set was done prior to calling GetAlternateTimeSource.
-BASE_EXPORT NowFunction* GetAlternateTimeSource();
+extern NowFunction* GetAlternateTimeSource();
+
+// Environment variable name that is used to activate alternate timer profiling
+// (such as using TCMalloc allocations to provide a pseudo-timer) for tasks
+// instead of wall clock profiling.
+extern const char kAlternateProfilerTime[];
+
+
-} // namespace tracked_objects
+} // tracked_objects
#endif // BASE_PROFILER_ALTERNATE_TIMER_H_
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc
index ae508c4..fe3f712 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -648,9 +648,21 @@ void ThreadData::Reset() {
}
static void OptionallyInitializeAlternateTimer() {
- NowFunction* alternate_time_source = GetAlternateTimeSource();
- if (alternate_time_source)
- ThreadData::SetAlternateTimeSource(alternate_time_source);
+ char* alternate_selector = getenv(kAlternateProfilerTime);
+ if (!alternate_selector)
+ return;
+ switch (*alternate_selector) {
+ case '0': // This is the default value, and uses the wall clock time.
+ break;
+ case '1': {
+ // Use the TCMalloc allocations-on-thread as a pseudo-time.
+ ThreadData::SetAlternateTimeSource(GetAlternateTimeSource());
+ break;
+ }
+ default:
+ NOTREACHED();
+ break;
+ }
}
bool ThreadData::Initialize() {