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

Unified Diff: src/heap/memory-reducer.h

Issue 1414483004: Add the rate of js invocations from the api as a signal of idleness (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments from Hannes Created 5 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 | « src/api.cc ('k') | src/heap/memory-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/memory-reducer.h
diff --git a/src/heap/memory-reducer.h b/src/heap/memory-reducer.h
index b3272f868c9a49df0303ca50824ae3da674bd4ce..9213613c0762d026a10d39ffe34221151bcafc3a 100644
--- a/src/heap/memory-reducer.h
+++ b/src/heap/memory-reducer.h
@@ -107,7 +107,10 @@ class MemoryReducer {
};
explicit MemoryReducer(Heap* heap)
- : heap_(heap), state_(kDone, 0, 0.0, 0.0) {}
+ : heap_(heap),
+ state_(kDone, 0, 0.0, 0.0),
+ js_calls_counter_(0),
+ js_calls_sample_time_ms_(0.0) {}
// Callbacks.
void NotifyMarkCompact(const Event& event);
void NotifyContextDisposed(const Event& event);
@@ -116,7 +119,7 @@ class MemoryReducer {
// the incoming event.
static State Step(const State& state, const Event& event);
// Posts a timer task that will call NotifyTimer after the given delay.
- void ScheduleTimer(double delay_ms);
+ void ScheduleTimer(double time_ms, double delay_ms);
void TearDown();
static const int kLongDelayMs;
static const int kShortDelayMs;
@@ -145,8 +148,16 @@ class MemoryReducer {
static bool WatchdogGC(const State& state, const Event& event);
+ // Returns the rate of JS calls initiated from the API.
+ double SampleAndGetJsCallsPerMs(double time_ms);
+
Heap* heap_;
State state_;
+ unsigned int js_calls_counter_;
+ double js_calls_sample_time_ms_;
+
+ // Used in cctest.
+ friend class HeapTester;
DISALLOW_COPY_AND_ASSIGN(MemoryReducer);
};
« no previous file with comments | « src/api.cc ('k') | src/heap/memory-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698