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 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_H_ | 5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_H_ |
6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_H_ | 6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 namespace trace_event { | 15 namespace trace_event { |
16 | 16 |
17 class TracedValue; | 17 class TracedValue; |
18 | 18 |
19 // Data model for process-wide memory stats. | 19 // Data model for process-wide memory stats. |
20 class BASE_EXPORT ProcessMemoryMaps { | 20 class BASE_EXPORT ProcessMemoryMaps { |
21 public: | 21 public: |
22 struct VMRegion { | 22 struct BASE_EXPORT VMRegion { |
23 static const uint32 kProtectionFlagsRead; | 23 static const uint32 kProtectionFlagsRead; |
24 static const uint32 kProtectionFlagsWrite; | 24 static const uint32 kProtectionFlagsWrite; |
25 static const uint32 kProtectionFlagsExec; | 25 static const uint32 kProtectionFlagsExec; |
26 | 26 |
| 27 VMRegion(); |
| 28 |
27 uint64 start_address; | 29 uint64 start_address; |
28 uint64 size_in_bytes; | 30 uint64 size_in_bytes; |
29 uint32 protection_flags; | 31 uint32 protection_flags; |
30 std::string mapped_file; | 32 std::string mapped_file; |
31 | 33 |
32 // private_resident + shared_resident = resident set size. | 34 // private_dirty_resident + private_clean_resident + shared_dirty_resident + |
33 uint64 byte_stats_private_resident; | 35 // shared_clean_resident = resident set size. |
34 uint64 byte_stats_shared_resident; | 36 uint64 byte_stats_private_dirty_resident; |
| 37 uint64 byte_stats_private_clean_resident; |
| 38 uint64 byte_stats_shared_dirty_resident; |
| 39 uint64 byte_stats_shared_clean_resident; |
| 40 |
| 41 uint64 byte_stats_swapped; |
35 | 42 |
36 // For multiprocess accounting. | 43 // For multiprocess accounting. |
37 uint64 byte_stats_proportional_resident; | 44 uint64 byte_stats_proportional_resident; |
38 }; | 45 }; |
39 | 46 |
40 ProcessMemoryMaps(); | 47 ProcessMemoryMaps(); |
41 ~ProcessMemoryMaps(); | 48 ~ProcessMemoryMaps(); |
42 | 49 |
43 void AddVMRegion(const VMRegion& region) { vm_regions_.push_back(region); } | 50 void AddVMRegion(const VMRegion& region) { vm_regions_.push_back(region); } |
44 const std::vector<VMRegion>& vm_regions() const { return vm_regions_; } | 51 const std::vector<VMRegion>& vm_regions() const { return vm_regions_; } |
45 | 52 |
46 // Called at trace generation time to populate the TracedValue. | 53 // Called at trace generation time to populate the TracedValue. |
47 void AsValueInto(TracedValue* value) const; | 54 void AsValueInto(TracedValue* value) const; |
48 | 55 |
| 56 // Clears up all the VMRegion(s) stored. |
| 57 void Clear(); |
| 58 |
49 private: | 59 private: |
50 std::vector<VMRegion> vm_regions_; | 60 std::vector<VMRegion> vm_regions_; |
51 | 61 |
52 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMaps); | 62 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMaps); |
53 }; | 63 }; |
54 | 64 |
55 } // namespace trace_event | 65 } // namespace trace_event |
56 } // namespace base | 66 } // namespace base |
57 | 67 |
58 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_H_ | 68 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_H_ |
OLD | NEW |