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

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

Issue 2674973004: mac: Emit dyld info from the memory dump provider. (Closed)
Patch Set: Use initprot instead of maxprot. 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 base::trace_event::MemoryDumpArgs args; 281 base::trace_event::MemoryDumpArgs args;
282 base::trace_event::ProcessMemoryDump dump(nullptr, args); 282 base::trace_event::ProcessMemoryDump dump(nullptr, args);
283 ASSERT_TRUE(mdp.DumpProcessMemoryMaps(args, &dump)); 283 ASSERT_TRUE(mdp.DumpProcessMemoryMaps(args, &dump));
284 ASSERT_TRUE(dump.has_process_mmaps()); 284 ASSERT_TRUE(dump.has_process_mmaps());
285 uint32_t size = 100; 285 uint32_t size = 100;
286 char full_path[size]; 286 char full_path[size];
287 int result = _NSGetExecutablePath(full_path, &size); 287 int result = _NSGetExecutablePath(full_path, &size);
288 ASSERT_EQ(0, result); 288 ASSERT_EQ(0, result);
289 std::string name = basename(full_path); 289 std::string name = basename(full_path);
290 290
291 bool found_components_unittests = false; 291 uint64_t components_unittests_resident_pages = 0;
292 bool found_appkit = false;
292 for (const VMRegion& region : dump.process_mmaps()->vm_regions()) { 293 for (const VMRegion& region : dump.process_mmaps()->vm_regions()) {
293 EXPECT_NE(0u, region.start_address); 294 EXPECT_NE(0u, region.start_address);
294 EXPECT_NE(0u, region.size_in_bytes); 295 EXPECT_NE(0u, region.size_in_bytes);
295 296
296 EXPECT_LT(region.size_in_bytes, 1ull << 32); 297 EXPECT_LT(region.size_in_bytes, 1ull << 32);
297 uint32_t required_protection_flags = 298 uint32_t required_protection_flags =
298 VMRegion::kProtectionFlagsRead | VMRegion::kProtectionFlagsExec; 299 VMRegion::kProtectionFlagsRead | VMRegion::kProtectionFlagsExec;
299 if (region.mapped_file.find(name) != std::string::npos && 300 if (region.mapped_file.find(name) != std::string::npos &&
300 region.protection_flags == required_protection_flags) { 301 region.protection_flags == required_protection_flags) {
301 found_components_unittests = true; 302 components_unittests_resident_pages +=
303 region.byte_stats_private_dirty_resident +
304 region.byte_stats_shared_dirty_resident +
305 region.byte_stats_private_clean_resident +
306 region.byte_stats_shared_clean_resident;
307 }
308
309 if (region.mapped_file.find("AppKit") != std::string::npos) {
310 found_appkit = true;
302 } 311 }
303 } 312 }
304 EXPECT_TRUE(found_components_unittests); 313 EXPECT_GT(components_unittests_resident_pages, 0u);
314 EXPECT_TRUE(found_appkit);
305 } 315 }
306 #endif // defined(OS_MACOSX) 316 #endif // defined(OS_MACOSX)
307 317
308 } // namespace tracing 318 } // 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