Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: content/common/discardable_shared_memory_heap.h

Issue 1100073004: Adding discardable memory dump provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/discardable_shared_memory_heap.h
diff --git a/content/common/discardable_shared_memory_heap.h b/content/common/discardable_shared_memory_heap.h
index 23b9cfb87d237dc1a4016dc029a0086aaf05fca1..a9248605098757e8162d5da1622a9d407bc607fa 100644
--- a/content/common/discardable_shared_memory_heap.h
+++ b/content/common/discardable_shared_memory_heap.h
@@ -5,6 +5,8 @@
#ifndef CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
#define CONTENT_COMMON_DISCARDABLE_SHARED_MEMORY_HEAP_H_
+#include <vector>
+
#include "base/callback.h"
#include "base/containers/hash_tables.h"
#include "base/containers/linked_list.h"
@@ -44,6 +46,25 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap {
DISALLOW_COPY_AND_ASSIGN(Span);
};
+ class CONTENT_EXPORT MemoryStatistics {
Primiano Tucci (use gerrit) 2015/04/23 16:11:55 do you really need CONTENT_EXPORT here?
ssid 2015/04/24 11:23:04 No, removed.
+ public:
+ class SegmentStatistics {
Primiano Tucci (use gerrit) 2015/04/23 16:11:55 make this a struct and remove public:
ssid 2015/04/24 11:23:04 Changed.
+ public:
+ size_t size;
+ size_t num_of_objects;
+ size_t used_size;
+ };
+
+ MemoryStatistics();
+ ~MemoryStatistics();
+
+ size_t block_size;
+ size_t total_size;
+ size_t total_objects;
+ size_t total_used_size;
+ std::vector<SegmentStatistics> segments_stats;
+ };
+
explicit DiscardableSharedMemoryHeap(size_t block_size);
~DiscardableSharedMemoryHeap();
@@ -83,6 +104,9 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap {
// Returns bytes of memory currently in the free lists.
size_t GetSizeOfFreeLists() const;
+ // Fills statistics about memory used.
+ void GetMemoryStatistics(MemoryStatistics* statistics);
reveman 2015/04/23 17:32:30 Why don't we just add "void DumpInto(base::trace_e
ssid 2015/04/23 18:03:07 This sounds like a good idea, since later we would
+
private:
class ScopedMemorySegment {
public:
@@ -95,6 +119,8 @@ class CONTENT_EXPORT DiscardableSharedMemoryHeap {
bool IsUsed() const;
bool IsResident() const;
+ void GetStatistics(MemoryStatistics::SegmentStatistics* segment_stats);
+
private:
DiscardableSharedMemoryHeap* const heap_;
scoped_ptr<base::DiscardableSharedMemory> shared_memory_;

Powered by Google App Engine
This is Rietveld 408576698