|
39 | 39 | // The MemoryFileTracker tracks memory of 'memory files',
|
40 | 40 | // storage with its own memory space separate from the process.
|
41 | 41 | // A typical example of such a file is a memory mapped file.
|
| 42 | +// All memory is accounted as committed, there is no reserved memory. |
| 43 | +// Any reserved memory is expected to exist in the VirtualMemoryTracker. |
42 | 44 | class MemoryFileTracker {
|
43 | 45 | friend class NMTMemoryFileTrackerTest;
|
44 | 46 |
|
@@ -72,6 +74,16 @@ class MemoryFileTracker {
|
72 | 74 | MemoryFile* make_file(const char* descriptive_name);
|
73 | 75 | void free_file(MemoryFile* file);
|
74 | 76 |
|
| 77 | + template<typename F> |
| 78 | + void iterate_summary(F f) const { |
| 79 | + for (int d = 0; d < _files.length(); d++) { |
| 80 | + const MemoryFile* file = _files.at(d); |
| 81 | + for (int i = 0; i < mt_number_of_tags; i++) { |
| 82 | + f(NMTUtil::index_to_tag(i), file->_summary.by_type(NMTUtil::index_to_tag(i))); |
| 83 | + } |
| 84 | + } |
| 85 | + } |
| 86 | + |
75 | 87 | void summary_snapshot(VirtualMemorySnapshot* snapshot) const;
|
76 | 88 |
|
77 | 89 | // Print detailed report of file
|
@@ -99,6 +111,11 @@ class MemoryFileTracker {
|
99 | 111 | const NativeCallStack& stack, MemTag mem_tag);
|
100 | 112 | static void free_memory(MemoryFile* device, size_t offset, size_t size);
|
101 | 113 |
|
| 114 | + template<typename F> |
| 115 | + static void iterate_summary(F f) { |
| 116 | + _tracker->iterate_summary(f); |
| 117 | + }; |
| 118 | + |
102 | 119 | static void summary_snapshot(VirtualMemorySnapshot* snapshot);
|
103 | 120 |
|
104 | 121 | static void print_report_on(const MemoryFile* device, outputStream* stream, size_t scale);
|
|
0 commit comments