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 time, internally represented as | 5 // Time represents an absolute point in time, internally represented as |
6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC) | 6 // microseconds (s/1,000,000) since the Windows epoch (1601-01-01 00:00:00 UTC) |
7 // (See http://crbug.com/14734). System-dependent clock interface routines are | 7 // (See http://crbug.com/14734). System-dependent clock interface routines are |
8 // defined in time_PLATFORM.cc. | 8 // defined in time_PLATFORM.cc. |
9 // | 9 // |
10 // TimeDelta represents a duration of time, internally represented in | 10 // TimeDelta represents a duration of time, internally represented in |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 // Returns a platform-dependent high-resolution tick count. Implementation | 541 // Returns a platform-dependent high-resolution tick count. Implementation |
542 // is hardware dependent and may or may not return sub-millisecond | 542 // is hardware dependent and may or may not return sub-millisecond |
543 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND | 543 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND |
544 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. | 544 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. |
545 static TimeTicks HighResNow(); | 545 static TimeTicks HighResNow(); |
546 | 546 |
547 static bool IsHighResNowFastAndReliable(); | 547 static bool IsHighResNowFastAndReliable(); |
548 | 548 |
549 // Returns true if ThreadNow() is supported on this system. | 549 // Returns true if ThreadNow() is supported on this system. |
550 static bool IsThreadNowSupported() { | 550 static bool IsThreadNowSupported() { |
551 #if defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0) | 551 #if (defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0)) || \ |
| 552 (defined(OS_MACOSX) && !defined(OS_IOS)) |
552 return true; | 553 return true; |
553 #else | 554 #else |
554 return false; | 555 return false; |
555 #endif | 556 #endif |
556 } | 557 } |
557 | 558 |
558 // Returns thread-specific CPU-time on systems that support this feature. | 559 // Returns thread-specific CPU-time on systems that support this feature. |
559 // Needs to be guarded with a call to IsThreadNowSupported(). Use this timer | 560 // Needs to be guarded with a call to IsThreadNowSupported(). Use this timer |
560 // to (approximately) measure how much time the calling thread spent doing | 561 // to (approximately) measure how much time the calling thread spent doing |
561 // actual work vs. being de-scheduled. May return bogus results if the thread | 562 // actual work vs. being de-scheduled. May return bogus results if the thread |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 #endif | 684 #endif |
684 }; | 685 }; |
685 | 686 |
686 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 687 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
687 return TimeTicks(t.ticks_ + delta_); | 688 return TimeTicks(t.ticks_ + delta_); |
688 } | 689 } |
689 | 690 |
690 } // namespace base | 691 } // namespace base |
691 | 692 |
692 #endif // BASE_TIME_TIME_H_ | 693 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |