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

Unified Diff: src/heap.cc

Issue 10695056: Factor out a Histogram class from HistogramTimer, and use it to measure external fragmentation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: percentages Created 8 years, 5 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
« no previous file with comments | « src/counters.cc ('k') | src/v8-counters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index a448292789ad72511cb6c6922dc903bc1f14eb8a..8cf1af84f11ebc3656690bce58e1aec27f6d37c4 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -445,54 +445,26 @@ void Heap::GarbageCollectionEpilogue() {
isolate_->counters()->number_of_symbols()->Set(
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()));
+#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())); \
+ if (space()->CommittedMemory() > 0) { \
+ isolate_->counters()->external_fragmentation_##space()->AddSample( \
+ static_cast<int>( \
+ (space()->SizeOfObjects() * 100) / space()->CommittedMemory())); \
+ }
+ 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)
+#undef UPDATE_COUNTERS_FOR_SPACE
#if defined(DEBUG)
ReportStatisticsAfterGC();
« no previous file with comments | « src/counters.cc ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698