OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 a platform-dependent epoch. Each | 6 // microseconds (s/1,000,000) since a platform-dependent epoch. Each |
7 // platform's epoch, along with other system-dependent clock interface | 7 // platform's epoch, along with other system-dependent clock interface |
8 // routines, is defined in time_PLATFORM.cc. | 8 // routines, is 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // The resolution of this clock is ~1-15ms. Resolution varies depending | 475 // The resolution of this clock is ~1-15ms. Resolution varies depending |
476 // on hardware/operating system configuration. | 476 // on hardware/operating system configuration. |
477 static TimeTicks Now(); | 477 static TimeTicks Now(); |
478 | 478 |
479 // Returns a platform-dependent high-resolution tick count. Implementation | 479 // Returns a platform-dependent high-resolution tick count. Implementation |
480 // is hardware dependent and may or may not return sub-millisecond | 480 // is hardware dependent and may or may not return sub-millisecond |
481 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND | 481 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND |
482 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. | 482 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. |
483 static TimeTicks HighResNow(); | 483 static TimeTicks HighResNow(); |
484 | 484 |
| 485 // Returns the current system trace time or, if none is defined, the current |
| 486 // high-res time (i.e. HighResNow()). On systems where a global trace clock |
| 487 // is defined, timestamping TraceEvents's with this value guarantees |
| 488 // synchronization between events collected inside chrome and events |
| 489 // collected outside (e.g. kernel, X server). |
| 490 static TimeTicks NowFromSystemTraceTime(); |
| 491 |
485 #if defined(OS_WIN) | 492 #if defined(OS_WIN) |
486 // Get the absolute value of QPC time drift. For testing. | 493 // Get the absolute value of QPC time drift. For testing. |
487 static int64 GetQPCDriftMicroseconds(); | 494 static int64 GetQPCDriftMicroseconds(); |
488 | 495 |
489 // Returns true if the high resolution clock is working on this system. | 496 // Returns true if the high resolution clock is working on this system. |
490 // This is only for testing. | 497 // This is only for testing. |
491 static bool IsHighResClockWorking(); | 498 static bool IsHighResClockWorking(); |
492 #endif | 499 #endif |
493 | 500 |
494 // Returns true if this object has not been initialized. | 501 // Returns true if this object has not been initialized. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 #endif | 582 #endif |
576 }; | 583 }; |
577 | 584 |
578 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 585 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
579 return TimeTicks(t.ticks_ + delta_); | 586 return TimeTicks(t.ticks_ + delta_); |
580 } | 587 } |
581 | 588 |
582 } // namespace base | 589 } // namespace base |
583 | 590 |
584 #endif // BASE_TIME_H_ | 591 #endif // BASE_TIME_H_ |
OLD | NEW |