Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1248)

Side by Side Diff: base/time.h

Issue 4092: Change to Hi Res timers on Windows.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/time_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 342
343 // TimeTicks ------------------------------------------------------------------ 343 // TimeTicks ------------------------------------------------------------------
344 344
345 class TimeTicks { 345 class TimeTicks {
346 public: 346 public:
347 TimeTicks() : ticks_(0) { 347 TimeTicks() : ticks_(0) {
348 } 348 }
349 349
350 // Platform-dependent tick count representing "right now." 350 // Platform-dependent tick count representing "right now."
351 // The resolution of this clock is ~1-5ms. Resolution varies depending 351 // The resolution of this clock is ~1-15ms. Resolution varies depending
352 // on hardware/operating system configuration. 352 // on hardware/operating system configuration.
353 static TimeTicks Now(); 353 static TimeTicks Now();
354 354
355 // Returns a platform-dependent high-resolution tick count. IT IS BROKEN ON 355 // Returns a platform-dependent high-resolution tick count. Implementation
356 // SOME HARDWARE and is designed to be used for profiling and perf testing 356 // is hardware dependent and may or may not return sub-millisecond
357 // only (see the impl for more information). 357 // resolution. THIS CALL IS GENERALLY MUCH MORE EXPENSIVE THAN Now() AND
358 static TimeTicks UnreliableHighResNow(); 358 // SHOULD ONLY BE USED WHEN IT IS REALLY NEEDED.
359 359 static TimeTicks HighResNow();
360 360
361 // Returns true if this object has not been initialized. 361 // Returns true if this object has not been initialized.
362 bool is_null() const { 362 bool is_null() const {
363 return ticks_ == 0; 363 return ticks_ == 0;
364 } 364 }
365 365
366 // Returns the internal numeric value of the TimeTicks object. 366 // Returns the internal numeric value of the TimeTicks object.
367 int64 ToInternalValue() const { 367 int64 ToInternalValue() const {
368 return ticks_; 368 return ticks_;
369 } 369 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 typedef DWORD (*TickFunctionType)(void); 432 typedef DWORD (*TickFunctionType)(void);
433 static TickFunctionType SetMockTickFunction(TickFunctionType ticker); 433 static TickFunctionType SetMockTickFunction(TickFunctionType ticker);
434 #endif 434 #endif
435 }; 435 };
436 436
437 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { 437 inline TimeTicks TimeDelta::operator+(TimeTicks t) const {
438 return TimeTicks(t.ticks_ + delta_); 438 return TimeTicks(t.ticks_ + delta_);
439 } 439 }
440 440
441 #endif // BASE_TIME_H_ 441 #endif // BASE_TIME_H_
OLDNEW
« no previous file with comments | « no previous file | base/time_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698