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

Side by Side Diff: test/cctest/heap/test-heap.cc

Issue 1841043002: Represent speed in GCTracer functions as double instead of int. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/heap/scavenge-job.cc ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6307 matching lines...) Expand 10 before | Expand all | Expand 10 after
6318 v8::HandleScope scope(CcTest::isolate()); 6318 v8::HandleScope scope(CcTest::isolate());
6319 Isolate* isolate = CcTest::i_isolate(); 6319 Isolate* isolate = CcTest::i_isolate();
6320 Heap* heap = isolate->heap(); 6320 Heap* heap = isolate->heap();
6321 GCTracer* tracer = heap->tracer(); 6321 GCTracer* tracer = heap->tracer();
6322 int time1 = 100; 6322 int time1 = 100;
6323 size_t counter1 = 1000; 6323 size_t counter1 = 1000;
6324 tracer->SampleAllocation(time1, 0, counter1); 6324 tracer->SampleAllocation(time1, 0, counter1);
6325 int time2 = 200; 6325 int time2 = 200;
6326 size_t counter2 = 2000; 6326 size_t counter2 = 2000;
6327 tracer->SampleAllocation(time2, 0, counter2); 6327 tracer->SampleAllocation(time2, 0, counter2);
6328 size_t throughput = 6328 size_t throughput = static_cast<size_t>(
6329 tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100); 6329 tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100));
6330 CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput); 6330 CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput);
6331 int time3 = 1000; 6331 int time3 = 1000;
6332 size_t counter3 = 30000; 6332 size_t counter3 = 30000;
6333 tracer->SampleAllocation(time3, 0, counter3); 6333 tracer->SampleAllocation(time3, 0, counter3);
6334 throughput = 6334 throughput = static_cast<size_t>(
6335 tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100); 6335 tracer->OldGenerationAllocationThroughputInBytesPerMillisecond(100));
6336 CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput); 6336 CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput);
6337 } 6337 }
6338 6338
6339 6339
6340 TEST(AllocationThroughput) { 6340 TEST(AllocationThroughput) {
6341 CcTest::InitializeVM(); 6341 CcTest::InitializeVM();
6342 v8::HandleScope scope(CcTest::isolate()); 6342 v8::HandleScope scope(CcTest::isolate());
6343 Isolate* isolate = CcTest::i_isolate(); 6343 Isolate* isolate = CcTest::i_isolate();
6344 Heap* heap = isolate->heap(); 6344 Heap* heap = isolate->heap();
6345 GCTracer* tracer = heap->tracer(); 6345 GCTracer* tracer = heap->tracer();
6346 int time1 = 100; 6346 int time1 = 100;
6347 size_t counter1 = 1000; 6347 size_t counter1 = 1000;
6348 tracer->SampleAllocation(time1, counter1, counter1); 6348 tracer->SampleAllocation(time1, counter1, counter1);
6349 int time2 = 200; 6349 int time2 = 200;
6350 size_t counter2 = 2000; 6350 size_t counter2 = 2000;
6351 tracer->SampleAllocation(time2, counter2, counter2); 6351 tracer->SampleAllocation(time2, counter2, counter2);
6352 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 6352 size_t throughput = static_cast<size_t>(
6353 tracer->AllocationThroughputInBytesPerMillisecond(100));
6353 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); 6354 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput);
6354 int time3 = 1000; 6355 int time3 = 1000;
6355 size_t counter3 = 30000; 6356 size_t counter3 = 30000;
6356 tracer->SampleAllocation(time3, counter3, counter3); 6357 tracer->SampleAllocation(time3, counter3, counter3);
6357 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 6358 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
6358 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); 6359 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput);
6359 } 6360 }
6360 6361
6361 6362
6362 TEST(ContextMeasure) { 6363 TEST(ContextMeasure) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
6606 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1); 6607 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(arrays[j], N - 1);
6607 } 6608 }
6608 } 6609 }
6609 // Force allocation from the free list. 6610 // Force allocation from the free list.
6610 heap->set_force_oom(true); 6611 heap->set_force_oom(true);
6611 heap->CollectGarbage(OLD_SPACE); 6612 heap->CollectGarbage(OLD_SPACE);
6612 } 6613 }
6613 6614
6614 } // namespace internal 6615 } // namespace internal
6615 } // namespace v8 6616 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/scavenge-job.cc ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698