OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <fcntl.h> | 5 #include <fcntl.h> |
6 #include <signal.h> | 6 #include <signal.h> |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <cstring> | 11 #include <cstring> |
12 #include <fstream> | 12 #include <fstream> |
13 #include <iostream> | 13 #include <iostream> |
14 #include <string> | 14 #include <string> |
15 #include <utility> | 15 #include <utility> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
19 #include "base/bind.h" | 19 #include "base/bind.h" |
20 #include "base/bind_helpers.h" | 20 #include "base/bind_helpers.h" |
21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
22 #include "base/hash_tables.h" | 22 #include "base/hash_tables.h" |
23 #include "base/logging.h" | 23 #include "base/logging.h" |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "base/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
26 #include "base/stringprintf.h" | |
27 #include "base/strings/string_piece.h" | 26 #include "base/strings/string_piece.h" |
28 #include "base/strings/string_split.h" | 27 #include "base/strings/string_split.h" |
| 28 #include "base/strings/stringprintf.h" |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // An entry in /proc/<pid>/pagemap. | 32 // An entry in /proc/<pid>/pagemap. |
33 struct PageMapEntry { | 33 struct PageMapEntry { |
34 uint64 page_frame_number : 55; | 34 uint64 page_frame_number : 55; |
35 uint unused : 8; | 35 uint unused : 8; |
36 uint present : 1; | 36 uint present : 1; |
37 }; | 37 }; |
38 | 38 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 &processes_memory[it - pids.begin()]; | 353 &processes_memory[it - pids.begin()]; |
354 process_memory->pid = *it; | 354 process_memory->pid = *it; |
355 if (!CollectProcessMemoryInformation(page_count_fd, process_memory)) | 355 if (!CollectProcessMemoryInformation(page_count_fd, process_memory)) |
356 return EXIT_FAILURE; | 356 return EXIT_FAILURE; |
357 } | 357 } |
358 } | 358 } |
359 ClassifyPages(&processes_memory); | 359 ClassifyPages(&processes_memory); |
360 DumpProcessesMemoryMaps(processes_memory); | 360 DumpProcessesMemoryMaps(processes_memory); |
361 return EXIT_SUCCESS; | 361 return EXIT_SUCCESS; |
362 } | 362 } |
OLD | NEW |