| 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <stack> | 10 #include <stack> |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 // be subtracted from the current most nested task's run time. Stopwatches | 702 // be subtracted from the current most nested task's run time. Stopwatches |
| 703 // coordinate with the stopwatches in which they are nested to avoid | 703 // coordinate with the stopwatches in which they are nested to avoid |
| 704 // double-counting nested tasks run times. | 704 // double-counting nested tasks run times. |
| 705 | 705 |
| 706 class BASE_EXPORT TaskStopwatch { | 706 class BASE_EXPORT TaskStopwatch { |
| 707 public: | 707 public: |
| 708 // Starts the stopwatch. | 708 // Starts the stopwatch. |
| 709 TaskStopwatch(); | 709 TaskStopwatch(); |
| 710 ~TaskStopwatch(); | 710 ~TaskStopwatch(); |
| 711 | 711 |
| 712 // Starts stopwatch. |
| 713 void Start(); |
| 714 |
| 712 // Stops stopwatch. | 715 // Stops stopwatch. |
| 713 void Stop(); | 716 void Stop(); |
| 714 | 717 |
| 715 // Returns the start time. | 718 // Returns the start time. |
| 716 TrackedTime StartTime() const; | 719 TrackedTime StartTime() const; |
| 717 | 720 |
| 718 // Task's duration is calculated as the wallclock duration between starting | 721 // Task's duration is calculated as the wallclock duration between starting |
| 719 // and stopping this stopwatch, minus the wallclock durations of any other | 722 // and stopping this stopwatch, minus the wallclock durations of any other |
| 720 // instances that are immediately nested in this one, started and stopped on | 723 // instances that are immediately nested in this one, started and stopped on |
| 721 // this thread during that period. | 724 // this thread during that period. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 737 // Sum of wallclock durations of all stopwatches that were directly nested in | 740 // Sum of wallclock durations of all stopwatches that were directly nested in |
| 738 // this one. | 741 // this one. |
| 739 int32 excluded_duration_ms_; | 742 int32 excluded_duration_ms_; |
| 740 | 743 |
| 741 // Stopwatch which was running on our thread when this stopwatch was started. | 744 // Stopwatch which was running on our thread when this stopwatch was started. |
| 742 // That preexisting stopwatch must be adjusted to the exclude the wallclock | 745 // That preexisting stopwatch must be adjusted to the exclude the wallclock |
| 743 // duration of this stopwatch. | 746 // duration of this stopwatch. |
| 744 TaskStopwatch* parent_; | 747 TaskStopwatch* parent_; |
| 745 | 748 |
| 746 #if DCHECK_IS_ON | 749 #if DCHECK_IS_ON |
| 747 // State of the stopwatch. Stopwatch is first constructed in a running state, | 750 // State of the stopwatch. Stopwatch is first constructed in a created state |
| 748 // then stopped, then destructed. | 751 // state, then is optionally started/stopped, then destructed. |
| 749 enum { | 752 enum { CREATED, RUNNING, STOPPED } state_; |
| 750 RUNNING, | |
| 751 STOPPED | |
| 752 } state_; | |
| 753 | 753 |
| 754 // Currently running stopwatch that is directly nested in this one, if such | 754 // Currently running stopwatch that is directly nested in this one, if such |
| 755 // stopwatch exists. NULL otherwise. | 755 // stopwatch exists. NULL otherwise. |
| 756 TaskStopwatch* child_; | 756 TaskStopwatch* child_; |
| 757 #endif | 757 #endif |
| 758 }; | 758 }; |
| 759 | 759 |
| 760 //------------------------------------------------------------------------------ | 760 //------------------------------------------------------------------------------ |
| 761 // A snapshotted representation of a (parent, child) task pair, for tracking | 761 // A snapshotted representation of a (parent, child) task pair, for tracking |
| 762 // hierarchical profiles. | 762 // hierarchical profiles. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 781 ~ProcessDataSnapshot(); | 781 ~ProcessDataSnapshot(); |
| 782 | 782 |
| 783 std::vector<TaskSnapshot> tasks; | 783 std::vector<TaskSnapshot> tasks; |
| 784 std::vector<ParentChildPairSnapshot> descendants; | 784 std::vector<ParentChildPairSnapshot> descendants; |
| 785 int process_id; | 785 int process_id; |
| 786 }; | 786 }; |
| 787 | 787 |
| 788 } // namespace tracked_objects | 788 } // namespace tracked_objects |
| 789 | 789 |
| 790 #endif // BASE_TRACKED_OBJECTS_H_ | 790 #endif // BASE_TRACKED_OBJECTS_H_ |
| OLD | NEW |