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

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

Issue 2275583002: Revert of [heap] Tracer: Handle incremental marking scopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/heap/mark-compact.cc ('k') | test/unittests/heap/gc-tracer-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/test-heap.cc
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
index 80c4cc7c3434912d9258101959828a0b48704b06..308df8ad58d62c44cd2088dbcf7aa334c735ad3f 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -6206,6 +6206,54 @@
}
+TEST(NewSpaceAllocationThroughput) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+ GCTracer* tracer = heap->tracer();
+ tracer->ResetForTesting();
+ int time1 = 100;
+ size_t counter1 = 1000;
+ tracer->SampleAllocation(time1, counter1, 0);
+ int time2 = 200;
+ size_t counter2 = 2000;
+ tracer->SampleAllocation(time2, counter2, 0);
+ size_t throughput =
+ tracer->NewSpaceAllocationThroughputInBytesPerMillisecond();
+ CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput);
+ int time3 = 1000;
+ size_t counter3 = 30000;
+ tracer->SampleAllocation(time3, counter3, 0);
+ throughput = tracer->NewSpaceAllocationThroughputInBytesPerMillisecond();
+ CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput);
+}
+
+
+TEST(NewSpaceAllocationThroughput2) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+ GCTracer* tracer = heap->tracer();
+ tracer->ResetForTesting();
+ int time1 = 100;
+ size_t counter1 = 1000;
+ tracer->SampleAllocation(time1, counter1, 0);
+ int time2 = 200;
+ size_t counter2 = 2000;
+ tracer->SampleAllocation(time2, counter2, 0);
+ size_t throughput =
+ tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(100);
+ CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput);
+ int time3 = 1000;
+ size_t counter3 = 30000;
+ tracer->SampleAllocation(time3, counter3, 0);
+ throughput = tracer->NewSpaceAllocationThroughputInBytesPerMillisecond(100);
+ CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput);
+}
+
+
static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) {
Isolate* isolate = CcTest::i_isolate();
Object* message =
@@ -6317,6 +6365,55 @@
"g2();"
"check(g1, g2);");
}
+
+TEST(OldGenerationAllocationThroughput) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+ GCTracer* tracer = heap->tracer();
+ tracer->ResetForTesting();
+ int time1 = 100;
+ size_t counter1 = 1000;
+ tracer->SampleAllocation(time1, 0, counter1);
+ int time2 = 200;
+ size_t counter2 = 2000;
+ tracer->SampleAllocation(time2, 0, counter2);
+ size_t throughput = static_cast<size_t>(
+ tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100));
+ CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput);
+ int time3 = 1000;
+ size_t counter3 = 30000;
+ tracer->SampleAllocation(time3, 0, counter3);
+ throughput = static_cast<size_t>(
+ tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100));
+ CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput);
+}
+
+
+TEST(AllocationThroughput) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+ GCTracer* tracer = heap->tracer();
+ tracer->ResetForTesting();
+ int time1 = 100;
+ size_t counter1 = 1000;
+ tracer->SampleAllocation(time1, counter1, counter1);
+ int time2 = 200;
+ size_t counter2 = 2000;
+ tracer->SampleAllocation(time2, counter2, counter2);
+ size_t throughput = static_cast<size_t>(
+ tracer->AllocationThroughputInBytesPerMillisecond(100));
+ CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput);
+ int time3 = 1000;
+ size_t counter3 = 30000;
+ tracer->SampleAllocation(time3, counter3, counter3);
+ throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
+ CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput);
+}
+
TEST(ContextMeasure) {
CcTest::InitializeVM();
« no previous file with comments | « src/heap/mark-compact.cc ('k') | test/unittests/heap/gc-tracer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698