OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Time represents an absolute point in coordinated universal time (UTC), | 5 // Time represents an absolute point in coordinated universal time (UTC), |
6 // internally represented as microseconds (s/1,000,000) since the Windows epoch | 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch |
7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are | 7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are |
8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump | 8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump |
9 // around as the operating system makes adjustments to synchronize (e.g., with | 9 // around as the operating system makes adjustments to synchronize (e.g., with |
10 // NTP servers). Thus, client code that uses the Time class must account for | 10 // NTP servers). Thus, client code that uses the Time class must account for |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 // Represents a clock, specific to a particular thread, than runs only while the | 726 // Represents a clock, specific to a particular thread, than runs only while the |
727 // thread is running. | 727 // thread is running. |
728 class BASE_EXPORT ThreadTicks : public time_internal::TimeBase<ThreadTicks> { | 728 class BASE_EXPORT ThreadTicks : public time_internal::TimeBase<ThreadTicks> { |
729 public: | 729 public: |
730 ThreadTicks() : TimeBase(0) { | 730 ThreadTicks() : TimeBase(0) { |
731 } | 731 } |
732 | 732 |
733 // Returns true if ThreadTicks::Now() is supported on this system. | 733 // Returns true if ThreadTicks::Now() is supported on this system. |
734 static bool IsSupported() { | 734 static bool IsSupported() { |
735 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ | 735 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ |
736 (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_ANDROID) | 736 defined(OS_MACOSX) || defined(OS_ANDROID) |
737 return true; | 737 return true; |
738 #else | 738 #else |
739 return false; | 739 return false; |
740 #endif | 740 #endif |
741 } | 741 } |
742 | 742 |
743 // Returns thread-specific CPU-time on systems that support this feature. | 743 // Returns thread-specific CPU-time on systems that support this feature. |
744 // Needs to be guarded with a call to IsSupported(). Use this timer | 744 // Needs to be guarded with a call to IsSupported(). Use this timer |
745 // to (approximately) measure how much time the calling thread spent doing | 745 // to (approximately) measure how much time the calling thread spent doing |
746 // actual work vs. being de-scheduled. May return bogus results if the thread | 746 // actual work vs. being de-scheduled. May return bogus results if the thread |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 explicit TraceTicks(int64 us) : TimeBase(us) { | 801 explicit TraceTicks(int64 us) : TimeBase(us) { |
802 } | 802 } |
803 }; | 803 }; |
804 | 804 |
805 // For logging use only. | 805 // For logging use only. |
806 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TraceTicks time_ticks); | 806 BASE_EXPORT std::ostream& operator<<(std::ostream& os, TraceTicks time_ticks); |
807 | 807 |
808 } // namespace base | 808 } // namespace base |
809 | 809 |
810 #endif // BASE_TIME_TIME_H_ | 810 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |