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

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
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..521c381506c8e13c64fcc01763476a44b7ef0c03 100644
--- a/base/trace_event/process_memory_dump.h
+++ b/base/trace_event/process_memory_dump.h
@@ -7,6 +7,7 @@
#include <stddef.h>
+#include <map>
#include <unordered_map>
#include <vector>
@@ -39,10 +40,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 +54,11 @@ class BASE_EXPORT ProcessMemoryDump {
using HeapDumpsMap =
std::unordered_map<std::string, std::unique_ptr<TracedValue>>;
+ // Stores allocator dump edges as a map from source allocator dump guids to
+ // the target.
Primiano Tucci (use gerrit) 2017/06/05 15:23:39 "to the target" part in the comment is false :)
ssid 2017/06/05 17:03:29 Yeah, I was looking for this phrase!
+ using AllocatorDumpEdgesMap =
+ std::map<MemoryAllocatorDumpGuid, MemoryAllocatorDumpEdge>;
+
#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 +141,7 @@ class BASE_EXPORT ProcessMemoryDump {
void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source,
const MemoryAllocatorDumpGuid& target);
- const std::vector<MemoryAllocatorDumpEdge>& allocator_dumps_edges() const {
+ const AllocatorDumpEdgesMap& allocator_dumps_edges_for_testing() const {
return allocator_dumps_edges_;
}
@@ -181,12 +187,20 @@ 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();
+ // Adds edges that can be overriden by a later or earlier call to
+ // AddOwnershipEdge() with the same source and target with a different
+ // |importance| value.
+ void AddOverridableOwnershipEdge(const MemoryAllocatorDumpGuid& source,
+ const MemoryAllocatorDumpGuid& target,
+ int importance);
+
ProcessMemoryTotals process_totals_;
bool has_process_totals_;
@@ -200,7 +214,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_;

Powered by Google App Engine
This is Rietveld 408576698