| 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_;
|
|
|