OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef BASE_TRACKED_OBJECTS_H_ | 5 #ifndef BASE_TRACKED_OBJECTS_H_ |
6 #define BASE_TRACKED_OBJECTS_H_ | 6 #define BASE_TRACKED_OBJECTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <stack> | 10 #include <stack> |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
655 // Initializes all statics if needed (this initialization call should be made | 655 // Initializes all statics if needed (this initialization call should be made |
656 // while we are single threaded). Returns false if unable to initialize. | 656 // while we are single threaded). Returns false if unable to initialize. |
657 static bool Initialize(); | 657 static bool Initialize(); |
658 | 658 |
659 // Sets internal status_ to either become ACTIVE, or DEACTIVATED, | 659 // Sets internal status_ to either become ACTIVE, or DEACTIVATED, |
660 // based on argument being true or false respectively. | 660 // based on argument being true or false respectively. |
661 // If tracking is not compiled in, this function will return false. | 661 // If tracking is not compiled in, this function will return false. |
662 static bool InitializeAndSetTrackingStatus(bool status); | 662 static bool InitializeAndSetTrackingStatus(bool status); |
663 static bool tracking_status(); | 663 static bool tracking_status(); |
664 | 664 |
665 // Special versions of Now() for getting times at start and end of a tracked | |
666 // run. They are super fast when tracking is disabled, and have some interal | |
ramant (doing other things)
2011/11/14 04:41:58
nit: interal -> internal
jar (doing other things)
2011/11/14 05:04:50
Done.
| |
667 // side effects when we are tracking, so that we can deduce the amount of time | |
668 // accumulated outside of execution of tracked runs. | |
669 static TrackedTime NowForStartOfRun(); | |
670 static TrackedTime NowForEndOfRun(); | |
671 | |
665 // Provide a time function that does nothing (runs fast) when we don't have | 672 // Provide a time function that does nothing (runs fast) when we don't have |
666 // the profiler enabled. It will generally be optimized away when it is | 673 // the profiler enabled. It will generally be optimized away when it is |
667 // ifdef'ed to be small enough (allowing the profiler to be "compiled out" of | 674 // ifdef'ed to be small enough (allowing the profiler to be "compiled out" of |
668 // the code). | 675 // the code). |
669 static TrackedTime Now(); | 676 static TrackedTime Now(); |
670 | 677 |
671 private: | 678 private: |
672 // Allow only tests to call ShutdownSingleThreadedCleanup. We NEVER call it | 679 // Allow only tests to call ShutdownSingleThreadedCleanup. We NEVER call it |
673 // in production code. | 680 // in production code. |
674 friend class TrackedObjectsTest; | 681 friend class TrackedObjectsTest; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
806 } | 813 } |
807 | 814 |
808 private: | 815 private: |
809 | 816 |
810 DISALLOW_COPY_AND_ASSIGN(AutoTracking); | 817 DISALLOW_COPY_AND_ASSIGN(AutoTracking); |
811 }; | 818 }; |
812 | 819 |
813 } // namespace tracked_objects | 820 } // namespace tracked_objects |
814 | 821 |
815 #endif // BASE_TRACKED_OBJECTS_H_ | 822 #endif // BASE_TRACKED_OBJECTS_H_ |
OLD | NEW |