| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |