Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: base/trace_event/memory_dump_scheduler.h

Issue 2743663005: [memory-infra] Add unittests for peak detection and NotifyDumpTriggered (Closed)
Patch Set: get back include Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/memory_dump_scheduler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
53 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, TestPollingOnDumpThread); 54 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, TestPollingOnDumpThread);
54 55
55 // Helper class to schdule periodic memory dumps. 56 // Helper class to schdule periodic memory dumps.
56 struct PeriodicTriggerState { 57 struct BASE_EXPORT PeriodicTriggerState {
57 PeriodicTriggerState(); 58 PeriodicTriggerState();
58 ~PeriodicTriggerState(); 59 ~PeriodicTriggerState();
59 60
60 bool is_configured; 61 bool is_configured;
61 62
62 RepeatingTimer timer; 63 RepeatingTimer timer;
63 uint32_t dump_count; 64 uint32_t dump_count;
64 uint32_t min_timer_period_ms; 65 uint32_t min_timer_period_ms;
65 uint32_t light_dumps_rate; 66 uint32_t light_dumps_rate;
66 uint32_t heavy_dumps_rate; 67 uint32_t heavy_dumps_rate;
67 68
68 uint32_t light_dump_period_ms; 69 uint32_t light_dump_period_ms;
69 uint32_t heavy_dump_period_ms; 70 uint32_t heavy_dump_period_ms;
70 71
71 DISALLOW_COPY_AND_ASSIGN(PeriodicTriggerState); 72 DISALLOW_COPY_AND_ASSIGN(PeriodicTriggerState);
72 }; 73 };
73 74
74 struct PollingTriggerState { 75 struct BASE_EXPORT PollingTriggerState {
75 enum State { 76 enum State {
76 CONFIGURED, // Polling trigger was added. 77 CONFIGURED, // Polling trigger was added.
77 ENABLED, // Polling is running. 78 ENABLED, // Polling is running.
78 DISABLED // Polling is disabled. 79 DISABLED // Polling is disabled.
79 }; 80 };
80 81
81 static const uint32_t kMaxNumMemorySamples = 50; 82 static const uint32_t kMaxNumMemorySamples = 50;
82 83
83 explicit PollingTriggerState( 84 explicit PollingTriggerState(
84 scoped_refptr<SingleThreadTaskRunner> polling_task_runner); 85 scoped_refptr<SingleThreadTaskRunner> polling_task_runner);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 PeriodicTriggerState periodic_state_; 133 PeriodicTriggerState periodic_state_;
133 PollingTriggerState polling_state_; 134 PollingTriggerState polling_state_;
134 135
135 DISALLOW_COPY_AND_ASSIGN(MemoryDumpScheduler); 136 DISALLOW_COPY_AND_ASSIGN(MemoryDumpScheduler);
136 }; 137 };
137 138
138 } // namespace trace_event 139 } // namespace trace_event
139 } // namespace base 140 } // namespace base
140 141
141 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SCHEDULER_H 142 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SCHEDULER_H
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/memory_dump_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698