| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project 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 #ifndef V8_BASE_PLATFORM_TIME_H_ | 5 #ifndef V8_BASE_PLATFORM_TIME_H_ |
| 6 #define V8_BASE_PLATFORM_TIME_H_ | 6 #define V8_BASE_PLATFORM_TIME_H_ |
| 7 | 7 |
| 8 #include <ctime> | 8 #include <ctime> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Returns a platform-dependent high-resolution tick count. Implementation | 311 // Returns a platform-dependent high-resolution tick count. Implementation |
| 312 // is hardware dependent and may or may not return sub-millisecond | 312 // is hardware dependent and may or may not return sub-millisecond |
| 313 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND | 313 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND |
| 314 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. | 314 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. |
| 315 // This method never returns a null TimeTicks. | 315 // This method never returns a null TimeTicks. |
| 316 static TimeTicks HighResolutionNow(); | 316 static TimeTicks HighResolutionNow(); |
| 317 | 317 |
| 318 // Returns true if the high-resolution clock is working on this system. | 318 // Returns true if the high-resolution clock is working on this system. |
| 319 static bool IsHighResolutionClockWorking(); | 319 static bool IsHighResolutionClockWorking(); |
| 320 | 320 |
| 321 // Returns Linux kernel timestamp for generating profiler events. This method | |
| 322 // returns null TimeTicks if the kernel cannot provide the timestamps (e.g., | |
| 323 // on non-Linux OS or if the kernel module for timestamps is not loaded). | |
| 324 | |
| 325 static TimeTicks KernelTimestampNow(); | |
| 326 static bool KernelTimestampAvailable(); | |
| 327 | |
| 328 // Returns true if this object has not been initialized. | 321 // Returns true if this object has not been initialized. |
| 329 bool IsNull() const { return ticks_ == 0; } | 322 bool IsNull() const { return ticks_ == 0; } |
| 330 | 323 |
| 331 // Converts to/from internal values. The meaning of the "internal value" is | 324 // Converts to/from internal values. The meaning of the "internal value" is |
| 332 // completely up to the implementation, so it should be treated as opaque. | 325 // completely up to the implementation, so it should be treated as opaque. |
| 333 static TimeTicks FromInternalValue(int64_t value) { | 326 static TimeTicks FromInternalValue(int64_t value) { |
| 334 return TimeTicks(value); | 327 return TimeTicks(value); |
| 335 } | 328 } |
| 336 int64_t ToInternalValue() const { | 329 int64_t ToInternalValue() const { |
| 337 return ticks_; | 330 return ticks_; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 }; | 388 }; |
| 396 | 389 |
| 397 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) { | 390 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) { |
| 398 return ticks + delta; | 391 return ticks + delta; |
| 399 } | 392 } |
| 400 | 393 |
| 401 } // namespace base | 394 } // namespace base |
| 402 } // namespace v8 | 395 } // namespace v8 |
| 403 | 396 |
| 404 #endif // V8_BASE_PLATFORM_TIME_H_ | 397 #endif // V8_BASE_PLATFORM_TIME_H_ |
| OLD | NEW |