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

Unified Diff: base/tracked_objects_unittest.cc

Issue 2859493002: Tracked objects: Bump cumulative byte count storage to 64 bits to avoid saturation (Closed)
Patch Set: Move to 64 bit storage on 32 bit systems, using an even/odd locking scheme. Created 3 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 side-by-side diff with in-line comments
Download patch
« base/tracked_objects.cc ('K') | « base/tracked_objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tracked_objects_unittest.cc
diff --git a/base/tracked_objects_unittest.cc b/base/tracked_objects_unittest.cc
index f208e3c9818fca3f5d1d54ea298471c883c64091..4bbc28cf37d12357dd12339df46616a3f78035f7 100644
--- a/base/tracked_objects_unittest.cc
+++ b/base/tracked_objects_unittest.cc
@@ -346,13 +346,18 @@ TEST_F(TrackedObjectsTest, DeathDataTestRecordAllocations) {
EXPECT_EQ(data->alloc_overhead_bytes(), 3 * kAllocOverheadBytes);
EXPECT_EQ(data->max_allocated_bytes(), kLargerMaxAllocatedBytes);
- // Saturate everything.
+ // Saturate the counts.
data->RecordAllocations(INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX);
EXPECT_EQ(data->alloc_ops(), INT_MAX);
EXPECT_EQ(data->free_ops(), INT_MAX);
- EXPECT_EQ(data->allocated_bytes(), INT_MAX);
- EXPECT_EQ(data->freed_bytes(), INT_MAX);
- EXPECT_EQ(data->alloc_overhead_bytes(), INT_MAX);
+ // The cumulative byte counts are 64 bit wide, and won't saturate easily.
+ EXPECT_EQ(data->allocated_bytes(),
+ static_cast<int64_t>(INT_MAX) +
+ static_cast<int64_t>(3 * kAllocatedBytes));
+ EXPECT_EQ(data->freed_bytes(),
+ static_cast<int64_t>(INT_MAX) + 3 * kFreedBytes);
+ EXPECT_EQ(data->alloc_overhead_bytes(),
+ static_cast<int64_t>(INT_MAX) + 3 * kAllocOverheadBytes);
EXPECT_EQ(data->max_allocated_bytes(), INT_MAX);
}
« base/tracked_objects.cc ('K') | « base/tracked_objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698