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_TOTALS_H_ | 5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_H_ |
6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_H_ | 6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 14 matching lines...) Expand all Loading... | |
25 | 25 |
26 // Called at trace generation time to populate the TracedValue. | 26 // Called at trace generation time to populate the TracedValue. |
27 void AsValueInto(TracedValue* value) const; | 27 void AsValueInto(TracedValue* value) const; |
28 | 28 |
29 // Clears up all the data collected. | 29 // Clears up all the data collected. |
30 void Clear(); | 30 void Clear(); |
31 | 31 |
32 uint64_t resident_set_bytes() const { return resident_set_bytes_; } | 32 uint64_t resident_set_bytes() const { return resident_set_bytes_; } |
33 void set_resident_set_bytes(uint64_t value) { resident_set_bytes_ = value; } | 33 void set_resident_set_bytes(uint64_t value) { resident_set_bytes_ = value; } |
34 | 34 |
35 uint64_t private_footprint_precursor() const { | |
Primiano Tucci (use gerrit)
2017/04/25 12:43:35
I'd:
just call this private_footprint_bytes() and
| |
36 return private_footprint_precursor_; | |
37 } | |
38 void set_private_footprint_precursor(uint64_t value) { | |
39 private_footprint_precursor_ = value; | |
40 } | |
41 | |
35 uint64_t peak_resident_set_bytes() const { return peak_resident_set_bytes_; } | 42 uint64_t peak_resident_set_bytes() const { return peak_resident_set_bytes_; } |
36 void set_peak_resident_set_bytes(uint64_t value) { | 43 void set_peak_resident_set_bytes(uint64_t value) { |
37 peak_resident_set_bytes_ = value; | 44 peak_resident_set_bytes_ = value; |
38 } | 45 } |
39 | 46 |
40 // On some platforms (recent linux kernels, see goo.gl/sMvAVz) the peak rss | 47 // On some platforms (recent linux kernels, see goo.gl/sMvAVz) the peak rss |
41 // can be reset. When is_peak_rss_resettable == true, the peak refers to | 48 // can be reset. When is_peak_rss_resettable == true, the peak refers to |
42 // peak from the previous measurement. When false, it is the absolute peak | 49 // peak from the previous measurement. When false, it is the absolute peak |
43 // since the start of the process. | 50 // since the start of the process. |
44 bool is_peak_rss_resetable() const { return is_peak_rss_resetable_; } | 51 bool is_peak_rss_resetable() const { return is_peak_rss_resetable_; } |
45 void set_is_peak_rss_resetable(bool value) { is_peak_rss_resetable_ = value; } | 52 void set_is_peak_rss_resetable(bool value) { is_peak_rss_resetable_ = value; } |
46 | 53 |
47 void SetExtraFieldInBytes(const char* name, uint64_t value); | 54 void SetExtraFieldInBytes(const char* name, uint64_t value); |
48 | 55 |
49 private: | 56 private: |
50 uint64_t resident_set_bytes_; | 57 uint64_t resident_set_bytes_; |
51 uint64_t peak_resident_set_bytes_; | 58 uint64_t peak_resident_set_bytes_; |
52 bool is_peak_rss_resetable_; | 59 bool is_peak_rss_resetable_; |
53 | 60 |
61 // Number of bytes in a platform-specific precursor that will be used to | |
62 // compute the private memory footprint. Not emitted in the trace as its value | |
63 // is platform-dependent. The meaning of the precursor depends on the OS. | |
64 // On macOS 10.12+, | |
65 // task_info(...TASK_VM_INFO...).phys_footprint | |
66 // On macOS 10.11 and older, | |
67 // task_info(...TASK_VM_INFO...).internal + | |
68 // task_info(...TASK_VM_INFO...).compressed | |
69 // On Linux, Android and ChromeOS, | |
70 // RssAnon + VmSwap from /proc/pid/status | |
71 // TODO(hjd): https://crbug.com/707019 | |
72 // On Windows, | |
73 // TBD: https://crbug.com/707022 | |
74 // On iOS, | |
75 // TBD: https://crbug.com/714961 | |
76 uint64_t private_footprint_precursor_; | |
Wez
2017/04/25 17:47:19
As discussed on Slack: "precursor" isn't quite the
| |
77 | |
54 // Extra metrics for OS-specific statistics. | 78 // Extra metrics for OS-specific statistics. |
55 std::map<const char*, uint64_t> extra_fields_; | 79 std::map<const char*, uint64_t> extra_fields_; |
56 | 80 |
57 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryTotals); | 81 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryTotals); |
58 }; | 82 }; |
59 | 83 |
60 } // namespace trace_event | 84 } // namespace trace_event |
61 } // namespace base | 85 } // namespace base |
62 | 86 |
63 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_H_ | 87 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_H_ |
OLD | NEW |