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