Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 // This method never returns a null TimeTicks. | 328 // This method never returns a null TimeTicks. |
| 329 static TimeTicks Now(); | 329 static TimeTicks Now(); |
| 330 | 330 |
| 331 // Returns a platform-dependent high-resolution tick count. Implementation | 331 // Returns a platform-dependent high-resolution tick count. Implementation |
| 332 // is hardware dependent and may or may not return sub-millisecond | 332 // is hardware dependent and may or may not return sub-millisecond |
| 333 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND | 333 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND |
| 334 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. | 334 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED. |
| 335 // This method never returns a null TimeTicks. | 335 // This method never returns a null TimeTicks. |
| 336 static TimeTicks HighResNow(); | 336 static TimeTicks HighResNow(); |
| 337 | 337 |
| 338 // Returns true if the high-resolution clock is working on this system. | |
| 339 static bool IsHighResClockWorking(); | |
|
Hannes Payer (out of office)
2013/10/02 11:27:25
Can we call it IsHighResolutionClockWorking()? And
Benedikt Meurer
2013/10/02 12:27:46
Done.
| |
| 340 | |
| 338 // Returns true if this object has not been initialized. | 341 // Returns true if this object has not been initialized. |
| 339 bool IsNull() const { return ticks_ == 0; } | 342 bool IsNull() const { return ticks_ == 0; } |
| 340 | 343 |
| 341 // Converts to/from internal values. The meaning of the "internal value" is | 344 // Converts to/from internal values. The meaning of the "internal value" is |
| 342 // completely up to the implementation, so it should be treated as opaque. | 345 // completely up to the implementation, so it should be treated as opaque. |
| 343 static TimeTicks FromInternalValue(int64_t value) { | 346 static TimeTicks FromInternalValue(int64_t value) { |
| 344 return TimeTicks(value); | 347 return TimeTicks(value); |
| 345 } | 348 } |
| 346 int64_t ToInternalValue() const { | 349 int64_t ToInternalValue() const { |
| 347 return ticks_; | 350 return ticks_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 bool operator>=(const TimeTicks& other) const { | 397 bool operator>=(const TimeTicks& other) const { |
| 395 return ticks_ >= other.ticks_; | 398 return ticks_ >= other.ticks_; |
| 396 } | 399 } |
| 397 | 400 |
| 398 private: | 401 private: |
| 399 // Please use Now() to create a new object. This is for internal use | 402 // Please use Now() to create a new object. This is for internal use |
| 400 // and testing. Ticks is in microseconds. | 403 // and testing. Ticks is in microseconds. |
| 401 explicit TimeTicks(int64_t ticks) : ticks_(ticks) {} | 404 explicit TimeTicks(int64_t ticks) : ticks_(ticks) {} |
| 402 | 405 |
| 403 // Tick count in microseconds. | 406 // Tick count in microseconds. |
| 404 int64_t ticks_; | 407 int64_t ticks_; |
|
Hannes Payer (out of office)
2013/10/02 11:27:25
Is it safe to use int64_t here? Shouldn't it be ui
Benedikt Meurer
2013/10/02 12:27:46
int64_t is safe here, and compatible with what Chr
| |
| 405 }; | 408 }; |
| 406 | 409 |
| 407 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) { | 410 inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) { |
| 408 return ticks + delta; | 411 return ticks + delta; |
| 409 } | 412 } |
| 410 | 413 |
| 411 } } // namespace v8::internal | 414 } } // namespace v8::internal |
| 412 | 415 |
| 413 #endif // V8_PLATFORM_TIME_H_ | 416 #endif // V8_PLATFORM_TIME_H_ |
| OLD | NEW |