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 5533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5544 Isolate* isolate = CcTest::i_isolate(); | 5544 Isolate* isolate = CcTest::i_isolate(); |
5545 Heap* heap = isolate->heap(); | 5545 Heap* heap = isolate->heap(); |
5546 GCTracer* tracer = heap->tracer(); | 5546 GCTracer* tracer = heap->tracer(); |
5547 int time1 = 100; | 5547 int time1 = 100; |
5548 size_t counter1 = 1000; | 5548 size_t counter1 = 1000; |
5549 tracer->SampleNewSpaceAllocation(time1, counter1); | 5549 tracer->SampleNewSpaceAllocation(time1, counter1); |
5550 int time2 = 200; | 5550 int time2 = 200; |
5551 size_t counter2 = 2000; | 5551 size_t counter2 = 2000; |
5552 tracer->SampleNewSpaceAllocation(time2, counter2); | 5552 tracer->SampleNewSpaceAllocation(time2, counter2); |
5553 size_t bytes = tracer->NewSpaceAllocatedBytesInLast(1000); | 5553 size_t bytes = tracer->NewSpaceAllocatedBytesInLast(1000); |
5554 CHECK_EQ(0, bytes); | 5554 CHECK_EQ(10000, bytes); |
5555 int time3 = 1000; | 5555 int time3 = 1000; |
5556 size_t counter3 = 30000; | 5556 size_t counter3 = 30000; |
5557 tracer->SampleNewSpaceAllocation(time3, counter3); | 5557 tracer->SampleNewSpaceAllocation(time3, counter3); |
5558 bytes = tracer->NewSpaceAllocatedBytesInLast(100); | 5558 bytes = tracer->NewSpaceAllocatedBytesInLast(100); |
5559 CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes); | 5559 CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes); |
5560 } | 5560 } |
OLD | NEW |