| Index: components/metrics/leak_detector/leak_detector_impl.h
|
| diff --git a/components/metrics/leak_detector/leak_detector_impl.h b/components/metrics/leak_detector/leak_detector_impl.h
|
| index bf6a58e60165d32369491148b8145a26732cb38e..65c93d9781d72dec2eab9c37f3e55be9282880dd 100644
|
| --- a/components/metrics/leak_detector/leak_detector_impl.h
|
| +++ b/components/metrics/leak_detector/leak_detector_impl.h
|
| @@ -67,6 +67,14 @@ class LeakDetectorImpl {
|
| return alloc_breakdown_history_;
|
| }
|
|
|
| + size_t num_rising_intervals() const { return num_rising_intervals_; }
|
| +
|
| + uint32_t num_allocs_increase() const { return num_allocs_increase_; }
|
| +
|
| + void set_num_rising_intervals(size_t num_rising_intervals) {
|
| + num_rising_intervals_ = num_rising_intervals;
|
| + }
|
| +
|
| // Used to compare the contents of two leak reports.
|
| bool operator<(const LeakReport& other) const;
|
|
|
| @@ -78,6 +86,12 @@ class LeakDetectorImpl {
|
| // Number of bytes allocated by the leak site during each allocation.
|
| size_t alloc_size_bytes_;
|
|
|
| + // Number of intervals in the last uptrend.
|
| + size_t num_rising_intervals_;
|
| +
|
| + // Net number of bytes allocated in the last uptrend.
|
| + uint32_t num_allocs_increase_;
|
| +
|
| // Unlike the CallStack struct, which consists of addresses, this call stack
|
| // will contain offsets in the executable binary.
|
| InternalVector<uintptr_t> call_stack_;
|
| @@ -105,7 +119,7 @@ class LeakDetectorImpl {
|
| void RecordFree(const void* ptr);
|
|
|
| // Run check for possible leaks based on the current profiling data.
|
| - void TestForLeaks(InternalVector<LeakReport>* reports);
|
| + void TestForLeaks(InternalVector<LeakReport>* reports, size_t timestamp);
|
|
|
| private:
|
| // A record of allocations for a particular size.
|
| @@ -160,17 +174,21 @@ class LeakDetectorImpl {
|
| // per size is recorded in |size_breakdown_history_|. The net number of allocs
|
| // per call site for each size is recorded in
|
| // |AllocSizeEntry::call_site_breakdown_history|.
|
| + // Argument |timestamp| is used to update information about drops in
|
| + // allocation number for each stored call stack.
|
| //
|
| // Not all the net alloc counts are recorded. And the number of historical
|
| // records kept is capped. If adding a new record exceeds that limit, the
|
| // oldest record is discarded. See the function definition for more details.
|
| - void RecordCurrentAllocationDataInHistory();
|
| + void RecordCurrentAllocationDataInHistory(size_t timestamp);
|
|
|
| // Store the data collected by RecordCurrentAllocationDataInHistory() in
|
| // |*report|. Not all net alloc counts per call site will be stored, only the
|
| - // count for size=|size| and made from |call_site|.
|
| + // count for size=|size| and made from |call_site|. Also information
|
| + // about the last uptrend in net allocations for |size| and |call_site|
|
| + // is recorded with help of |timestamp|.
|
| void StoreHistoricalDataInReport(size_t size, const CallStack* call_site,
|
| - LeakReport* report);
|
| + LeakReport* report, size_t timestamp);
|
|
|
| // Decrements the cooldown counter (value) for each entry in
|
| // |cooldowns_per_leak_|. If the cooldown counter reaches 0, the entry is
|
|
|