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

Side by Side Diff: base/time/time.h

Issue 2951413003: Add UMA for High Resolution Timer Usage (Closed)
Patch Set: Removed NaCl changes Created 3 years, 5 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
« no previous file with comments | « no previous file | base/time/time_win.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 coordinated universal time (UTC), 5 // Time represents an absolute point in coordinated universal time (UTC),
6 // internally represented as microseconds (s/1,000,000) since the Windows epoch 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch
7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are 7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are
8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump 8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump
9 // around as the operating system makes adjustments to synchronize (e.g., with 9 // around as the operating system makes adjustments to synchronize (e.g., with
10 // NTP servers). Thus, client code that uses the Time class must account for 10 // NTP servers). Thus, client code that uses the Time class must account for
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 // returns true. Each successful activate call must be paired with a 542 // returns true. Each successful activate call must be paired with a
543 // subsequent deactivate call. 543 // subsequent deactivate call.
544 // All callers to activate the high resolution timer must eventually call 544 // All callers to activate the high resolution timer must eventually call
545 // this function to deactivate the high resolution timer. 545 // this function to deactivate the high resolution timer.
546 static bool ActivateHighResolutionTimer(bool activate); 546 static bool ActivateHighResolutionTimer(bool activate);
547 547
548 // Returns true if the high resolution timer is both enabled and activated. 548 // Returns true if the high resolution timer is both enabled and activated.
549 // This is provided for testing only, and is not tracked in a thread-safe 549 // This is provided for testing only, and is not tracked in a thread-safe
550 // way. 550 // way.
551 static bool IsHighResolutionTimerInUse(); 551 static bool IsHighResolutionTimerInUse();
552 #endif 552
553 // The following two functions are used to report the fraction of elapsed time
554 // that the high resolution timer is activated.
555 // ResetHighResolutionTimerUsage() resets the cumulative usage and starts the
556 // measurement interval and GetHighResolutionTimerUsage() returns the
557 // percentage of time since the reset that the high resolution timer was
558 // activated.
559 // ResetHighResolutionTimerUsage() must be called at least once before calling
560 // GetHighResolutionTimerUsage(); otherwise the usage result would be
561 // undefined.
562 static void ResetHighResolutionTimerUsage();
563 static double GetHighResolutionTimerUsage();
564 #endif // defined(OS_WIN)
553 565
554 // Converts an exploded structure representing either the local time or UTC 566 // Converts an exploded structure representing either the local time or UTC
555 // into a Time class. Returns false on a failure when, for example, a day of 567 // into a Time class. Returns false on a failure when, for example, a day of
556 // month is set to 31 on a 28-30 day month. Returns Time(0) on overflow. 568 // month is set to 31 on a 28-30 day month. Returns Time(0) on overflow.
557 static bool FromUTCExploded(const Exploded& exploded, 569 static bool FromUTCExploded(const Exploded& exploded,
558 Time* time) WARN_UNUSED_RESULT { 570 Time* time) WARN_UNUSED_RESULT {
559 return FromExploded(false, exploded, time); 571 return FromExploded(false, exploded, time);
560 } 572 }
561 static bool FromLocalExploded(const Exploded& exploded, 573 static bool FromLocalExploded(const Exploded& exploded,
562 Time* time) WARN_UNUSED_RESULT { 574 Time* time) WARN_UNUSED_RESULT {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 static void WaitUntilInitializedWin(); 883 static void WaitUntilInitializedWin();
872 #endif 884 #endif
873 }; 885 };
874 886
875 // For logging use only. 887 // For logging use only.
876 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); 888 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks);
877 889
878 } // namespace base 890 } // namespace base
879 891
880 #endif // BASE_TIME_TIME_H_ 892 #endif // BASE_TIME_TIME_H_
OLDNEW
« no previous file with comments | « no previous file | base/time/time_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698