| 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 | 11 |
| 12 #include "base/base_export.h" | 12 #include "base/base_export.h" |
| 13 #include "base/debug/activity_tracker.h" | 13 #include "base/debug/activity_tracker.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 namespace debug { | 16 namespace debug { |
| 17 | 17 |
| 18 // This class provides analysis of data captured from a ThreadActivityTracker. | 18 // 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 | 19 // When created, it takes a snapshot of the data held by the tracker and |
| 20 // makes that information available to other code. | 20 // makes that information available to other code. |
| 21 class BASE_EXPORT ThreadActivityAnalyzer { | 21 class BASE_EXPORT ThreadActivityAnalyzer { |
| 22 public: | 22 public: |
| 23 using Activity = ThreadActivityTracker::Activity; | |
| 24 using ActivitySnapshot = ThreadActivityTracker::ActivitySnapshot; | |
| 25 | |
| 26 // This class provides keys that uniquely identify a thread, even across | 23 // This class provides keys that uniquely identify a thread, even across |
| 27 // multiple processes. | 24 // multiple processes. |
| 28 class ThreadKey { | 25 class ThreadKey { |
| 29 public: | 26 public: |
| 30 ThreadKey(int64_t pid, int64_t tid) : pid_(pid), tid_(tid) {} | 27 ThreadKey(int64_t pid, int64_t tid) : pid_(pid), tid_(tid) {} |
| 31 | 28 |
| 32 bool operator<(const ThreadKey& rhs) const { | 29 bool operator<(const ThreadKey& rhs) const { |
| 33 if (pid_ != rhs.pid_) | 30 if (pid_ != rhs.pid_) |
| 34 return pid_ < rhs.pid_; | 31 return pid_ < rhs.pid_; |
| 35 return tid_ < rhs.tid_; | 32 return tid_ < rhs.tid_; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // first/next iteration. | 147 // first/next iteration. |
| 151 AnalyzerMap::iterator analyzers_iterator_; | 148 AnalyzerMap::iterator analyzers_iterator_; |
| 152 | 149 |
| 153 DISALLOW_COPY_AND_ASSIGN(GlobalActivityAnalyzer); | 150 DISALLOW_COPY_AND_ASSIGN(GlobalActivityAnalyzer); |
| 154 }; | 151 }; |
| 155 | 152 |
| 156 } // namespace debug | 153 } // namespace debug |
| 157 } // namespace base | 154 } // namespace base |
| 158 | 155 |
| 159 #endif // BASE_DEBUG_ACTIVITY_ANALYZER_H_ | 156 #endif // BASE_DEBUG_ACTIVITY_ANALYZER_H_ |
| OLD | NEW |