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

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

Issue 2041583003: [tracing] Introduce "allowed_dump_modes" for memory dump config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@background_config
Patch Set: Change mode to int. Created 4 years, 6 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/trace_event/trace_config.cc ('k') | base/trace_event/trace_config_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_TRACE_CONFIG_MEMORY_TEST_UTIL_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_CONFIG_MEMORY_TEST_UTIL_H_
6 #define BASE_TRACE_EVENT_TRACE_CONFIG_MEMORY_TEST_UTIL_H_ 6 #define BASE_TRACE_EVENT_TRACE_CONFIG_MEMORY_TEST_UTIL_H_
7 7
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/memory_dump_manager.h" 9 #include "base/trace_event/memory_dump_manager.h"
10 10
11 namespace base { 11 namespace base {
12 namespace trace_event { 12 namespace trace_event {
13 13
14 class TraceConfigMemoryTestUtil { 14 class TraceConfigMemoryTestUtil {
15 public: 15 public:
16 static std::string GetTraceConfig_PeriodicTriggers(int light_period, 16 static std::string GetTraceConfig_PeriodicTriggers(int light_period,
17 int heavy_period) { 17 int heavy_period) {
18 return StringPrintf( 18 return StringPrintf(
19 "{" 19 "{"
20 "\"enable_argument_filter\":false," 20 "\"enable_argument_filter\":false,"
21 "\"enable_sampling\":false," 21 "\"enable_sampling\":false,"
22 "\"enable_systrace\":false," 22 "\"enable_systrace\":false,"
23 "\"included_categories\":[" 23 "\"included_categories\":["
24 "\"%s\"" 24 "\"%s\""
25 "]," 25 "],"
26 "\"memory_dump_config\":{" 26 "\"memory_dump_config\":{"
27 "\"allowed_dump_modes\":[\"background\",\"light\",\"detailed\"],"
27 "\"heap_profiler_options\":{" 28 "\"heap_profiler_options\":{"
28 "\"breakdown_threshold_bytes\":2048" 29 "\"breakdown_threshold_bytes\":2048"
29 "}," 30 "},"
30 "\"triggers\":[" 31 "\"triggers\":["
31 "{" 32 "{"
32 "\"mode\":\"light\"," 33 "\"mode\":\"light\","
33 "\"periodic_interval_ms\":%d" 34 "\"periodic_interval_ms\":%d"
34 "}," 35 "},"
35 "{" 36 "{"
36 "\"mode\":\"detailed\"," 37 "\"mode\":\"detailed\","
37 "\"periodic_interval_ms\":%d" 38 "\"periodic_interval_ms\":%d"
38 "}" 39 "}"
39 "]" 40 "]"
40 "}," 41 "},"
41 "\"record_mode\":\"record-until-full\"" 42 "\"record_mode\":\"record-until-full\""
42 "}", MemoryDumpManager::kTraceCategory, light_period, heavy_period); 43 "}", MemoryDumpManager::kTraceCategory, light_period, heavy_period);
43 } 44 }
44 45
45 static std::string GetTraceConfig_EmptyTriggers() { 46 static std::string GetTraceConfig_EmptyTriggers() {
46 return StringPrintf( 47 return StringPrintf(
47 "{" 48 "{"
48 "\"enable_argument_filter\":false," 49 "\"enable_argument_filter\":false,"
49 "\"enable_sampling\":false," 50 "\"enable_sampling\":false,"
50 "\"enable_systrace\":false," 51 "\"enable_systrace\":false,"
51 "\"included_categories\":[" 52 "\"included_categories\":["
52 "\"%s\"" 53 "\"%s\""
53 "]," 54 "],"
54 "\"memory_dump_config\":{" 55 "\"memory_dump_config\":{"
56 "\"allowed_dump_modes\":[\"background\",\"light\",\"detailed\"],"
55 "\"triggers\":[" 57 "\"triggers\":["
56 "]" 58 "]"
57 "}," 59 "},"
58 "\"record_mode\":\"record-until-full\"" 60 "\"record_mode\":\"record-until-full\""
59 "}", MemoryDumpManager::kTraceCategory); 61 "}", MemoryDumpManager::kTraceCategory);
60 } 62 }
61 63
62 static std::string GetTraceConfig_NoTriggers() { 64 static std::string GetTraceConfig_NoTriggers() {
63 return StringPrintf( 65 return StringPrintf(
64 "{" 66 "{"
(...skipping 10 matching lines...) Expand all
75 static std::string GetTraceConfig_BackgroundTrigger(int period_ms) { 77 static std::string GetTraceConfig_BackgroundTrigger(int period_ms) {
76 return StringPrintf( 78 return StringPrintf(
77 "{" 79 "{"
78 "\"enable_argument_filter\":false," 80 "\"enable_argument_filter\":false,"
79 "\"enable_sampling\":false," 81 "\"enable_sampling\":false,"
80 "\"enable_systrace\":false," 82 "\"enable_systrace\":false,"
81 "\"included_categories\":[" 83 "\"included_categories\":["
82 "\"%s\"" 84 "\"%s\""
83 "]," 85 "],"
84 "\"memory_dump_config\":{" 86 "\"memory_dump_config\":{"
87 "\"allowed_dump_modes\":[\"background\"],"
85 "\"triggers\":[" 88 "\"triggers\":["
86 "{" 89 "{"
87 "\"mode\":\"background\"," 90 "\"mode\":\"background\","
88 "\"periodic_interval_ms\":%d" 91 "\"periodic_interval_ms\":%d"
89 "}" 92 "}"
90 "]" 93 "]"
91 "}," 94 "},"
92 "\"record_mode\":\"record-until-full\"" 95 "\"record_mode\":\"record-until-full\""
93 "}", MemoryDumpManager::kTraceCategory, period_ms); 96 "}", MemoryDumpManager::kTraceCategory, period_ms);
94 } 97 }
95 }; 98 };
96 99
97 } // namespace trace_event 100 } // namespace trace_event
98 } // namespace base 101 } // namespace base
99 102
100 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_MEMORY_TEST_UTIL_H_ 103 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_MEMORY_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « base/trace_event/trace_config.cc ('k') | base/trace_event/trace_config_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698