| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_TRACE_EVENT_MEMORY_PEAK_DETECTOR_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_PEAK_DETECTOR_H_ |
| 6 #define BASE_TRACE_EVENT_MEMORY_PEAK_DETECTOR_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_PEAK_DETECTOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 using GetDumpProvidersFunction = RepeatingCallback<void(DumpProvidersList*)>; | 40 using GetDumpProvidersFunction = RepeatingCallback<void(DumpProvidersList*)>; |
| 41 | 41 |
| 42 enum State { | 42 enum State { |
| 43 NOT_INITIALIZED = 0, // Before Setup() | 43 NOT_INITIALIZED = 0, // Before Setup() |
| 44 DISABLED, // Before Start() or after Stop(). | 44 DISABLED, // Before Start() or after Stop(). |
| 45 ENABLED, // After Start() but no dump_providers_ are available. | 45 ENABLED, // After Start() but no dump_providers_ are available. |
| 46 RUNNING // After Start(). The PollMemoryAndDetectPeak() task is scheduled. | 46 RUNNING // After Start(). The PollMemoryAndDetectPeak() task is scheduled. |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // Peak detector configuration, passed to Start(). | 49 // Peak detector configuration, passed to Start(). |
| 50 struct Config { | 50 struct BASE_EXPORT Config { |
| 51 Config(); |
| 52 Config(uint32_t polling_interval_ms, |
| 53 uint32_t min_time_between_peaks_ms, |
| 54 bool enable_verbose_poll_tracing); |
| 55 |
| 51 // The rate at which memory will be polled. Polls will happen on the task | 56 // The rate at which memory will be polled. Polls will happen on the task |
| 52 // runner passed to Setup(). | 57 // runner passed to Setup(). |
| 53 uint32_t polling_interval_ms; | 58 uint32_t polling_interval_ms; |
| 54 | 59 |
| 55 // Two consecutive peak detection callbacks will happen at least | 60 // Two consecutive peak detection callbacks will happen at least |
| 56 // |min_time_between_peaks_ms| apart from each other. | 61 // |min_time_between_peaks_ms| apart from each other. |
| 57 uint32_t min_time_between_peaks_ms; | 62 uint32_t min_time_between_peaks_ms; |
| 58 | 63 |
| 59 // When enabled causes a TRACE_COUNTER event to be injected in the trace | 64 // When enabled causes a TRACE_COUNTER event to be injected in the trace |
| 60 // for each poll (if tracing is enabled). | 65 // for each poll (if tracing is enabled). |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 uint32_t samples_index_; | 175 uint32_t samples_index_; |
| 171 uint32_t poll_tasks_count_for_testing_; | 176 uint32_t poll_tasks_count_for_testing_; |
| 172 | 177 |
| 173 DISALLOW_COPY_AND_ASSIGN(MemoryPeakDetector); | 178 DISALLOW_COPY_AND_ASSIGN(MemoryPeakDetector); |
| 174 }; | 179 }; |
| 175 | 180 |
| 176 } // namespace trace_event | 181 } // namespace trace_event |
| 177 } // namespace base | 182 } // namespace base |
| 178 | 183 |
| 179 #endif // BASE_TRACE_EVENT_MEMORY_PEAK_DETECTOR_H_ | 184 #endif // BASE_TRACE_EVENT_MEMORY_PEAK_DETECTOR_H_ |
| OLD | NEW |