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

Unified Diff: test/cctest/test-heap.cc

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 | « test/cctest/heap-tester.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 217ac0123eb3e96040cebb2ebfd358d197922285..cc384d353e9379a5aa7d5c555da67d22b43cf29b 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -35,6 +35,7 @@
#include "src/factory.h"
#include "src/global-handles.h"
#include "src/heap/gc-tracer.h"
+#include "src/heap/memory-reducer.h"
#include "src/ic/ic.h"
#include "src/macro-assembler.h"
#include "src/snapshot/snapshot.h"
@@ -6274,5 +6275,30 @@ TEST(Regress519319) {
}
+HEAP_TEST(TestMemoryReducerSampleJsCalls) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Heap* heap = CcTest::heap();
+ Isolate* isolate = CcTest::i_isolate();
+ MemoryReducer* memory_reducer = heap->memory_reducer_;
+ memory_reducer->SampleAndGetJsCallsPerMs(0);
+ isolate->IncrementJsCallsFromApiCounter();
+ isolate->IncrementJsCallsFromApiCounter();
+ isolate->IncrementJsCallsFromApiCounter();
+ double calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(1);
+ CheckDoubleEquals(3, calls_per_ms);
+
+ calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(2);
+ CheckDoubleEquals(0, calls_per_ms);
+
+ isolate->IncrementJsCallsFromApiCounter();
+ isolate->IncrementJsCallsFromApiCounter();
+ isolate->IncrementJsCallsFromApiCounter();
+ isolate->IncrementJsCallsFromApiCounter();
+ calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4);
+ CheckDoubleEquals(2, calls_per_ms);
+}
+
+
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/heap-tester.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698