cppgc: Remove old unused HeapStatistics APIs

Bug: chromium:1056170
Change-Id: I490653677ed610f52502b963ffc00eedcc526cd2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3014457
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75653}
This commit is contained in:
Michael Lippautz 2021-07-08 22:49:18 +02:00 committed by V8 LUCI CQ
parent 95249ba563
commit ebda3e709f
4 changed files with 9 additions and 85 deletions

View File

@ -30,22 +30,6 @@ struct HeapStatistics final {
kDetailed,
};
/**
* Statistics of object types. For each type the statistics record its name,
* how many objects of that type were allocated, and the overall size used by
* these objects.
*/
struct ObjectStatistics {
/** Number of distinct object types. */
size_t num_types = 0;
/** Name of each type. */
std::vector<std::string> type_name;
/** Number of allocated objects per each type. */
std::vector<size_t> type_count;
/** Overall size of allocated objects per each type. */
std::vector<size_t> type_bytes;
};
/**
* Object statistics for a single type.
*/
@ -67,19 +51,10 @@ struct HeapStatistics final {
struct PageStatistics {
/** Overall committed amount of memory for the page. */
size_t committed_size_bytes = 0;
/**
* Resident amount of memory held by the page.
*
* Deprecated, use `resident_size_bytes`.
*/
size_t physical_size_bytes = 0;
/** Resident amount of memory held by the page. */
size_t resident_size_bytes = 0;
/** Amount of memory actually used on the page. */
size_t used_size_bytes = 0;
/** Statistics for object allocated on the page. Filled only when
* NameProvider::HideInternalNames() is false. */
ObjectStatistics object_stats;
/** Statistics for object allocated on the page. Filled only when
* NameProvider::HideInternalNames() is false. */
std::vector<ObjectStatsEntry> object_statistics;
@ -111,12 +86,6 @@ struct HeapStatistics final {
std::string name;
/** Overall committed amount of memory for the heap. */
size_t committed_size_bytes = 0;
/**
* Resident amount of memory held by the heap.
*
* Deprecated, use `resident_size_bytes`.
*/
size_t physical_size_bytes = 0;
/** Resident amount of memory held by the heap. */
size_t resident_size_bytes = 0;
/** Amount of memory actually used on the space. */
@ -125,9 +94,6 @@ struct HeapStatistics final {
std::vector<PageStatistics> page_stats;
/** Statistics for the freelist of the space. */
FreeListStatistics free_list_stats;
/** Statistics for object allocated on the space. Filled only when
* NameProvider::HideInternalNames() is false. */
ObjectStatistics object_stats;
/** Statistics for object allocated on the page. Filled only when
* NameProvider::HideInternalNames() is false. */
std::vector<ObjectStatsEntry> object_statistics;
@ -135,12 +101,6 @@ struct HeapStatistics final {
/** Overall committed amount of memory for the heap. */
size_t committed_size_bytes = 0;
/**
*Resident amount of memory help by the heap.
*
* Deprecated, use `resident_size_bytes`.
*/
size_t physical_size_bytes = 0;
/** Resident amount of memory help by the heap. */
size_t resident_size_bytes = 0;
/** Amount of memory actually used on the heap. */

View File

@ -147,7 +147,6 @@ HeapStatistics HeapBase::CollectStatistics(
HeapStatistics::DetailLevel detail_level) {
if (detail_level == HeapStatistics::DetailLevel::kBrief) {
return {stats_collector_->allocated_memory_size(),
stats_collector_->allocated_memory_size(),
stats_collector_->allocated_memory_size(),
stats_collector_->allocated_object_size(),
HeapStatistics::DetailLevel::kBrief,

View File

@ -38,15 +38,6 @@ HeapStatistics::SpaceStatistics* InitializeSpace(HeapStatistics* stats,
stats->space_stats.emplace_back();
HeapStatistics::SpaceStatistics* space_stats = &stats->space_stats.back();
space_stats->name = std::move(name);
if (!NameProvider::HideInternalNames()) {
const size_t num_types = GlobalGCInfoTable::Get().NumberOfGCInfos();
space_stats->object_stats.num_types = num_types;
space_stats->object_stats.type_name.resize(num_types);
space_stats->object_stats.type_count.resize(num_types);
space_stats->object_stats.type_bytes.resize(num_types);
}
return space_stats;
}
@ -54,15 +45,6 @@ HeapStatistics::PageStatistics* InitializePage(
HeapStatistics::SpaceStatistics* stats) {
stats->page_stats.emplace_back();
HeapStatistics::PageStatistics* page_stats = &stats->page_stats.back();
if (!NameProvider::HideInternalNames()) {
const size_t num_types = GlobalGCInfoTable::Get().NumberOfGCInfos();
page_stats->object_stats.num_types = num_types;
page_stats->object_stats.type_name.resize(num_types);
page_stats->object_stats.type_count.resize(num_types);
page_stats->object_stats.type_bytes.resize(num_types);
}
return page_stats;
}
@ -70,7 +52,6 @@ void FinalizePage(HeapStatistics::SpaceStatistics* space_stats,
HeapStatistics::PageStatistics** page_stats) {
if (*page_stats) {
DCHECK_NOT_NULL(space_stats);
space_stats->physical_size_bytes += (*page_stats)->physical_size_bytes;
space_stats->resident_size_bytes += (*page_stats)->resident_size_bytes;
space_stats->used_size_bytes += (*page_stats)->used_size_bytes;
}
@ -83,7 +64,6 @@ void FinalizeSpace(HeapStatistics* stats,
FinalizePage(*space_stats, page_stats);
if (*space_stats) {
DCHECK_NOT_NULL(stats);
stats->physical_size_bytes += (*space_stats)->physical_size_bytes;
stats->resident_size_bytes += (*space_stats)->resident_size_bytes;
stats->used_size_bytes += (*space_stats)->used_size_bytes;
}
@ -92,17 +72,9 @@ void FinalizeSpace(HeapStatistics* stats,
void RecordObjectType(
std::unordered_map<const char*, size_t>& type_map,
HeapStatistics::ObjectStatistics& object_stats,
std::vector<HeapStatistics::ObjectStatsEntry>& object_statistics,
HeapObjectHeader* header, size_t object_size) {
if (!NameProvider::HideInternalNames()) {
// Detailed names available.
const GCInfoIndex gc_info_index = header->GetGCInfoIndex();
object_stats.type_count[gc_info_index]++;
object_stats.type_bytes[gc_info_index] += object_size;
if (object_stats.type_name[gc_info_index].empty()) {
object_stats.type_name[gc_info_index] = header->GetName().value;
}
// Tries to insert a new entry into the typemap with a running counter. If
// the entry is already present, just returns the old one.
const auto it = type_map.insert({header->GetName().value, type_map.size()});
@ -138,8 +110,6 @@ HeapStatistics HeapStatisticsCollector::CollectStatistics(HeapBase* heap) {
}
}
DCHECK_EQ(heap->stats_collector()->allocated_memory_size(),
stats.physical_size_bytes);
DCHECK_EQ(heap->stats_collector()->allocated_memory_size(),
stats.resident_size_bytes);
return stats;
@ -172,7 +142,6 @@ bool HeapStatisticsCollector::VisitNormalPage(NormalPage& page) {
current_page_stats_ = InitializePage(current_space_stats_);
current_page_stats_->committed_size_bytes = kPageSize;
current_page_stats_->physical_size_bytes = kPageSize;
current_page_stats_->resident_size_bytes = kPageSize;
return false;
}
@ -185,7 +154,6 @@ bool HeapStatisticsCollector::VisitLargePage(LargePage& page) {
const size_t allocated_size = LargePage::AllocationSize(object_size);
current_page_stats_ = InitializePage(current_space_stats_);
current_page_stats_->committed_size_bytes = allocated_size;
current_page_stats_->physical_size_bytes = allocated_size;
current_page_stats_->resident_size_bytes = allocated_size;
return false;
}
@ -203,10 +171,7 @@ bool HeapStatisticsCollector::VisitHeapObjectHeader(HeapObjectHeader& header) {
BasePage::FromPayload(const_cast<HeapObjectHeader*>(&header)))
->PayloadSize()
: header.AllocatedSize();
RecordObjectType(type_name_to_index_map_, current_space_stats_->object_stats,
current_space_stats_->object_statistics, &header,
allocated_object_size);
RecordObjectType(type_name_to_index_map_, current_page_stats_->object_stats,
RecordObjectType(type_name_to_index_map_,
current_page_stats_->object_statistics, &header,
allocated_object_size);
current_page_stats_->used_size_bytes += allocated_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.physical_size_bytes);
EXPECT_EQ(kPageSize, detailed_stats.resident_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.physical_size_bytes);
EXPECT_EQ(0u, space_stats.resident_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.physical_size_bytes);
EXPECT_EQ(kPageSize, space_stats.resident_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().physical_size_bytes);
EXPECT_EQ(kPageSize, space_stats.page_stats.back().resident_size_bytes);
EXPECT_EQ(used_size, space_stats.page_stats.back().used_size_bytes);
}
EXPECT_TRUE(found_non_empty_space);
@ -103,24 +103,24 @@ TEST_F(HeapStatisticsCollectorTest, NonEmptyLargePage) {
HeapStatistics::DetailLevel::kDetailed);
EXPECT_EQ(HeapStatistics::DetailLevel::kDetailed,
detailed_stats.detail_level);
EXPECT_EQ(physical_size, detailed_stats.physical_size_bytes);
EXPECT_EQ(physical_size, detailed_stats.resident_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.physical_size_bytes);
EXPECT_EQ(0u, space_stats.resident_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(physical_size, space_stats.physical_size_bytes);
EXPECT_EQ(physical_size, space_stats.resident_size_bytes);
EXPECT_EQ(used_size, space_stats.used_size_bytes);
EXPECT_EQ(1u, space_stats.page_stats.size());
EXPECT_EQ(physical_size, space_stats.page_stats.back().physical_size_bytes);
EXPECT_EQ(physical_size, space_stats.page_stats.back().resident_size_bytes);
EXPECT_EQ(used_size, space_stats.page_stats.back().used_size_bytes);
}
EXPECT_TRUE(found_non_empty_space);