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

Side by Side Diff: components/tracing/common/process_metrics_memory_dump_provider_unittest.cc

Issue 2696923002: Update logic for emitting region information from dyld. (Closed)
Patch Set: Fix comparison operator. Created 3 years, 10 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 | « components/tracing/common/process_metrics_memory_dump_provider.cc ('k') | no next file » | 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 "components/tracing/common/process_metrics_memory_dump_provider.h" 5 #include "components/tracing/common/process_metrics_memory_dump_provider.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 region.byte_stats_shared_clean_resident; 306 region.byte_stats_shared_clean_resident;
307 } 307 }
308 308
309 if (region.mapped_file.find("AppKit") != std::string::npos) { 309 if (region.mapped_file.find("AppKit") != std::string::npos) {
310 found_appkit = true; 310 found_appkit = true;
311 } 311 }
312 } 312 }
313 EXPECT_GT(components_unittests_resident_pages, 0u); 313 EXPECT_GT(components_unittests_resident_pages, 0u);
314 EXPECT_TRUE(found_appkit); 314 EXPECT_TRUE(found_appkit);
315 } 315 }
316
317 TEST(ProcessMetricsMemoryDumpProviderTest, NoDuplicateRegions) {
318 using VMRegion = base::trace_event::ProcessMemoryMaps::VMRegion;
319 ProcessMetricsMemoryDumpProvider mdp(base::kNullProcessId);
320 base::trace_event::MemoryDumpArgs args;
321 base::trace_event::ProcessMemoryDump dump(nullptr, args);
322 ASSERT_TRUE(mdp.DumpProcessMemoryMaps(args, &dump));
323 ASSERT_TRUE(dump.has_process_mmaps());
324
325 std::vector<VMRegion> regions;
326 regions.reserve(dump.process_mmaps()->vm_regions().size());
327 for (const VMRegion& region : dump.process_mmaps()->vm_regions())
328 regions.push_back(region);
329 std::sort(regions.begin(), regions.end(),
330 [](const VMRegion& a, const VMRegion& b) -> bool {
331 return a.start_address < b.start_address;
332 });
333 uint64_t last_address = 0;
334 for (const VMRegion& region : regions) {
335 EXPECT_GE(region.start_address, last_address);
336 last_address = region.start_address + region.size_in_bytes;
337 }
338 }
339
316 #endif // defined(OS_MACOSX) 340 #endif // defined(OS_MACOSX)
317 341
318 } // namespace tracing 342 } // namespace tracing
OLDNEW
« no previous file with comments | « components/tracing/common/process_metrics_memory_dump_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698