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

Unified Diff: components/metrics/leak_detector/call_stack_table.h

Issue 2403223002: Leak reports collect information about the last uptrend (Closed)
Patch Set: Added a test case Created 4 years, 2 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: components/metrics/leak_detector/call_stack_table.h
diff --git a/components/metrics/leak_detector/call_stack_table.h b/components/metrics/leak_detector/call_stack_table.h
index 77a4b2a3ed717d882f44fb2403eb93b73315348d..5864ae740f3856ad11122243e6fe00e0e069ddc6 100644
--- a/components/metrics/leak_detector/call_stack_table.h
+++ b/components/metrics/leak_detector/call_stack_table.h
@@ -48,6 +48,21 @@ class CallStackTable {
// must already be initialized with that number.
void GetTopCallStacks(RankedSet* top_entries) const;
+ // Updates information about the last seen drop in the number of allocations
+ // and sets the |previous_count| for every stored call stack, both inside
+ // |entry_map_|. It should be called in the analysis phase, before the
+ // reports are generated, with |timestamp| describing current point in the
+ // timeline.
+ void UpdateLastDropInfo(size_t timestamp);
+
+ // Retrieves the change in timestamp and allocation count since the last
+ // observed drop in the number for allocations for the given call stack
+ // (or since the oldest kept record for the call stacks if there were no
+ // drops)
+ void GetLastUptrendInfo(
+ const CallStack* call_stack, size_t timestamp, size_t *timestamp_delta,
+ uint32_t *count_delta) const;
+
const LeakAnalyzer& leak_analyzer() const { return leak_analyzer_; }
size_t size() const { return entry_map_.size(); }
@@ -57,6 +72,13 @@ class CallStackTable {
uint32_t num_frees() const { return num_frees_; }
private:
+ struct CallStackCountInfo {
+ uint32_t count, previous_count, last_drop_count;
+ size_t last_drop_timestamp;
+ CallStackCountInfo() : count(0), previous_count(0), last_drop_count(0),
+ last_drop_timestamp(0) {}
+ };
+
// Total number of allocs and frees in this table.
uint32_t num_allocs_;
uint32_t num_frees_;
@@ -70,7 +92,7 @@ class CallStackTable {
// Stores a mapping of each call stack to the number of recorded allocations
// made from that call site.
base::hash_map<const CallStack*,
- uint32_t,
+ CallStackCountInfo,
StoredHash,
std::equal_to<const CallStack*>,
TableEntryAllocator> entry_map_;
« no previous file with comments | « no previous file | components/metrics/leak_detector/call_stack_table.cc » ('j') | components/metrics/proto/memory_leak_report.proto » ('J')

Powered by Google App Engine
This is Rietveld 408576698