Reviewers: Michael Starzinger,
Message:
plz review
Description:
Add histogram for total heap fragmentation, don't report fragmentation for
new
space, and report fragmentation, not usage
BUG=none
TEST=none
Please review this at https://chromiumcodereview.appspot.com/10778009/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/heap.cc
M src/v8-counters.h
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
309d0adf02ae1310cf654b9b261ba7632f1f336f..37adeb491977c147acb21c7e3ebab4cfeb258a9f
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -447,26 +447,39 @@ void Heap::GarbageCollectionEpilogue() {
isolate_->counters()->number_of_symbols()->Set(
symbol_table()->NumberOfElements());
+ if (isolate()->memory_allocator()->Size() > 0) {
+ isolate_->counters()->external_fragmentation_total->AddSample(
+ static_cast<int>(100 -
+ (SizeOfObjects() * 100) /
isolate()->memory_allocator()->Size()));
+ }
+
#define
UPDATE_COUNTERS_FOR_SPACE(space) \
isolate_->counters()->space##_bytes_available()->Set( \
static_cast<int>(space()->Available())); \
isolate_->counters()->space##_bytes_committed()->Set( \
static_cast<int>(space()->CommittedMemory())); \
isolate_->counters()->space##_bytes_used()->Set( \
-
static_cast<int>(space()->SizeOfObjects())); \
+ static_cast<int>(space()->SizeOfObjects()));
+#define
UPDATE_FRAGMENTATION_FOR_SPACE(space) \
if (space()->CommittedMemory() > 0)
{ \
isolate_->counters()->external_fragmentation_##space()->AddSample( \
-
static_cast<int>( \
+ static_cast<int>(100
- \
(space()->SizeOfObjects() * 100) /
space()->CommittedMemory())); \
}
+#define
UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(space) \
+
UPDATE_COUNTERS_FOR_SPACE(space) \
+ UPDATE_FRAGMENTATION_FOR_SPACE(space)
+
UPDATE_COUNTERS_FOR_SPACE(new_space)
- UPDATE_COUNTERS_FOR_SPACE(old_pointer_space)
- UPDATE_COUNTERS_FOR_SPACE(old_data_space)
- UPDATE_COUNTERS_FOR_SPACE(code_space)
- UPDATE_COUNTERS_FOR_SPACE(map_space)
- UPDATE_COUNTERS_FOR_SPACE(cell_space)
- UPDATE_COUNTERS_FOR_SPACE(lo_space)
+ UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(old_pointer_space)
+ UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(old_data_space)
+ UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(code_space)
+ UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(map_space)
+ UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(cell_space)
+ UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(lo_space)
#undef UPDATE_COUNTERS_FOR_SPACE
+#undef UPDATE_FRAGMENTATION_FOR_SPACE
+#undef UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE
#if defined(DEBUG)
ReportStatisticsAfterGC();
Index: src/v8-counters.h
diff --git a/src/v8-counters.h b/src/v8-counters.h
index
e05a3065dd7384a9c7f1f54e47d8bfc475d71ea7..307d60ec7c27a47c91e69d04a50632eca50deb68
100644
--- a/src/v8-counters.h
+++ b/src/v8-counters.h
@@ -52,6 +52,8 @@ namespace internal {
#define HISTOGRAM_PERCENTAGE_LIST(HP) \
+ HP(external_fragmentation_total, \
+ V8.MemoryExternalFragmentationTotal) \
HP(external_fragmentation_new_space, \
V8.MemoryExternalFragmentationNewSpace) \
HP(external_fragmentation_old_pointer_space, \
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev