summaryrefslogtreecommitdiffstats
path: root/base/profiler
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-24 22:17:18 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-24 22:17:18 +0000
commitc186e96bb59d1309b5ae13b4585dfd408d23eb19 (patch)
treef3838dee4c1365964320617e8fe14467ef60d324 /base/profiler
parent1b81ff2333ebb17fc48df20cef5db9ae151f2536 (diff)
downloadchromium_src-c186e96bb59d1309b5ae13b4585dfd408d23eb19.zip
chromium_src-c186e96bb59d1309b5ae13b4585dfd408d23eb19.tar.gz
chromium_src-c186e96bb59d1309b5ae13b4585dfd408d23eb19.tar.bz2
Cleanup: Replace 'DurationInt' with int32, and always use 32-bit integers for tracking time.
BUG=none TEST=none Review URL: http://codereview.chromium.org/9818004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/profiler')
-rw-r--r--base/profiler/tracked_time.cc6
-rw-r--r--base/profiler/tracked_time.h19
-rw-r--r--base/profiler/tracked_time_unittest.cc6
3 files changed, 2 insertions, 29 deletions
diff --git a/base/profiler/tracked_time.cc b/base/profiler/tracked_time.cc
index 0e227bd..f1edd6d 100644
--- a/base/profiler/tracked_time.cc
+++ b/base/profiler/tracked_time.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -12,8 +12,6 @@
namespace tracked_objects {
-#if defined(USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS)
-
Duration::Duration() : ms_(0) {}
Duration::Duration(int32 duration) : ms_(duration) {}
@@ -75,6 +73,4 @@ TrackedTime TrackedTime::operator+(const Duration& other) const {
bool TrackedTime::is_null() const { return ms_ == 0; }
-#endif // USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS
-
} // namespace tracked_objects
diff --git a/base/profiler/tracked_time.h b/base/profiler/tracked_time.h
index 5493e20..372c753 100644
--- a/base/profiler/tracked_time.h
+++ b/base/profiler/tracked_time.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -12,14 +12,8 @@
namespace tracked_objects {
-typedef int DurationInt;
-
//------------------------------------------------------------------------------
-#define USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS
-
-#if defined(USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS)
-
// TimeTicks maintains a wasteful 64 bits of data (we need less than 32), and on
// windows, a 64 bit timer is expensive to even obtain. We use a simple
// millisecond counter for most of our time values, as well as millisecond units
@@ -72,17 +66,6 @@ class BASE_EXPORT TrackedTime { // Similar to base::TimeTicks.
uint32 ms_;
};
-#else
-
-// Just use full 64 bit time calculations, and the slower TimeTicks::Now().
-// This allows us (as an alternative) to test with larger ranges of times, and
-// with a more thoroughly tested class.
-
-typedef base::TimeTicks TrackedTime;
-typedef base::TimeDelta Duration;
-
-#endif // USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS
-
} // namespace tracked_objects
#endif // BASE_PROFILER_TRACKED_TIME_H_
diff --git a/base/profiler/tracked_time_unittest.cc b/base/profiler/tracked_time_unittest.cc
index b85411d..cd7f18c 100644
--- a/base/profiler/tracked_time_unittest.cc
+++ b/base/profiler/tracked_time_unittest.cc
@@ -28,14 +28,8 @@ TEST(TrackedTimeTest, TrackedTimerMilliseconds) {
EXPECT_EQ(kReallyBigMilliseconds, (big - base::TimeTicks()).InMilliseconds());
TrackedTime wrapped_big(big);
-#if defined(USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS)
// Expect wrapping at 32 bits.
EXPECT_EQ(kSomeMilliseconds, (wrapped_big - TrackedTime()).InMilliseconds());
-#else // !USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS)
- // Expect no wrapping at 32 bits.
- EXPECT_EQ(kReallyBigMilliseconds,
- (wrapped_big - TrackedTime()).InMilliseconds());
-#endif // USE_FAST_TIME_CLASS_FOR_DURATION_CALCULATIONS)
}
TEST(TrackedTimeTest, TrackedTimerDuration) {