diff options
author | charliea <charliea@chromium.org> | 2015-11-05 05:48:56 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-05 13:49:48 +0000 |
commit | 2bccc2cf38624593e1adafefccec7314aa573b0f (patch) | |
tree | 9d59cac140bc520a3099966457c5cf481e9a1741 /base/time | |
parent | 1f548985bfeaacd0aa4b782c629d1ecbc29173c7 (diff) | |
download | chromium_src-2bccc2cf38624593e1adafefccec7314aa573b0f.zip chromium_src-2bccc2cf38624593e1adafefccec7314aa573b0f.tar.gz chromium_src-2bccc2cf38624593e1adafefccec7314aa573b0f.tar.bz2 |
Kills TraceTicks, which was functionally the same as TimeTicks
This was not true until last week's submission of
http://crrev.com/1374753004.
BUG=541692
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
NO_PRESUBMIT=true
Review URL: https://codereview.chromium.org/1424703003
Cr-Commit-Position: refs/heads/master@{#358047}
Diffstat (limited to 'base/time')
-rw-r--r-- | base/time/time.cc | 5 | ||||
-rw-r--r-- | base/time/time.h | 66 | ||||
-rw-r--r-- | base/time/time_mac.cc | 5 | ||||
-rw-r--r-- | base/time/time_posix.cc | 5 | ||||
-rw-r--r-- | base/time/time_unittest.cc | 6 | ||||
-rw-r--r-- | base/time/time_win.cc | 14 | ||||
-rw-r--r-- | base/time/time_win_unittest.cc | 2 |
7 files changed, 7 insertions, 96 deletions
diff --git a/base/time/time.cc b/base/time/time.cc index 10ffcc6..53851fb 100644 --- a/base/time/time.cc +++ b/base/time/time.cc @@ -326,11 +326,6 @@ std::ostream& operator<<(std::ostream& os, ThreadTicks thread_ticks) { return os << as_time_delta.InMicroseconds() << " bogo-thread-microseconds"; } -std::ostream& operator<<(std::ostream& os, TraceTicks trace_ticks) { - const TimeDelta as_time_delta = trace_ticks - TraceTicks(); - return os << as_time_delta.InMicroseconds() << " bogo-trace-microseconds"; -} - // Time::Exploded ------------------------------------------------------------- inline bool is_in_range(int value, int lo, int hi) { diff --git a/base/time/time.h b/base/time/time.h index 4944085..6c06fbc 100644 --- a/base/time/time.h +++ b/base/time/time.h @@ -13,13 +13,13 @@ // TimeDelta represents a duration of time, internally represented in // microseconds. // -// TimeTicks, ThreadTicks, and TraceTicks represent an abstract time that is -// most of the time incrementing, for use in measuring time durations. -// Internally, they are represented in microseconds. They can not be converted -// to a human-readable time, but are guaranteed not to decrease (unlike the Time -// class). Note that TimeTicks may "stand still" (e.g., if the computer is -// suspended), and ThreadTicks will "stand still" whenever the thread has been -// de-scheduled by the operating system. +// TimeTicks and ThreadTicks represent an abstract time that is most of the time +// incrementing, for use in measuring time durations. Internally, they are +// represented in microseconds. They can not be converted to a human-readable +// time, but are guaranteed not to decrease (unlike the Time class). Note that +// TimeTicks may "stand still" (e.g., if the computer is suspended), and +// ThreadTicks will "stand still" whenever the thread has been de-scheduled by +// the operating system. // // All time classes are copyable, assignable, and occupy 64-bits per // instance. Thus, they can be efficiently passed by-value (as opposed to @@ -45,12 +45,6 @@ // // ThreadTicks: Benchmarking how long the current thread has been doing actual // work. -// -// TraceTicks: This is only meant to be used by the event tracing -// infrastructure, and by outside code modules in special -// circumstances. Please be sure to consult a -// base/trace_event/OWNER before committing any new code that -// uses this. #ifndef BASE_TIME_TIME_H_ #define BASE_TIME_TIME_H_ @@ -784,52 +778,6 @@ class BASE_EXPORT ThreadTicks : public time_internal::TimeBase<ThreadTicks> { // For logging use only. BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); -// TraceTicks ---------------------------------------------------------------- - -// Represents high-resolution system trace clock time. -class BASE_EXPORT TraceTicks : public time_internal::TimeBase<TraceTicks> { - public: - // We define this even without OS_CHROMEOS for seccomp sandbox testing. -#if defined(OS_LINUX) - // Force definition of the system trace clock; it is a chromeos-only api - // at the moment and surfacing it in the right place requires mucking - // with glibc et al. - static const clockid_t kClockSystemTrace = 11; -#endif - - TraceTicks() : TimeBase(0) { - } - - // Returns the current system trace time or, if not available on this - // platform, a high-resolution time value; or a low-resolution time value if - // neither are avalable. On systems where a global trace clock is defined, - // timestamping TraceEvents's with this value guarantees synchronization - // between events collected inside chrome and events collected outside - // (e.g. kernel, X server). - // - // On some platforms, the clock source used for tracing can vary depending on - // hardware and/or kernel support. Do not make any assumptions without - // consulting the documentation for this functionality in the time_win.cc, - // time_posix.cc, etc. files. - // - // NOTE: This is only meant to be used by the event tracing infrastructure, - // and by outside code modules in special circumstances. Please be sure to - // consult a base/trace_event/OWNER before committing any new code that uses - // this. - static TraceTicks Now(); - - private: - friend class time_internal::TimeBase<TraceTicks>; - - // Please use Now() to create a new object. This is for internal use - // and testing. - explicit TraceTicks(int64 us) : TimeBase(us) { - } -}; - -// For logging use only. -BASE_EXPORT std::ostream& operator<<(std::ostream& os, TraceTicks time_ticks); - } // namespace base #endif // BASE_TIME_TIME_H_ diff --git a/base/time/time_mac.cc b/base/time/time_mac.cc index 8983ab2..578e039 100644 --- a/base/time/time_mac.cc +++ b/base/time/time_mac.cc @@ -231,9 +231,4 @@ ThreadTicks ThreadTicks::Now() { return ThreadTicks(ComputeThreadTicks()); } -// static -TraceTicks TraceTicks::Now() { - return TraceTicks(ComputeCurrentTicks()); -} - } // namespace base diff --git a/base/time/time_posix.cc b/base/time/time_posix.cc index 2c3aaca..d2bb555 100644 --- a/base/time/time_posix.cc +++ b/base/time/time_posix.cc @@ -329,11 +329,6 @@ ThreadTicks ThreadTicks::Now() { #endif } -// static -TraceTicks TraceTicks::Now() { - return TraceTicks(ClockNow(CLOCK_MONOTONIC)); -} - #endif // !OS_MACOSX // static diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc index c8b403b..868a546 100644 --- a/base/time/time_unittest.cc +++ b/base/time/time_unittest.cc @@ -665,12 +665,6 @@ TEST(ThreadTicks, MAYBE_ThreadNow) { } } -TEST(TraceTicks, NowFromSystemTraceTime) { - // Re-use HighRes test for now since clock properties are identical. - using NowFunction = TimeTicks (*)(void); - HighResClockTest(reinterpret_cast<NowFunction>(&TraceTicks::Now)); -} - TEST(TimeTicks, SnappedToNextTickBasic) { base::TimeTicks phase = base::TimeTicks::FromInternalValue(4000); base::TimeDelta interval = base::TimeDelta::FromMicroseconds(1000); diff --git a/base/time/time_win.cc b/base/time/time_win.cc index bc05804..9584127 100644 --- a/base/time/time_win.cc +++ b/base/time/time_win.cc @@ -48,7 +48,6 @@ using base::ThreadTicks; using base::Time; using base::TimeDelta; using base::TimeTicks; -using base::TraceTicks; namespace { @@ -459,14 +458,6 @@ void InitializeNowFunctionPointer() { // // Otherwise, Now uses the high-resolution QPC clock. As of 21 August 2015, // ~72% of users fall within this category. - // - // TraceTicks::Now() always uses the same clock as TimeTicks::Now(), even - // when the QPC exists but is expensive or unreliable. This is because we'd - // eventually like to merge TraceTicks and TimeTicks and have one type of - // timestamp that is reliable, monotonic, and comparable. Also, while we could - // use the high-resolution timer for TraceTicks even when it's unreliable or - // slow, it's easier to make tracing tools accommodate a coarse timer than - // one that's unreliable or slow. NowFunction now_function; base::CPU cpu; if (ticks_per_sec.QuadPart <= 0 || @@ -613,11 +604,6 @@ double ThreadTicks::TSCTicksPerSecond() { } // static -TraceTicks TraceTicks::Now() { - return TraceTicks() + g_now_function(); -} - -// static TimeTicks TimeTicks::FromQPCValue(LONGLONG qpc_value) { return TimeTicks() + QPCValueToTimeDelta(qpc_value); } diff --git a/base/time/time_win_unittest.cc b/base/time/time_win_unittest.cc index 6f8a9b7..38798d5 100644 --- a/base/time/time_win_unittest.cc +++ b/base/time/time_win_unittest.cc @@ -192,8 +192,6 @@ TEST(TimeTicks, TimerPerformance) { std::vector<TestCase> cases; cases.push_back({reinterpret_cast<TestFunc>(&Time::Now), "Time::Now"}); cases.push_back({&TimeTicks::Now, "TimeTicks::Now"}); - cases.push_back( - {reinterpret_cast<TestFunc>(&TraceTicks::Now), "TraceTicks::Now"}); if (ThreadTicks::IsSupported()) { ThreadTicks::WaitUntilInitialized(); |