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