| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 for (size_t i = 0; i < page_count; i++) { | 109 for (size_t i = 0; i < page_count; i++) { |
| 110 vec[i].VirtualAddress = | 110 vec[i].VirtualAddress = |
| 111 reinterpret_cast<void*>(chunk_start + i * page_size); | 111 reinterpret_cast<void*>(chunk_start + i * page_size); |
| 112 } | 112 } |
| 113 DWORD vec_size = static_cast<DWORD>( | 113 DWORD vec_size = static_cast<DWORD>( |
| 114 page_count * sizeof(PSAPI_WORKING_SET_EX_INFORMATION)); | 114 page_count * sizeof(PSAPI_WORKING_SET_EX_INFORMATION)); |
| 115 failure = !QueryWorkingSetEx(GetCurrentProcess(), vec.get(), vec_size); | 115 failure = !QueryWorkingSetEx(GetCurrentProcess(), vec.get(), vec_size); |
| 116 | 116 |
| 117 for (size_t i = 0; i < page_count; i++) | 117 for (size_t i = 0; i < page_count; i++) |
| 118 resident_page_count += vec[i].VirtualAttributes.Valid; | 118 resident_page_count += vec[i].VirtualAttributes.Valid; |
| 119 #elif defined(OS_FUCHSIA) |
| 120 // TODO(fuchsia): Port, see https://crbug.com/706592. |
| 121 ALLOW_UNUSED_LOCAL(chunk_start); |
| 122 ALLOW_UNUSED_LOCAL(page_count); |
| 119 #elif defined(OS_POSIX) | 123 #elif defined(OS_POSIX) |
| 120 int error_counter = 0; | 124 int error_counter = 0; |
| 121 int result = 0; | 125 int result = 0; |
| 122 // HANDLE_EINTR tries for 100 times. So following the same pattern. | 126 // HANDLE_EINTR tries for 100 times. So following the same pattern. |
| 123 do { | 127 do { |
| 124 result = | 128 result = |
| 125 #if defined(OS_AIX) | 129 #if defined(OS_AIX) |
| 126 mincore(reinterpret_cast<char*>(chunk_start), chunk_size, | 130 mincore(reinterpret_cast<char*>(chunk_start), chunk_size, |
| 127 reinterpret_cast<char*>(vec.get())); | 131 reinterpret_cast<char*>(vec.get())); |
| 128 #else | 132 #else |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 378 |
| 375 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { | 379 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { |
| 376 DCHECK(is_black_hole_non_fatal_for_testing_); | 380 DCHECK(is_black_hole_non_fatal_for_testing_); |
| 377 if (!black_hole_mad_) | 381 if (!black_hole_mad_) |
| 378 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); | 382 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); |
| 379 return black_hole_mad_.get(); | 383 return black_hole_mad_.get(); |
| 380 } | 384 } |
| 381 | 385 |
| 382 } // namespace trace_event | 386 } // namespace trace_event |
| 383 } // namespace base | 387 } // namespace base |
| OLD | NEW |