| 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 5531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5542 v8::HandleScope scope(CcTest::isolate()); | 5542 v8::HandleScope scope(CcTest::isolate()); |
| 5543 Isolate* isolate = CcTest::i_isolate(); | 5543 Isolate* isolate = CcTest::i_isolate(); |
| 5544 Heap* heap = isolate->heap(); | 5544 Heap* heap = isolate->heap(); |
| 5545 GCTracer* tracer = heap->tracer(); | 5545 GCTracer* tracer = heap->tracer(); |
| 5546 int time1 = 100; | 5546 int time1 = 100; |
| 5547 size_t counter1 = 1000; | 5547 size_t counter1 = 1000; |
| 5548 tracer->SampleAllocation(time1, counter1, 0); | 5548 tracer->SampleAllocation(time1, counter1, 0); |
| 5549 int time2 = 200; | 5549 int time2 = 200; |
| 5550 size_t counter2 = 2000; | 5550 size_t counter2 = 2000; |
| 5551 tracer->SampleAllocation(time2, counter2, 0); | 5551 tracer->SampleAllocation(time2, counter2, 0); |
| 5552 size_t bytes = tracer->AllocatedBytesInLast(1000); | 5552 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5553 CHECK_EQ(10000, bytes); | 5553 CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput); |
| 5554 int time3 = 1000; | 5554 int time3 = 1000; |
| 5555 size_t counter3 = 30000; | 5555 size_t counter3 = 30000; |
| 5556 tracer->SampleAllocation(time3, counter3, 0); | 5556 tracer->SampleAllocation(time3, counter3, 0); |
| 5557 bytes = tracer->AllocatedBytesInLast(100); | 5557 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5558 CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes); | 5558 CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput); |
| 5559 } | 5559 } |
| 5560 | 5560 |
| 5561 | 5561 |
| 5562 static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) { | 5562 static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 5563 Isolate* isolate = CcTest::i_isolate(); | 5563 Isolate* isolate = CcTest::i_isolate(); |
| 5564 Object* message = | 5564 Object* message = |
| 5565 *reinterpret_cast<Object**>(isolate->pending_message_obj_address()); | 5565 *reinterpret_cast<Object**>(isolate->pending_message_obj_address()); |
| 5566 CHECK(message->IsTheHole()); | 5566 CHECK(message->IsTheHole()); |
| 5567 } | 5567 } |
| 5568 | 5568 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5605 v8::HandleScope scope(CcTest::isolate()); | 5605 v8::HandleScope scope(CcTest::isolate()); |
| 5606 Isolate* isolate = CcTest::i_isolate(); | 5606 Isolate* isolate = CcTest::i_isolate(); |
| 5607 Heap* heap = isolate->heap(); | 5607 Heap* heap = isolate->heap(); |
| 5608 GCTracer* tracer = heap->tracer(); | 5608 GCTracer* tracer = heap->tracer(); |
| 5609 int time1 = 100; | 5609 int time1 = 100; |
| 5610 size_t counter1 = 1000; | 5610 size_t counter1 = 1000; |
| 5611 tracer->SampleAllocation(time1, 0, counter1); | 5611 tracer->SampleAllocation(time1, 0, counter1); |
| 5612 int time2 = 200; | 5612 int time2 = 200; |
| 5613 size_t counter2 = 2000; | 5613 size_t counter2 = 2000; |
| 5614 tracer->SampleAllocation(time2, 0, counter2); | 5614 tracer->SampleAllocation(time2, 0, counter2); |
| 5615 size_t bytes = tracer->AllocatedBytesInLast(1000); | 5615 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5616 CHECK_EQ(10000, bytes); | 5616 CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput); |
| 5617 int time3 = 1000; | 5617 int time3 = 1000; |
| 5618 size_t counter3 = 30000; | 5618 size_t counter3 = 30000; |
| 5619 tracer->SampleAllocation(time3, 0, counter3); | 5619 tracer->SampleAllocation(time3, 0, counter3); |
| 5620 bytes = tracer->AllocatedBytesInLast(100); | 5620 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5621 CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes); | 5621 CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput); |
| 5622 } | 5622 } |
| 5623 | 5623 |
| 5624 | 5624 |
| 5625 TEST(AllocationThroughput) { | 5625 TEST(AllocationThroughput) { |
| 5626 CcTest::InitializeVM(); | 5626 CcTest::InitializeVM(); |
| 5627 v8::HandleScope scope(CcTest::isolate()); | 5627 v8::HandleScope scope(CcTest::isolate()); |
| 5628 Isolate* isolate = CcTest::i_isolate(); | 5628 Isolate* isolate = CcTest::i_isolate(); |
| 5629 Heap* heap = isolate->heap(); | 5629 Heap* heap = isolate->heap(); |
| 5630 GCTracer* tracer = heap->tracer(); | 5630 GCTracer* tracer = heap->tracer(); |
| 5631 int time1 = 100; | 5631 int time1 = 100; |
| 5632 size_t counter1 = 1000; | 5632 size_t counter1 = 1000; |
| 5633 tracer->SampleAllocation(time1, counter1, counter1); | 5633 tracer->SampleAllocation(time1, counter1, counter1); |
| 5634 int time2 = 200; | 5634 int time2 = 200; |
| 5635 size_t counter2 = 2000; | 5635 size_t counter2 = 2000; |
| 5636 tracer->SampleAllocation(time2, counter2, counter2); | 5636 tracer->SampleAllocation(time2, counter2, counter2); |
| 5637 size_t bytes = tracer->AllocatedBytesInLast(1000); | 5637 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5638 CHECK_EQ(20000, bytes); | 5638 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
| 5639 int time3 = 1000; | 5639 int time3 = 1000; |
| 5640 size_t counter3 = 30000; | 5640 size_t counter3 = 30000; |
| 5641 tracer->SampleAllocation(time3, counter3, counter3); | 5641 tracer->SampleAllocation(time3, counter3, counter3); |
| 5642 bytes = tracer->AllocatedBytesInLast(100); | 5642 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5643 CHECK_EQ(2 * (counter3 - counter1) * 100 / (time3 - time1), bytes); | 5643 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
| 5644 } | 5644 } |
| OLD | NEW |