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