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 3 // found in the LICENSE file. 4 5 #ifndef BASE_TRACE_EVENT_TRACE_CONFIG_MEMORY_TEST_UTIL_H_ 6 #define BASE_TRACE_EVENT_TRACE_CONFIG_MEMORY_TEST_UTIL_H_ 7 8 #include "base/strings/stringprintf.h" 9 #include "base/trace_event/memory_dump_manager.h" 10 11 namespace base { 12 namespace trace_event { 13 14 class TraceConfigMemoryTestUtil { 15 public: GetTraceConfig_PeriodicTriggers(int light_period,int heavy_period)16 static std::string GetTraceConfig_PeriodicTriggers(int light_period, 17 int heavy_period) { 18 return StringPrintf( 19 "{" 20 "\"enable_argument_filter\":false," 21 "\"enable_sampling\":false," 22 "\"enable_systrace\":false," 23 "\"included_categories\":[" 24 "\"%s\"" 25 "]," 26 "\"memory_dump_config\":{" 27 "\"triggers\":[" 28 "{" 29 "\"mode\":\"light\"," 30 "\"periodic_interval_ms\":%d" 31 "}," 32 "{" 33 "\"mode\":\"detailed\"," 34 "\"periodic_interval_ms\":%d" 35 "}" 36 "]" 37 "}," 38 "\"record_mode\":\"record-until-full\"" 39 "}", MemoryDumpManager::kTraceCategory, light_period, heavy_period); 40 } 41 GetTraceConfig_EmptyTriggers()42 static std::string GetTraceConfig_EmptyTriggers() { 43 return StringPrintf( 44 "{" 45 "\"enable_argument_filter\":false," 46 "\"enable_sampling\":false," 47 "\"enable_systrace\":false," 48 "\"included_categories\":[" 49 "\"%s\"" 50 "]," 51 "\"memory_dump_config\":{" 52 "\"triggers\":[" 53 "]" 54 "}," 55 "\"record_mode\":\"record-until-full\"" 56 "}", MemoryDumpManager::kTraceCategory); 57 } 58 GetTraceConfig_NoTriggers()59 static std::string GetTraceConfig_NoTriggers() { 60 return StringPrintf( 61 "{" 62 "\"enable_argument_filter\":false," 63 "\"enable_sampling\":false," 64 "\"enable_systrace\":false," 65 "\"included_categories\":[" 66 "\"%s\"" 67 "]," 68 "\"record_mode\":\"record-until-full\"" 69 "}", MemoryDumpManager::kTraceCategory); 70 } 71 }; 72 73 } // namespace trace_event 74 } // namespace base 75 76 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_MEMORY_TEST_UTIL_H_ 77