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

Unified Diff: base/trace_event/process_memory_dump.h

Issue 2911263003: [memory-infra] Add method to override importance of ownership edges (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « base/trace_event/memory_allocator_dump_guid.h ('k') | base/trace_event/process_memory_dump.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/process_memory_dump.h
diff --git a/base/trace_event/process_memory_dump.h b/base/trace_event/process_memory_dump.h
index 45a973964231fa7d794b2be72d3175871970720b..83ef2eb837610d5ed1c091798df9f3403a9cc295 100644
--- a/base/trace_event/process_memory_dump.h
+++ b/base/trace_event/process_memory_dump.h
@@ -39,10 +39,10 @@ class TracedValue;
class BASE_EXPORT ProcessMemoryDump {
public:
struct MemoryAllocatorDumpEdge {
- MemoryAllocatorDumpGuid source;
MemoryAllocatorDumpGuid target;
int importance;
const char* type;
+ bool overridable;
};
// Maps allocator dumps absolute names (allocator_name/heap/subheap) to
@@ -53,6 +53,9 @@ class BASE_EXPORT ProcessMemoryDump {
using HeapDumpsMap =
std::unordered_map<std::string, std::unique_ptr<TracedValue>>;
+ using AllocatorDumpEdgesMap =
+ std::unordered_map<MemoryAllocatorDumpGuid, MemoryAllocatorDumpEdge>;
hajimehoshi 2017/05/31 05:45:51 Just std::map might be better (See /base/container
ssid 2017/06/02 23:14:46 Done
+
#if defined(COUNT_RESIDENT_BYTES_SUPPORTED)
// Returns the number of bytes in a kernel memory page. Some platforms may
// have a different value for kernel page sizes from user page sizes. It is
@@ -135,7 +138,14 @@ class BASE_EXPORT ProcessMemoryDump {
void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source,
const MemoryAllocatorDumpGuid& target);
- const std::vector<MemoryAllocatorDumpEdge>& allocator_dumps_edges() const {
+ void CreateSharedMemoryOwnershipEdge(
+ const MemoryAllocatorDumpGuid& client_dump_guid,
+ const MemoryAllocatorDumpGuid& client_global_dump_guid,
+ bool is_weak,
+ int importance,
+ uint64_t shm_unguessable_token);
+
+ const AllocatorDumpEdgesMap& allocator_dumps_edges_for_testing() const {
return allocator_dumps_edges_;
}
@@ -181,12 +191,17 @@ class BASE_EXPORT ProcessMemoryDump {
private:
FRIEND_TEST_ALL_PREFIXES(ProcessMemoryDumpTest, BackgroundModeTest);
+ FRIEND_TEST_ALL_PREFIXES(ProcessMemoryDumpTest, OverrideOwnershipEdge);
MemoryAllocatorDump* AddAllocatorDumpInternal(
std::unique_ptr<MemoryAllocatorDump> mad);
MemoryAllocatorDump* GetBlackHoleMad();
+ void AddOverridableOwnershipEdge(const MemoryAllocatorDumpGuid& source,
+ const MemoryAllocatorDumpGuid& target,
+ int importance);
+
ProcessMemoryTotals process_totals_;
bool has_process_totals_;
@@ -200,7 +215,7 @@ class BASE_EXPORT ProcessMemoryDump {
scoped_refptr<MemoryDumpSessionState> session_state_;
// Keeps track of relationships between MemoryAllocatorDump(s).
- std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_;
+ AllocatorDumpEdgesMap allocator_dumps_edges_;
// Level of detail of the current dump.
const MemoryDumpArgs dump_args_;
« no previous file with comments | « base/trace_event/memory_allocator_dump_guid.h ('k') | base/trace_event/process_memory_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698