| 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_DUMP_SCHEDULER_H | 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_SCHEDULER_H |
| 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_SCHEDULER_H | 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_SCHEDULER_H |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Resets time for triggering dump to account for minimum time between the | 44 // Resets time for triggering dump to account for minimum time between the |
| 45 // dumps. | 45 // dumps. |
| 46 void NotifyDumpTriggered(); | 46 void NotifyDumpTriggered(); |
| 47 | 47 |
| 48 // Disables all triggers. | 48 // Disables all triggers. |
| 49 void DisableAllTriggers(); | 49 void DisableAllTriggers(); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 friend class MemoryDumpManagerTest; | 52 friend class MemoryDumpManagerTest; |
| 53 friend class MemoryDumpSchedulerPollingTest; | |
| 54 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, TestPollingOnDumpThread); | 53 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, TestPollingOnDumpThread); |
| 55 | 54 |
| 56 // Helper class to schdule periodic memory dumps. | 55 // Helper class to schdule periodic memory dumps. |
| 57 struct BASE_EXPORT PeriodicTriggerState { | 56 struct PeriodicTriggerState { |
| 58 PeriodicTriggerState(); | 57 PeriodicTriggerState(); |
| 59 ~PeriodicTriggerState(); | 58 ~PeriodicTriggerState(); |
| 60 | 59 |
| 61 bool is_configured; | 60 bool is_configured; |
| 62 | 61 |
| 63 RepeatingTimer timer; | 62 RepeatingTimer timer; |
| 64 uint32_t dump_count; | 63 uint32_t dump_count; |
| 65 uint32_t min_timer_period_ms; | 64 uint32_t min_timer_period_ms; |
| 66 uint32_t light_dumps_rate; | 65 uint32_t light_dumps_rate; |
| 67 uint32_t heavy_dumps_rate; | 66 uint32_t heavy_dumps_rate; |
| 68 | 67 |
| 69 uint32_t light_dump_period_ms; | 68 uint32_t light_dump_period_ms; |
| 70 uint32_t heavy_dump_period_ms; | 69 uint32_t heavy_dump_period_ms; |
| 71 | 70 |
| 72 DISALLOW_COPY_AND_ASSIGN(PeriodicTriggerState); | 71 DISALLOW_COPY_AND_ASSIGN(PeriodicTriggerState); |
| 73 }; | 72 }; |
| 74 | 73 |
| 75 struct BASE_EXPORT PollingTriggerState { | 74 struct PollingTriggerState { |
| 76 enum State { | 75 enum State { |
| 77 CONFIGURED, // Polling trigger was added. | 76 CONFIGURED, // Polling trigger was added. |
| 78 ENABLED, // Polling is running. | 77 ENABLED, // Polling is running. |
| 79 DISABLED // Polling is disabled. | 78 DISABLED // Polling is disabled. |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 static const uint32_t kMaxNumMemorySamples = 50; | 81 static const uint32_t kMaxNumMemorySamples = 50; |
| 83 | 82 |
| 84 explicit PollingTriggerState( | 83 explicit PollingTriggerState( |
| 85 scoped_refptr<SingleThreadTaskRunner> polling_task_runner); | 84 scoped_refptr<SingleThreadTaskRunner> polling_task_runner); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 PeriodicTriggerState periodic_state_; | 132 PeriodicTriggerState periodic_state_; |
| 134 PollingTriggerState polling_state_; | 133 PollingTriggerState polling_state_; |
| 135 | 134 |
| 136 DISALLOW_COPY_AND_ASSIGN(MemoryDumpScheduler); | 135 DISALLOW_COPY_AND_ASSIGN(MemoryDumpScheduler); |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 } // namespace trace_event | 138 } // namespace trace_event |
| 140 } // namespace base | 139 } // namespace base |
| 141 | 140 |
| 142 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SCHEDULER_H | 141 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SCHEDULER_H |
| OLD | NEW |