Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_DEBUG_ACTIVITY_ANALYZER_H_ | 5 #ifndef BASE_DEBUG_ACTIVITY_ANALYZER_H_ |
| 6 #define BASE_DEBUG_ACTIVITY_ANALYZER_H_ | 6 #define BASE_DEBUG_ACTIVITY_ANALYZER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | |
| 11 | 12 |
| 12 #include "base/base_export.h" | 13 #include "base/base_export.h" |
| 13 #include "base/debug/activity_tracker.h" | 14 #include "base/debug/activity_tracker.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 namespace debug { | 17 namespace debug { |
| 17 | 18 |
| 18 // This class provides analysis of data captured from a ThreadActivityTracker. | 19 // This class provides analysis of data captured from a ThreadActivityTracker. |
| 19 // When created, it takes a snapshot of the data held by the tracker and | 20 // When created, it takes a snapshot of the data held by the tracker and |
| 20 // makes that information available to other code. | 21 // makes that information available to other code. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 const std::string& GetThreadName() { | 67 const std::string& GetThreadName() { |
| 67 return activity_snapshot_.thread_name; | 68 return activity_snapshot_.thread_name; |
| 68 } | 69 } |
| 69 | 70 |
| 70 // Gets the TheadKey for this thread. | 71 // Gets the TheadKey for this thread. |
| 71 ThreadKey GetThreadKey() { | 72 ThreadKey GetThreadKey() { |
| 72 return ThreadKey(activity_snapshot_.process_id, | 73 return ThreadKey(activity_snapshot_.process_id, |
| 73 activity_snapshot_.thread_id); | 74 activity_snapshot_.thread_id); |
| 74 } | 75 } |
| 75 | 76 |
| 77 const ActivitySnapshot& activity_snapshot() { return activity_snapshot_; } | |
|
bcwhite
2016/11/02 16:52:37
I had originally planned to *not* expose the snaps
manzagop (departed)
2016/11/02 20:15:23
Acknowledged.
| |
| 78 | |
| 76 private: | 79 private: |
| 77 friend class GlobalActivityAnalyzer; | 80 friend class GlobalActivityAnalyzer; |
| 78 | 81 |
| 79 // The snapshot of the activity tracker taken at the moment of construction. | 82 // The snapshot of the activity tracker taken at the moment of construction. |
| 80 ActivitySnapshot activity_snapshot_; | 83 ActivitySnapshot activity_snapshot_; |
| 81 | 84 |
| 82 // Flag indicating if the snapshot data is valid. | 85 // Flag indicating if the snapshot data is valid. |
| 83 bool activity_snapshot_valid_; | 86 bool activity_snapshot_valid_; |
| 84 | 87 |
| 85 // A reference into a persistent memory allocator, used by the global | 88 // A reference into a persistent memory allocator, used by the global |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 // first/next iteration. | 150 // first/next iteration. |
| 148 AnalyzerMap::iterator analyzers_iterator_; | 151 AnalyzerMap::iterator analyzers_iterator_; |
| 149 | 152 |
| 150 DISALLOW_COPY_AND_ASSIGN(GlobalActivityAnalyzer); | 153 DISALLOW_COPY_AND_ASSIGN(GlobalActivityAnalyzer); |
| 151 }; | 154 }; |
| 152 | 155 |
| 153 } // namespace debug | 156 } // namespace debug |
| 154 } // namespace base | 157 } // namespace base |
| 155 | 158 |
| 156 #endif // BASE_DEBUG_ACTIVITY_ANALYZER_H_ | 159 #endif // BASE_DEBUG_ACTIVITY_ANALYZER_H_ |
| OLD | NEW |