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 "components/tracing/process_metrics_memory_dump_provider.h" | 5 #include "components/tracing/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 region->size_in_bytes = end_addr - region->start_address; | 53 region->size_in_bytes = end_addr - region->start_address; |
54 } else { | 54 } else { |
55 // This is not just paranoia, it can actually happen (See crbug.com/461237). | 55 // This is not just paranoia, it can actually happen (See crbug.com/461237). |
56 region->size_in_bytes = 0; | 56 region->size_in_bytes = 0; |
57 res = false; | 57 res = false; |
58 } | 58 } |
59 | 59 |
60 region->protection_flags = 0; | 60 region->protection_flags = 0; |
61 if (protection_flags[0] == 'r') { | 61 if (protection_flags[0] == 'r') { |
62 region->protection_flags |= | 62 region->protection_flags |= |
63 base::trace_event::ProcessMemoryMaps::VMRegion::kProtectionFlagsRead; | 63 base::trace_event::ProcessMemoryMaps::VMRegion::kProtectionFlagsRead; |
64 } | 64 } |
65 if (protection_flags[1] == 'w') { | 65 if (protection_flags[1] == 'w') { |
66 region->protection_flags |= | 66 region->protection_flags |= |
67 base::trace_event::ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite; | 67 base::trace_event::ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite; |
68 } | 68 } |
69 if (protection_flags[2] == 'x') { | 69 if (protection_flags[2] == 'x') { |
70 region->protection_flags |= | 70 region->protection_flags |= |
71 base::trace_event::ProcessMemoryMaps::VMRegion::kProtectionFlagsExec; | 71 base::trace_event::ProcessMemoryMaps::VMRegion::kProtectionFlagsExec; |
| 72 } |
| 73 if (protection_flags[3] == 's') { |
| 74 region->protection_flags |= |
| 75 base::trace_event::ProcessMemoryMaps::VMRegion::kProtectionFlagsMayshare; |
72 } | 76 } |
73 | 77 |
74 region->mapped_file = mapped_file; | 78 region->mapped_file = mapped_file; |
75 base::TrimWhitespaceASCII(region->mapped_file, base::TRIM_ALL, | 79 base::TrimWhitespaceASCII(region->mapped_file, base::TRIM_ALL, |
76 ®ion->mapped_file); | 80 ®ion->mapped_file); |
77 | 81 |
78 return res; | 82 return res; |
79 } | 83 } |
80 | 84 |
81 uint64_t ReadCounterBytes(char* counter_line) { | 85 uint64_t ReadCounterBytes(char* counter_line) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 300 |
297 pmd->process_totals()->set_resident_set_bytes(rss_bytes); | 301 pmd->process_totals()->set_resident_set_bytes(rss_bytes); |
298 pmd->set_has_process_totals(); | 302 pmd->set_has_process_totals(); |
299 pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes); | 303 pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes); |
300 | 304 |
301 // Returns true even if other metrics failed, since rss is reported. | 305 // Returns true even if other metrics failed, since rss is reported. |
302 return true; | 306 return true; |
303 } | 307 } |
304 | 308 |
305 } // namespace tracing | 309 } // namespace tracing |
OLD | NEW |