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

Unified Diff: base/trace_event/memory_infra_background_whitelist.cc

Issue 2876543002: memory-infra: Don't invoke all dump providers in SUMMARY_ONLY mode (Closed)
Patch Set: address comments Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: base/trace_event/memory_infra_background_whitelist.cc
diff --git a/base/trace_event/memory_infra_background_whitelist.cc b/base/trace_event/memory_infra_background_whitelist.cc
index 746068a7b1edf227af4153b16b6783b98378658e..d5783d062c8b032e2958b0a2e4b4e2477573a13b 100644
--- a/base/trace_event/memory_infra_background_whitelist.cc
+++ b/base/trace_event/memory_infra_background_whitelist.cc
@@ -40,6 +40,12 @@ const char* const kDumpProviderWhitelist[] = {
nullptr // End of list marker.
};
+// The names of dump providers whitelisted for summary tracing.
+const char* const kDumpProviderSummaryWhitelist[] = {
+ "Malloc", "PartitionAlloc", "ProcessMemoryMetrics", "V8Isolate",
+ nullptr // End of list marker.
+};
+
// A list of string names that are allowed for the memory allocator dumps in
// background mode.
const char* const kAllocatorDumpNameWhitelist[] = {
@@ -205,19 +211,30 @@ const char* const kAllocatorDumpNameWhitelist[] = {
};
const char* const* g_dump_provider_whitelist = kDumpProviderWhitelist;
+const char* const* g_dump_provider_whitelist_for_summary =
+ kDumpProviderSummaryWhitelist;
const char* const* g_allocator_dump_name_whitelist =
kAllocatorDumpNameWhitelist;
-} // namespace
-
-bool IsMemoryDumpProviderWhitelisted(const char* mdp_name) {
- for (size_t i = 0; g_dump_provider_whitelist[i] != nullptr; ++i) {
- if (strcmp(mdp_name, g_dump_provider_whitelist[i]) == 0)
+bool IsMemoryDumpProviderInList(const char* mdp_name, const char* const* list) {
+ for (size_t i = 0; list[i] != nullptr; ++i) {
+ if (strcmp(mdp_name, list[i]) == 0)
return true;
}
return false;
}
+} // namespace
+
+bool IsMemoryDumpProviderWhitelisted(const char* mdp_name) {
+ return IsMemoryDumpProviderInList(mdp_name, g_dump_provider_whitelist);
+}
+
+bool IsMemoryDumpProviderWhitelistedForSummary(const char* mdp_name) {
+ return IsMemoryDumpProviderInList(mdp_name,
+ g_dump_provider_whitelist_for_summary);
+}
+
bool IsMemoryAllocatorDumpNameWhitelisted(const std::string& name) {
// Remove special characters, numbers (including hexadecimal which are marked
// by '0x') from the given string.
@@ -250,6 +267,10 @@ void SetDumpProviderWhitelistForTesting(const char* const* list) {
g_dump_provider_whitelist = list;
}
+void SetDumpProviderSummaryWhitelistForTesting(const char* const* list) {
+ g_dump_provider_whitelist_for_summary = list;
+}
+
void SetAllocatorDumpNameWhitelistForTesting(const char* const* list) {
g_allocator_dump_name_whitelist = list;
}
« no previous file with comments | « base/trace_event/memory_infra_background_whitelist.h ('k') | base/trace_event/memory_peak_detector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698