| Index: base/time/time.h
|
| diff --git a/base/time/time.h b/base/time/time.h
|
| index 0a2677838617e79ada4b219cc684631cf799a519..9b195975fbc9225105f9f5433cb53e9d925069a8 100644
|
| --- a/base/time/time.h
|
| +++ b/base/time/time.h
|
| @@ -639,14 +639,6 @@ BASE_EXPORT std::ostream& operator<<(std::ostream& os, Time time);
|
| // Represents monotonically non-decreasing clock time.
|
| class BASE_EXPORT TimeTicks : public time_internal::TimeBase<TimeTicks> {
|
| 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
|
| -
|
| TimeTicks() : TimeBase(0) {
|
| }
|
|
|
| @@ -662,43 +654,6 @@ class BASE_EXPORT TimeTicks : public time_internal::TimeBase<TimeTicks> {
|
| // clock will be used instead.
|
| static bool IsHighResolution();
|
|
|
| - // Returns true if ThreadNow() is supported on this system.
|
| - static bool IsThreadNowSupported() {
|
| -#if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
|
| - (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_ANDROID)
|
| - return true;
|
| -#else
|
| - return false;
|
| -#endif
|
| - }
|
| -
|
| - // Returns thread-specific CPU-time on systems that support this feature.
|
| - // Needs to be guarded with a call to IsThreadNowSupported(). Use this timer
|
| - // to (approximately) measure how much time the calling thread spent doing
|
| - // actual work vs. being de-scheduled. May return bogus results if the thread
|
| - // migrates to another CPU between two calls.
|
| - //
|
| - // WARNING: The returned value might NOT have the same origin as Now(). Do not
|
| - // perform math between TimeTicks values returned by Now() and ThreadNow() and
|
| - // expect meaningful results.
|
| - // TODO(miu): Since the timeline of these values is different, the values
|
| - // should be of a different type.
|
| - static TimeTicks ThreadNow();
|
| -
|
| - // 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).
|
| - //
|
| - // WARNING: The returned value might NOT have the same origin as Now(). Do not
|
| - // perform math between TimeTicks values returned by Now() and
|
| - // NowFromSystemTraceTime() and expect meaningful results.
|
| - // TODO(miu): Since the timeline of these values is different, the values
|
| - // should be of a different type.
|
| - static TimeTicks NowFromSystemTraceTime();
|
| -
|
| #if defined(OS_WIN)
|
| // Translates an absolute QPC timestamp into a TimeTicks value. The returned
|
| // value has the same origin as Now(). Do NOT attempt to use this if
|
| @@ -738,6 +693,80 @@ class BASE_EXPORT TimeTicks : public time_internal::TimeBase<TimeTicks> {
|
| // For logging use only.
|
| BASE_EXPORT std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks);
|
|
|
| +// ThreadTicks ----------------------------------------------------------------
|
| +
|
| +// Represents a clock, specific to a particular thread, than runs only while the
|
| +// thread is running.
|
| +class BASE_EXPORT ThreadTicks : public time_internal::TimeBase<ThreadTicks> {
|
| + public:
|
| + ThreadTicks() : TimeBase(0) {
|
| + }
|
| +
|
| + // Returns true if ThreadTicks::Now() is supported on this system.
|
| + static bool IsSupported() {
|
| +#if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \
|
| + (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_ANDROID)
|
| + return true;
|
| +#else
|
| + return false;
|
| +#endif
|
| + }
|
| +
|
| + // Returns thread-specific CPU-time on systems that support this feature.
|
| + // Needs to be guarded with a call to IsSupported(). Use this timer
|
| + // to (approximately) measure how much time the calling thread spent doing
|
| + // actual work vs. being de-scheduled. May return bogus results if the thread
|
| + // migrates to another CPU between two calls.
|
| + static ThreadTicks Now();
|
| +
|
| + private:
|
| + friend class time_internal::TimeBase<ThreadTicks>;
|
| +
|
| + // Please use Now() to create a new object. This is for internal use
|
| + // and testing.
|
| + explicit ThreadTicks(int64 us) : TimeBase(us) {
|
| + }
|
| +};
|
| +
|
| +// 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).
|
| + 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_
|
|
|