Chromium Code Reviews

Side by Side Diff: components/discardable_memory/common/discardable_shared_memory_heap.h

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: (wip) Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_DISCARDABLE_MEMORY_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_ 5 #ifndef COMPONENTS_DISCARDABLE_MEMORY_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
6 #define COMPONENTS_DISCARDABLE_MEMORY_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_ 6 #define COMPONENTS_DISCARDABLE_MEMORY_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 78 matching lines...)
89 89
90 // Returns total bytes of memory in heap. 90 // Returns total bytes of memory in heap.
91 size_t GetSize() const; 91 size_t GetSize() const;
92 92
93 // Returns bytes of memory currently in the free lists. 93 // Returns bytes of memory currently in the free lists.
94 size_t GetSizeOfFreeLists() const; 94 size_t GetSizeOfFreeLists() const;
95 95
96 // Dumps memory statistics for chrome://tracing. 96 // Dumps memory statistics for chrome://tracing.
97 bool OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd); 97 bool OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd);
98 98
99 // Returns a unique identifier for a given tuple of (process id, segment id)
100 // that can be used to match memory dumps across different processes.
101 static base::trace_event::MemoryAllocatorDumpGuid GetSegmentGUIDForTracing(
102 uint64_t tracing_process_id,
103 int32_t segment_id);
104
105 // Returns a MemoryAllocatorDump for a given span on |pmd| with the size of 99 // Returns a MemoryAllocatorDump for a given span on |pmd| with the size of
106 // the span. 100 // the span.
107 base::trace_event::MemoryAllocatorDump* CreateMemoryAllocatorDump( 101 base::trace_event::MemoryAllocatorDump* CreateMemoryAllocatorDump(
108 Span* span, 102 Span* span,
109 const char* name, 103 const char* name,
110 base::trace_event::ProcessMemoryDump* pmd) const; 104 base::trace_event::ProcessMemoryDump* pmd) const;
111 105
112 private: 106 private:
113 class ScopedMemorySegment { 107 class ScopedMemorySegment {
114 public: 108 public:
(...skipping 62 matching lines...)
177 // is a free list of runs that consist of k blocks. The 256th entry is a 171 // is a free list of runs that consist of k blocks. The 256th entry is a
178 // free list of runs that have length >= 256 blocks. 172 // free list of runs that have length >= 256 blocks.
179 base::LinkedList<Span> free_spans_[256]; 173 base::LinkedList<Span> free_spans_[256];
180 174
181 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemoryHeap); 175 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemoryHeap);
182 }; 176 };
183 177
184 } // namespace discardable_memory 178 } // namespace discardable_memory
185 179
186 #endif // COMPONENTS_DISCARDABLE_MEMORY_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H _ 180 #endif // COMPONENTS_DISCARDABLE_MEMORY_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H _
OLDNEW

Powered by Google App Engine