OLD | NEW |
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 #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 <set> | 10 #include <set> |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 // Sets internal status_. | 435 // Sets internal status_. |
436 // If |status| is false, then status_ is set to DEACTIVATED. | 436 // If |status| is false, then status_ is set to DEACTIVATED. |
437 // If |status| is true, then status_ is set to, PROFILING_ACTIVE, or | 437 // If |status| is true, then status_ is set to, PROFILING_ACTIVE, or |
438 // PROFILING_CHILDREN_ACTIVE. | 438 // PROFILING_CHILDREN_ACTIVE. |
439 // If tracking is not compiled in, this function will return false. | 439 // If tracking is not compiled in, this function will return false. |
440 // If parent-child tracking is not compiled in, then an attempt to set the | 440 // If parent-child tracking is not compiled in, then an attempt to set the |
441 // status to PROFILING_CHILDREN_ACTIVE will only result in a status of | 441 // status to PROFILING_CHILDREN_ACTIVE will only result in a status of |
442 // PROFILING_ACTIVE (i.e., it can't be set to a higher level than what is | 442 // PROFILING_ACTIVE (i.e., it can't be set to a higher level than what is |
443 // compiled into the binary, and parent-child tracking at the | 443 // compiled into the binary, and parent-child tracking at the |
444 // PROFILING_CHILDREN_ACTIVE level might not be compiled in). | 444 // PROFILING_CHILDREN_ACTIVE level might not be compiled in). |
445 static bool InitializeAndSetTrackingStatus(Status status); | 445 static bool InitializeAndSetTrackingStatus(bool status); |
446 | |
447 static Status status(); | |
448 | 446 |
449 // Indicate if any sort of profiling is being done (i.e., we are more than | 447 // Indicate if any sort of profiling is being done (i.e., we are more than |
450 // DEACTIVATED). | 448 // DEACTIVATED). |
451 static bool TrackingStatus(); | 449 static bool tracking_status(); |
452 | 450 |
453 // For testing only, indicate if the status of parent-child tracking is turned | 451 // For testing only, indicate if the status of parent-child tracking is turned |
454 // on. This is currently a compiled option, atop TrackingStatus(). | 452 // on. This is currently a compiled option, atop tracking_status(). |
455 static bool TrackingParentChildStatus(); | 453 static bool tracking_parent_child_status(); |
456 | 454 |
457 // Special versions of Now() for getting times at start and end of a tracked | 455 // Special versions of Now() for getting times at start and end of a tracked |
458 // run. They are super fast when tracking is disabled, and have some internal | 456 // run. They are super fast when tracking is disabled, and have some internal |
459 // side effects when we are tracking, so that we can deduce the amount of time | 457 // side effects when we are tracking, so that we can deduce the amount of time |
460 // accumulated outside of execution of tracked runs. | 458 // accumulated outside of execution of tracked runs. |
461 // The task that will be tracked is passed in as |parent| so that parent-child | 459 // The task that will be tracked is passed in as |parent| so that parent-child |
462 // relationships can be (optionally) calculated. | 460 // relationships can be (optionally) calculated. |
463 static TrackedTime NowForStartOfRun(const Births* parent); | 461 static TrackedTime NowForStartOfRun(const Births* parent); |
464 static TrackedTime NowForEndOfRun(); | 462 static TrackedTime NowForEndOfRun(); |
465 | 463 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 } | 723 } |
726 | 724 |
727 private: | 725 private: |
728 | 726 |
729 DISALLOW_COPY_AND_ASSIGN(AutoTracking); | 727 DISALLOW_COPY_AND_ASSIGN(AutoTracking); |
730 }; | 728 }; |
731 | 729 |
732 } // namespace tracked_objects | 730 } // namespace tracked_objects |
733 | 731 |
734 #endif // BASE_TRACKED_OBJECTS_H_ | 732 #endif // BASE_TRACKED_OBJECTS_H_ |
OLD | NEW |