Expose more detailed memory statistics

Expose allocated and used byte counters for the different spaces. The goal is
to monitor those values both on page cycles and via UMA

BUG=v8:2201
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10657022
Patch from Jochen Eisinger <jochen@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11931 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2012-06-26 11:46:16 +00:00
parent 3fd25c6cbc
commit 6902028445
2 changed files with 74 additions and 1 deletions

View File

@ -444,6 +444,56 @@ void Heap::GarbageCollectionEpilogue() {
symbol_table()->Capacity()); symbol_table()->Capacity());
isolate_->counters()->number_of_symbols()->Set( isolate_->counters()->number_of_symbols()->Set(
symbol_table()->NumberOfElements()); symbol_table()->NumberOfElements());
isolate_->counters()->new_space_bytes_available()->Set(
static_cast<int>(new_space()->Available()));
isolate_->counters()->new_space_bytes_committed()->Set(
static_cast<int>(new_space()->CommittedMemory()));
isolate_->counters()->new_space_bytes_used()->Set(
static_cast<int>(new_space()->SizeOfObjects()));
isolate_->counters()->old_pointer_space_bytes_available()->Set(
static_cast<int>(old_pointer_space()->Available()));
isolate_->counters()->old_pointer_space_bytes_committed()->Set(
static_cast<int>(old_pointer_space()->CommittedMemory()));
isolate_->counters()->old_pointer_space_bytes_used()->Set(
static_cast<int>(old_pointer_space()->SizeOfObjects()));
isolate_->counters()->old_data_space_bytes_available()->Set(
static_cast<int>(old_data_space()->Available()));
isolate_->counters()->old_data_space_bytes_committed()->Set(
static_cast<int>(old_data_space()->CommittedMemory()));
isolate_->counters()->old_data_space_bytes_used()->Set(
static_cast<int>(old_data_space()->SizeOfObjects()));
isolate_->counters()->code_space_bytes_available()->Set(
static_cast<int>(code_space()->Available()));
isolate_->counters()->code_space_bytes_committed()->Set(
static_cast<int>(code_space()->CommittedMemory()));
isolate_->counters()->code_space_bytes_used()->Set(
static_cast<int>(code_space()->SizeOfObjects()));
isolate_->counters()->map_space_bytes_available()->Set(
static_cast<int>(map_space()->Available()));
isolate_->counters()->map_space_bytes_committed()->Set(
static_cast<int>(map_space()->CommittedMemory()));
isolate_->counters()->map_space_bytes_used()->Set(
static_cast<int>(map_space()->SizeOfObjects()));
isolate_->counters()->cell_space_bytes_available()->Set(
static_cast<int>(cell_space()->Available()));
isolate_->counters()->cell_space_bytes_committed()->Set(
static_cast<int>(cell_space()->CommittedMemory()));
isolate_->counters()->cell_space_bytes_used()->Set(
static_cast<int>(cell_space()->SizeOfObjects()));
isolate_->counters()->lo_space_bytes_available()->Set(
static_cast<int>(lo_space()->Available()));
isolate_->counters()->lo_space_bytes_committed()->Set(
static_cast<int>(lo_space()->CommittedMemory()));
isolate_->counters()->lo_space_bytes_used()->Set(
static_cast<int>(lo_space()->SizeOfObjects()));
#if defined(DEBUG) #if defined(DEBUG)
ReportStatisticsAfterGC(); ReportStatisticsAfterGC();
#endif // DEBUG #endif // DEBUG

View File

@ -246,7 +246,30 @@ namespace internal {
SC(smi_checks_removed, V8.SmiChecksRemoved) \ SC(smi_checks_removed, V8.SmiChecksRemoved) \
SC(map_checks_removed, V8.MapChecksRemoved) \ SC(map_checks_removed, V8.MapChecksRemoved) \
SC(quote_json_char_count, V8.QuoteJsonCharacterCount) \ SC(quote_json_char_count, V8.QuoteJsonCharacterCount) \
SC(quote_json_char_recount, V8.QuoteJsonCharacterReCount) SC(quote_json_char_recount, V8.QuoteJsonCharacterReCount) \
SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable) \
SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted) \
SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed) \
SC(old_pointer_space_bytes_available, \
V8.MemoryOldPointerSpaceBytesAvailable) \
SC(old_pointer_space_bytes_committed, \
V8.MemoryOldPointerSpaceBytesCommitted) \
SC(old_pointer_space_bytes_used, V8.MemoryOldPointerSpaceBytesUsed) \
SC(old_data_space_bytes_available, V8.MemoryOldDataSpaceBytesAvailable) \
SC(old_data_space_bytes_committed, V8.MemoryOldDataSpaceBytesCommitted) \
SC(old_data_space_bytes_used, V8.MemoryOldDataSpaceBytesUsed) \
SC(code_space_bytes_available, V8.MemoryCodeSpaceBytesAvailable) \
SC(code_space_bytes_committed, V8.MemoryCodeSpaceBytesCommitted) \
SC(code_space_bytes_used, V8.MemoryCodeSpaceBytesUsed) \
SC(map_space_bytes_available, V8.MemoryMapSpaceBytesAvailable) \
SC(map_space_bytes_committed, V8.MemoryMapSpaceBytesCommitted) \
SC(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed) \
SC(cell_space_bytes_available, V8.MemoryCellSpaceBytesAvailable) \
SC(cell_space_bytes_committed, V8.MemoryCellSpaceBytesCommitted) \
SC(cell_space_bytes_used, V8.MemoryCellSpaceBytesUsed) \
SC(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable) \
SC(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted) \
SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed)
// This file contains all the v8 counters that are in use. // This file contains all the v8 counters that are in use.