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

Side by Side Diff: base/trace_event/memory_dump_manager_unittest.cc

Issue 2912483002: Change memory dumps to not use periodic dumps by default. (Closed)
Patch Set: Comments from ssid. Created 3 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 | « no previous file | base/trace_event/trace_config.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 #include "base/trace_event/memory_dump_manager.h" 5 #include "base/trace_event/memory_dump_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 EXPECT_FALSE(IsPeriodicDumpingEnabled()); 973 EXPECT_FALSE(IsPeriodicDumpingEnabled());
974 DisableTracing(); 974 DisableTracing();
975 } 975 }
976 976
977 TEST_F(MemoryDumpManagerTest, TraceConfigExpectationsWhenIsCoordinator) { 977 TEST_F(MemoryDumpManagerTest, TraceConfigExpectationsWhenIsCoordinator) {
978 InitializeMemoryDumpManager(true /* is_coordinator */); 978 InitializeMemoryDumpManager(true /* is_coordinator */);
979 ON_CALL(global_dump_handler_, RequestGlobalMemoryDump(_, _)) 979 ON_CALL(global_dump_handler_, RequestGlobalMemoryDump(_, _))
980 .WillByDefault(Return()); 980 .WillByDefault(Return());
981 981
982 // Enabling memory-infra with the legacy TraceConfig (category filter) in 982 // Enabling memory-infra with the legacy TraceConfig (category filter) in
983 // a coordinator process should enable periodic dumps. 983 // a coordinator process should not enable periodic dumps.
984 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory); 984 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory);
985 EXPECT_FALSE(IsPeriodicDumpingEnabled());
986 DisableTracing();
987
988 // Enabling memory-infra with the new (JSON) TraceConfig in a coordinator
989 // process while specifying a "memory_dump_config" section should enable
990 // periodic dumps. This is to preserve the behavior chrome://tracing UI, that
991 // is: ticking memory-infra should dump periodically with an explicit config.
992 EnableTracingWithTraceConfig(
993 TraceConfigMemoryTestUtil::GetTraceConfig_PeriodicTriggers(100, 5));
985 EXPECT_TRUE(IsPeriodicDumpingEnabled()); 994 EXPECT_TRUE(IsPeriodicDumpingEnabled());
986 DisableTracing(); 995 DisableTracing();
987 996
988 // Enabling memory-infra with the new (JSON) TraceConfig in a coordinator
989 // process without specifying any "memory_dump_config" section should enable
990 // periodic dumps. This is to preserve the behavior chrome://tracing UI, that
991 // is: ticking memory-infra should dump periodically with the default config.
992 EnableTracingWithTraceConfig(
993 TraceConfigMemoryTestUtil::GetTraceConfig_NoTriggers());
994 EXPECT_TRUE(IsPeriodicDumpingEnabled());
995 DisableTracing();
996
997 // Enabling memory-infra with the new (JSON) TraceConfig in a coordinator 997 // Enabling memory-infra with the new (JSON) TraceConfig in a coordinator
998 // process with an empty "memory_dump_config" should NOT enable periodic 998 // process with an empty "memory_dump_config" should NOT enable periodic
999 // dumps. This is the way telemetry is supposed to use memory-infra with 999 // dumps. This is the way telemetry is supposed to use memory-infra with
1000 // only explicitly triggered dumps. 1000 // only explicitly triggered dumps.
1001 EnableTracingWithTraceConfig( 1001 EnableTracingWithTraceConfig(
1002 TraceConfigMemoryTestUtil::GetTraceConfig_EmptyTriggers()); 1002 TraceConfigMemoryTestUtil::GetTraceConfig_EmptyTriggers());
1003 EXPECT_FALSE(IsPeriodicDumpingEnabled()); 1003 EXPECT_FALSE(IsPeriodicDumpingEnabled());
1004 DisableTracing(); 1004 DisableTracing();
1005 1005
1006 // Enabling memory-infra with the new (JSON) TraceConfig in a coordinator 1006 // Enabling memory-infra with the new (JSON) TraceConfig in a coordinator
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 EXPECT_EQ(3u, result.chrome_dump.v8_total_kb); 1402 EXPECT_EQ(3u, result.chrome_dump.v8_total_kb);
1403 // partition_alloc has partition_alloc/allocated_objects/* which is a subset 1403 // partition_alloc has partition_alloc/allocated_objects/* which is a subset
1404 // of partition_alloc/partitions/* so we only count the latter. 1404 // of partition_alloc/partitions/* so we only count the latter.
1405 EXPECT_EQ(4u, result.chrome_dump.partition_alloc_total_kb); 1405 EXPECT_EQ(4u, result.chrome_dump.partition_alloc_total_kb);
1406 // resident_set_kb should read from process_totals. 1406 // resident_set_kb should read from process_totals.
1407 EXPECT_EQ(5u, result.os_dump.resident_set_kb); 1407 EXPECT_EQ(5u, result.os_dump.resident_set_kb);
1408 }; 1408 };
1409 1409
1410 } // namespace trace_event 1410 } // namespace trace_event
1411 } // namespace base 1411 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698