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

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

Issue 2674973004: mac: Emit dyld info from the memory dump provider. (Closed)
Patch Set: 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 | « no previous file | 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 <fcntl.h> 7 #include <fcntl.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 10 matching lines...) Expand all
21 #include "base/trace_event/memory_dump_manager.h" 21 #include "base/trace_event/memory_dump_manager.h"
22 #include "base/trace_event/process_memory_dump.h" 22 #include "base/trace_event/process_memory_dump.h"
23 #include "base/trace_event/process_memory_maps.h" 23 #include "base/trace_event/process_memory_maps.h"
24 #include "base/trace_event/process_memory_totals.h" 24 #include "base/trace_event/process_memory_totals.h"
25 #include "build/build_config.h" 25 #include "build/build_config.h"
26 26
27 #if defined(OS_MACOSX) 27 #if defined(OS_MACOSX)
28 #include <libproc.h> 28 #include <libproc.h>
29 #include <mach/mach.h> 29 #include <mach/mach.h>
30 #include <mach/mach_vm.h> 30 #include <mach/mach_vm.h>
31 #include <mach/shared_region.h>
31 #include <sys/param.h> 32 #include <sys/param.h>
32 33
33 #include "base/numerics/safe_math.h" 34 #include "base/numerics/safe_math.h"
34 #endif // defined(OS_MACOSX) 35 #endif // defined(OS_MACOSX)
35 36
36 namespace tracing { 37 namespace tracing {
37 38
38 namespace { 39 namespace {
39 40
40 base::LazyInstance< 41 base::LazyInstance<
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return false; 251 return false;
251 if (info.is_submap) { 252 if (info.is_submap) {
252 size = 0; 253 size = 0;
253 ++depth; 254 ++depth;
254 continue; 255 continue;
255 } 256 }
256 257
257 if (info.share_mode == SM_COW && info.ref_count == 1) 258 if (info.share_mode == SM_COW && info.ref_count == 1)
258 info.share_mode = SM_PRIVATE; 259 info.share_mode = SM_PRIVATE;
259 260
261 // Ignore regions in the dyld shared cache.
Mark Mentovai 2017/02/03 23:17:13 Anyone can come along and map something else in th
262 if (address >= SHARED_REGION_BASE_X86_64 &&
263 address < (SHARED_REGION_BASE_X86_64 + SHARED_REGION_SIZE_X86_64) &&
264 info.share_mode != SM_PRIVATE) {
265 continue;
266 }
267
260 VMRegion region; 268 VMRegion region;
261 uint64_t dirty_bytes = info.pages_dirtied * PAGE_SIZE; 269 uint64_t dirty_bytes = info.pages_dirtied * PAGE_SIZE;
262 uint64_t clean_bytes = 270 uint64_t clean_bytes =
263 (info.pages_resident - info.pages_reusable - info.pages_dirtied) * 271 (info.pages_resident - info.pages_reusable - info.pages_dirtied) *
264 PAGE_SIZE; 272 PAGE_SIZE;
265 switch (info.share_mode) { 273 switch (info.share_mode) {
266 case SM_LARGE_PAGE: 274 case SM_LARGE_PAGE:
267 case SM_PRIVATE: 275 case SM_PRIVATE:
268 region.byte_stats_private_dirty_resident = dirty_bytes; 276 region.byte_stats_private_dirty_resident = dirty_bytes;
269 region.byte_stats_private_clean_resident = clean_bytes; 277 region.byte_stats_private_clean_resident = clean_bytes;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 #endif 471 #endif
464 } 472 }
465 473
466 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { 474 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() {
467 #if defined(OS_LINUX) || defined(OS_ANDROID) 475 #if defined(OS_LINUX) || defined(OS_ANDROID)
468 fast_polling_statm_fd_.reset(); 476 fast_polling_statm_fd_.reset();
469 #endif 477 #endif
470 } 478 }
471 479
472 } // namespace tracing 480 } // namespace tracing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698