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

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

Issue 1148953009: Fix overflow in allocation throughput calculation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/gc-tracer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index deb9a4922183c7309f386c9181b55ee69392e3ab..c99019f89e8032d8457e915e468829c3cc8d3e62 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -5549,13 +5549,13 @@ TEST(NewSpaceAllocationThroughput2) {
int time2 = 200;
size_t counter2 = 2000;
tracer->SampleAllocation(time2, counter2, 0);
- size_t bytes = tracer->AllocatedBytesInLast(1000);
- CHECK_EQ(10000, bytes);
+ size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
+ CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput);
int time3 = 1000;
size_t counter3 = 30000;
tracer->SampleAllocation(time3, counter3, 0);
- bytes = tracer->AllocatedBytesInLast(100);
- CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes);
+ throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
+ CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput);
}
@@ -5612,13 +5612,13 @@ TEST(OldGenerationAllocationThroughput) {
int time2 = 200;
size_t counter2 = 2000;
tracer->SampleAllocation(time2, 0, counter2);
- size_t bytes = tracer->AllocatedBytesInLast(1000);
- CHECK_EQ(10000, bytes);
+ size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
+ CHECK_EQ((counter2 - counter1) / (time2 - time1), throughput);
int time3 = 1000;
size_t counter3 = 30000;
tracer->SampleAllocation(time3, 0, counter3);
- bytes = tracer->AllocatedBytesInLast(100);
- CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes);
+ throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
+ CHECK_EQ((counter3 - counter1) / (time3 - time1), throughput);
}
@@ -5634,11 +5634,11 @@ TEST(AllocationThroughput) {
int time2 = 200;
size_t counter2 = 2000;
tracer->SampleAllocation(time2, counter2, counter2);
- size_t bytes = tracer->AllocatedBytesInLast(1000);
- CHECK_EQ(20000, bytes);
+ size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
+ CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput);
int time3 = 1000;
size_t counter3 = 30000;
tracer->SampleAllocation(time3, counter3, counter3);
- bytes = tracer->AllocatedBytesInLast(100);
- CHECK_EQ(2 * (counter3 - counter1) * 100 / (time3 - time1), bytes);
+ throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
+ CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput);
}
« no previous file with comments | « src/heap/gc-tracer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698