OLD | NEW |
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 Loading... |
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 not enable periodic dumps. | 983 // a coordinator process should enable periodic dumps. |
984 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory); | 984 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory); |
985 EXPECT_FALSE(IsPeriodicDumpingEnabled()); | 985 EXPECT_TRUE(IsPeriodicDumpingEnabled()); |
986 DisableTracing(); | 986 DisableTracing(); |
987 | 987 |
988 // Enabling memory-infra with the new (JSON) TraceConfig in a coordinator | 988 // Enabling memory-infra with the new (JSON) TraceConfig in a coordinator |
989 // process while specifying a "memory_dump_config" section should enable | 989 // process without specifying any "memory_dump_config" section should enable |
990 // periodic dumps. This is to preserve the behavior chrome://tracing UI, that | 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. | 991 // is: ticking memory-infra should dump periodically with the default config. |
992 EnableTracingWithTraceConfig( | 992 EnableTracingWithTraceConfig( |
993 TraceConfigMemoryTestUtil::GetTraceConfig_PeriodicTriggers(100, 5)); | 993 TraceConfigMemoryTestUtil::GetTraceConfig_NoTriggers()); |
994 EXPECT_TRUE(IsPeriodicDumpingEnabled()); | 994 EXPECT_TRUE(IsPeriodicDumpingEnabled()); |
995 DisableTracing(); | 995 DisableTracing(); |
996 | 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()); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |