cppgc: Rename allocated_size to physical_size in statistics

Bug: chromium:1056170
Change-Id: I6fb5278dd1ef14faac13602cd28286d0e0d29054
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2689198
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72672}
This commit is contained in:
Omer Katz 2021-02-11 17:20:07 +01:00 committed by Commit Bot
parent 42409a2e69
commit c6a3190bf8
3 changed files with 16 additions and 17 deletions

View File

@ -51,7 +51,7 @@ struct HeapStatistics final {
*/
struct PageStatistics {
/** Overall amount of memory allocated for the page. */
size_t allocated_size_bytes = 0;
size_t physical_size_bytes = 0;
/** Amount of memory actually used on the page. */
size_t used_size_bytes = 0;
};
@ -81,7 +81,7 @@ struct HeapStatistics final {
/** The space name */
std::string name;
/** Overall amount of memory allocated for the space. */
size_t allocated_size_bytes = 0;
size_t physical_size_bytes = 0;
/** Amount of memory actually used on the space. */
size_t used_size_bytes = 0;
/** Statistics for each of the pages in the space. */
@ -94,7 +94,7 @@ struct HeapStatistics final {
};
/** Overall amount of memory allocated for the heap. */
size_t allocated_size_bytes = 0;
size_t physical_size_bytes = 0;
/** Amount of memory actually used on the heap. */
size_t used_size_bytes = 0;
/** Detail level of this HeapStatistics. */

View File

@ -51,7 +51,7 @@ void FinalizePage(HeapStatistics::SpaceStatistics* space_stats,
HeapStatistics::PageStatistics** page_stats) {
if (*page_stats) {
DCHECK_NOT_NULL(space_stats);
space_stats->allocated_size_bytes += (*page_stats)->allocated_size_bytes;
space_stats->physical_size_bytes += (*page_stats)->physical_size_bytes;
space_stats->used_size_bytes += (*page_stats)->used_size_bytes;
}
*page_stats = nullptr;
@ -63,7 +63,7 @@ void FinalizeSpace(HeapStatistics* stats,
FinalizePage(*space_stats, page_stats);
if (*space_stats) {
DCHECK_NOT_NULL(stats);
stats->allocated_size_bytes += (*space_stats)->allocated_size_bytes;
stats->physical_size_bytes += (*space_stats)->physical_size_bytes;
stats->used_size_bytes += (*space_stats)->used_size_bytes;
}
*space_stats = nullptr;
@ -94,7 +94,7 @@ HeapStatistics HeapStatisticsCollector::CollectStatistics(HeapBase* heap) {
FinalizeSpace(current_stats_, &current_space_stats_, &current_page_stats_);
DCHECK_EQ(heap->stats_collector()->allocated_memory_size(),
stats.allocated_size_bytes);
stats.physical_size_bytes);
return stats;
}
@ -135,7 +135,7 @@ bool HeapStatisticsCollector::VisitLargePage(LargePage* page) {
size_t object_size = page->PayloadSize();
RecordObjectType(current_space_stats_, object_header, object_size);
size_t allocated_size = LargePage::AllocationSize(object_size);
current_space_stats_->allocated_size_bytes += allocated_size;
current_space_stats_->physical_size_bytes += allocated_size;
current_space_stats_->used_size_bytes += object_size;
current_space_stats_->page_stats.emplace_back(
HeapStatistics::PageStatistics{allocated_size, object_size});

View File

@ -69,24 +69,24 @@ TEST_F(HeapStatisticsCollectorTest, NonEmptyNormalPage) {
HeapStatistics::DetailLevel::kDetailed);
EXPECT_EQ(HeapStatistics::DetailLevel::kDetailed,
detailed_stats.detail_level);
EXPECT_EQ(kPageSize, detailed_stats.allocated_size_bytes);
EXPECT_EQ(kPageSize, detailed_stats.physical_size_bytes);
EXPECT_EQ(used_size, detailed_stats.used_size_bytes);
EXPECT_EQ(RawHeap::kNumberOfRegularSpaces, detailed_stats.space_stats.size());
bool found_non_empty_space = false;
for (const HeapStatistics::SpaceStatistics& space_stats :
detailed_stats.space_stats) {
if (space_stats.page_stats.empty()) {
EXPECT_EQ(0u, space_stats.allocated_size_bytes);
EXPECT_EQ(0u, space_stats.physical_size_bytes);
EXPECT_EQ(0u, space_stats.used_size_bytes);
continue;
}
EXPECT_NE("LargePageSpace", space_stats.name);
EXPECT_FALSE(found_non_empty_space);
found_non_empty_space = true;
EXPECT_EQ(kPageSize, space_stats.allocated_size_bytes);
EXPECT_EQ(kPageSize, space_stats.physical_size_bytes);
EXPECT_EQ(used_size, space_stats.used_size_bytes);
EXPECT_EQ(1u, space_stats.page_stats.size());
EXPECT_EQ(kPageSize, space_stats.page_stats.back().allocated_size_bytes);
EXPECT_EQ(kPageSize, space_stats.page_stats.back().physical_size_bytes);
EXPECT_EQ(used_size, space_stats.page_stats.back().used_size_bytes);
}
EXPECT_TRUE(found_non_empty_space);
@ -97,31 +97,30 @@ TEST_F(HeapStatisticsCollectorTest, NonEmptyLargePage) {
GetHeap()->GetAllocationHandle());
static constexpr size_t used_size = RoundUp<kAllocationGranularity>(
kLargeObjectSizeThreshold + sizeof(HeapObjectHeader));
static constexpr size_t allocated_size =
static constexpr size_t physical_size =
RoundUp<kAllocationGranularity>(used_size + sizeof(LargePage));
HeapStatistics detailed_stats = Heap::From(GetHeap())->CollectStatistics(
HeapStatistics::DetailLevel::kDetailed);
EXPECT_EQ(HeapStatistics::DetailLevel::kDetailed,
detailed_stats.detail_level);
EXPECT_EQ(allocated_size, detailed_stats.allocated_size_bytes);
EXPECT_EQ(physical_size, detailed_stats.physical_size_bytes);
EXPECT_EQ(used_size, detailed_stats.used_size_bytes);
EXPECT_EQ(RawHeap::kNumberOfRegularSpaces, detailed_stats.space_stats.size());
bool found_non_empty_space = false;
for (const HeapStatistics::SpaceStatistics& space_stats :
detailed_stats.space_stats) {
if (space_stats.page_stats.empty()) {
EXPECT_EQ(0u, space_stats.allocated_size_bytes);
EXPECT_EQ(0u, space_stats.physical_size_bytes);
EXPECT_EQ(0u, space_stats.used_size_bytes);
continue;
}
EXPECT_EQ("LargePageSpace", space_stats.name);
EXPECT_FALSE(found_non_empty_space);
found_non_empty_space = true;
EXPECT_EQ(allocated_size, space_stats.allocated_size_bytes);
EXPECT_EQ(physical_size, space_stats.physical_size_bytes);
EXPECT_EQ(used_size, space_stats.used_size_bytes);
EXPECT_EQ(1u, space_stats.page_stats.size());
EXPECT_EQ(allocated_size,
space_stats.page_stats.back().allocated_size_bytes);
EXPECT_EQ(physical_size, space_stats.page_stats.back().physical_size_bytes);
EXPECT_EQ(used_size, space_stats.page_stats.back().used_size_bytes);
}
EXPECT_TRUE(found_non_empty_space);