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/process_memory_dump.h" | 5 #include "base/trace_event/process_memory_dump.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 failure = !QueryWorkingSetEx(GetCurrentProcess(), vec.get(), vec_size); | 114 failure = !QueryWorkingSetEx(GetCurrentProcess(), vec.get(), vec_size); |
115 | 115 |
116 for (size_t i = 0; i < page_count; i++) | 116 for (size_t i = 0; i < page_count; i++) |
117 resident_page_count += vec[i].VirtualAttributes.Valid; | 117 resident_page_count += vec[i].VirtualAttributes.Valid; |
118 #elif defined(OS_POSIX) | 118 #elif defined(OS_POSIX) |
119 int error_counter = 0; | 119 int error_counter = 0; |
120 int result = 0; | 120 int result = 0; |
121 // HANDLE_EINTR tries for 100 times. So following the same pattern. | 121 // HANDLE_EINTR tries for 100 times. So following the same pattern. |
122 do { | 122 do { |
123 result = | 123 result = |
| 124 #if defined(OS_AIX) |
| 125 mincore(reinterpret_cast<char*>(chunk_start), chunk_size, |
| 126 reinterpret_cast<char*>(vec.get())); |
| 127 #else |
124 mincore(reinterpret_cast<void*>(chunk_start), chunk_size, vec.get()); | 128 mincore(reinterpret_cast<void*>(chunk_start), chunk_size, vec.get()); |
| 129 #endif |
125 } while (result == -1 && errno == EAGAIN && error_counter++ < 100); | 130 } while (result == -1 && errno == EAGAIN && error_counter++ < 100); |
126 failure = !!result; | 131 failure = !!result; |
127 | 132 |
128 for (size_t i = 0; i < page_count; i++) | 133 for (size_t i = 0; i < page_count; i++) |
129 resident_page_count += vec[i] & 1; | 134 resident_page_count += vec[i] & 1; |
130 #endif | 135 #endif |
131 | 136 |
132 if (failure) | 137 if (failure) |
133 break; | 138 break; |
134 | 139 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 363 |
359 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { | 364 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { |
360 DCHECK(is_black_hole_non_fatal_for_testing_); | 365 DCHECK(is_black_hole_non_fatal_for_testing_); |
361 if (!black_hole_mad_) | 366 if (!black_hole_mad_) |
362 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); | 367 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); |
363 return black_hole_mad_.get(); | 368 return black_hole_mad_.get(); |
364 } | 369 } |
365 | 370 |
366 } // namespace trace_event | 371 } // namespace trace_event |
367 } // namespace base | 372 } // namespace base |
OLD | NEW |