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

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

Issue 2427493004: Reland "Leak reports collect information about the last uptrend" (Closed)
Patch Set: Correct allocator definition 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
« no previous file with comments | « no previous file | components/metrics/leak_detector/call_stack_table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..83727167c5cd860ab5250e55cb00059a6d0cef50 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_;
@@ -64,13 +86,13 @@ class CallStackTable {
// Hash table containing entries. Uses CustomAllocator to avoid recursive
// malloc hook invocation when analyzing allocs and frees.
using TableEntryAllocator =
- STLAllocator<std::pair<const CallStack* const, uint32_t>,
+ STLAllocator<std::pair<const CallStack* const, CallStackCountInfo>,
CustomAllocator>;
// 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698