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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 // When deaths have not yet taken place, and we gather data from all the | 267 // When deaths have not yet taken place, and we gather data from all the |
268 // threads, we create DeathData stats that tally the number of births without | 268 // threads, we create DeathData stats that tally the number of births without |
269 // a corresponding death. | 269 // a corresponding death. |
270 explicit DeathData(int count); | 270 explicit DeathData(int count); |
271 | 271 |
272 // Update stats for a task destruction (death) that had a Run() time of | 272 // Update stats for a task destruction (death) that had a Run() time of |
273 // |duration|, and has had a queueing delay of |queue_duration|. | 273 // |duration|, and has had a queueing delay of |queue_duration|. |
274 void RecordDeath(const int32 queue_duration, | 274 void RecordDeath(const int32 queue_duration, |
275 const int32 run_duration, | 275 const int32 run_duration, |
276 int random_number); | 276 const uint32 random_number); |
277 | 277 |
278 // Metrics accessors, used only for serialization and in tests. | 278 // Metrics accessors, used only for serialization and in tests. |
279 int count() const; | 279 int count() const; |
280 int32 run_duration_sum() const; | 280 int32 run_duration_sum() const; |
281 int32 run_duration_max() const; | 281 int32 run_duration_max() const; |
282 int32 run_duration_sample() const; | 282 int32 run_duration_sample() const; |
283 int32 queue_duration_sum() const; | 283 int32 queue_duration_sum() const; |
284 int32 queue_duration_max() const; | 284 int32 queue_duration_max() const; |
285 int32 queue_duration_sample() const; | 285 int32 queue_duration_sample() const; |
286 | 286 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 // loop, then the stack can grow larger. Note that we don't try to deduct | 678 // loop, then the stack can grow larger. Note that we don't try to deduct |
679 // time in nested porfiles, as our current timer is based on wall-clock time, | 679 // time in nested porfiles, as our current timer is based on wall-clock time, |
680 // and not CPU time (and we're hopeful that nested timing won't be a | 680 // and not CPU time (and we're hopeful that nested timing won't be a |
681 // significant additional cost). | 681 // significant additional cost). |
682 ParentStack parent_stack_; | 682 ParentStack parent_stack_; |
683 | 683 |
684 // A random number that we used to select decide which sample to keep as a | 684 // A random number that we used to select decide which sample to keep as a |
685 // representative sample in each DeathData instance. We can't start off with | 685 // representative sample in each DeathData instance. We can't start off with |
686 // much randomness (because we can't call RandInt() on all our threads), so | 686 // much randomness (because we can't call RandInt() on all our threads), so |
687 // we stir in more and more as we go. | 687 // we stir in more and more as we go. |
688 int32 random_number_; | 688 uint32 random_number_; |
689 | 689 |
690 // Record of what the incarnation_counter_ was when this instance was created. | 690 // Record of what the incarnation_counter_ was when this instance was created. |
691 // If the incarnation_counter_ has changed, then we avoid pushing into the | 691 // If the incarnation_counter_ has changed, then we avoid pushing into the |
692 // pool (this is only critical in tests which go through multiple | 692 // pool (this is only critical in tests which go through multiple |
693 // incarnations). | 693 // incarnations). |
694 int incarnation_count_for_pool_; | 694 int incarnation_count_for_pool_; |
695 | 695 |
696 // Most recently started (i.e. most nested) stopwatch on the current thread, | 696 // Most recently started (i.e. most nested) stopwatch on the current thread, |
697 // if it exists; NULL otherwise. | 697 // if it exists; NULL otherwise. |
698 TaskStopwatch* current_stopwatch_; | 698 TaskStopwatch* current_stopwatch_; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 ~ProcessDataSnapshot(); | 784 ~ProcessDataSnapshot(); |
785 | 785 |
786 std::vector<TaskSnapshot> tasks; | 786 std::vector<TaskSnapshot> tasks; |
787 std::vector<ParentChildPairSnapshot> descendants; | 787 std::vector<ParentChildPairSnapshot> descendants; |
788 int process_id; | 788 int process_id; |
789 }; | 789 }; |
790 | 790 |
791 } // namespace tracked_objects | 791 } // namespace tracked_objects |
792 | 792 |
793 #endif // BASE_TRACKED_OBJECTS_H_ | 793 #endif // BASE_TRACKED_OBJECTS_H_ |
OLD | NEW |