Reviewers: Michael Starzinger,
Message:
plz review
Description:
Add histograms for total allocated/live heap size, as well as allocated
size and
percentage of total for map and cell
BUG=none
TEST=none
[email protected]
Please review this at https://chromiumcodereview.appspot.com/10854043/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/heap.cc
M src/v8-counters.h
M src/v8-counters.cc
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
48cf266826dd53b6dae18a328a1959c206c12eb7..ff5328fd99bbd8ce56cbcad319b4afe245b0ec49
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -453,6 +453,20 @@ void Heap::GarbageCollectionEpilogue() {
if (CommittedMemory() > 0) {
isolate_->counters()->external_fragmentation_total()->AddSample(
static_cast<int>(100 - (SizeOfObjects() * 100.0) /
CommittedMemory()));
+
+ isolate_->counters()->map_space_fraction_of_total()->AddSample(
+ static_cast<int>(
+ (map_space()->CommittedMemory() * 100.0) / CommittedMemory()));
+ isolate_->counters()->cell_space_fraction_of_total()->AddSample(
+ static_cast<int>(
+ (cell_space()->CommittedMemory() * 100.0) /
CommittedMemory()));
+
+ isolate_->counters()->total_heap_size()->AddSample(CommittedMemory() /
KB);
+ isolate_->counters()->live_heap_size()->AddSample(SizeOfObjects() /
KB);
+ isolate_->counters()->total_map_space_size()->AddSample(
+ map_space()->CommittedMemory() / KB);
+ isolate_->counters()->total_cell_space_size()->AddSample(
+ cell_space()->CommittedMemory() / KB);
}
#define
UPDATE_COUNTERS_FOR_SPACE(space) \
Index: src/v8-counters.cc
diff --git a/src/v8-counters.cc b/src/v8-counters.cc
index
36b45e2f8e8449d2a7d0636b88121ea924a4e697..3f83dffcae6fb7192056803171390d05cde9e36c
100644
--- a/src/v8-counters.cc
+++ b/src/v8-counters.cc
@@ -45,6 +45,12 @@ Counters::Counters() {
HISTOGRAM_PERCENTAGE_LIST(HP)
#undef HP
+#define HM(name, caption) \
+ Histogram name = { #caption, 1000, 500000, 50, NULL, false }; \
+ name##_ = name;
+ HISTOGRAM_MEMORY_LIST(HM)
+#undef HM
+
#define SC(name, caption) \
StatsCounter name = { "c:" #caption, NULL, false };\
name##_ = name;
@@ -101,6 +107,10 @@ void Counters::ResetHistograms() {
#define HP(name, caption) name##_.Reset();
HISTOGRAM_PERCENTAGE_LIST(HP)
#undef HP
+
+#define HM(name, caption) name##_.Reset();
+ HISTOGRAM_MEMORY_LIST(HM)
+#undef HM
}
} } // namespace v8::internal
Index: src/v8-counters.h
diff --git a/src/v8-counters.h b/src/v8-counters.h
index
4a5755c3e6bd1c03e3b22bec6c2b20702de5b08e..0b97855df554d003096589f5802a77d1c881c833
100644
--- a/src/v8-counters.h
+++ b/src/v8-counters.h
@@ -65,7 +65,18 @@ namespace internal {
HP(external_fragmentation_cell_space, \
V8.MemoryExternalFragmentationCellSpace) \
HP(external_fragmentation_lo_space, \
- V8.MemoryExternalFragmentationLoSpace)
+ V8.MemoryExternalFragmentationLoSpace) \
+ HP(map_space_fraction_of_total, \
+ V8.MemoryFractionMapSpace) \
+ HP(cell_space_fraction_of_total, \
+ V8.MemoryFractionCellSpace) \
+
+
+#define HISTOGRAM_MEMORY_LIST(HM) \
+ HM(total_heap_size, V8.MemoryHeapSizeTotal) \
+ HM(live_heap_size, V8.MemoryHeapSizeLive) \
+ HM(total_map_space_size, V8.MemoryMapSpaceSize) \
+ HM(total_cell_space_size, V8.MemoryCellSpaceSize)
// WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
@@ -303,6 +314,11 @@ class Counters {
HISTOGRAM_PERCENTAGE_LIST(HP)
#undef HP
+#define HM(name, caption) \
+ Histogram* name() { return &name##_; }
+ HISTOGRAM_MEMORY_LIST(HM)
+#undef HM
+
#define SC(name, caption) \
StatsCounter* name() { return &name##_; }
STATS_COUNTER_LIST_1(SC)
@@ -338,6 +354,9 @@ class Counters {
#define PERCENTAGE_ID(name, caption) k_##name,
HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
#undef PERCENTAGE_ID
+#define MEMORY_ID(name, caption) k_##name,
+ HISTOGRAM_MEMORY_LIST(MEMORY_ID)
+#undef MEMORY_ID
#define COUNTER_ID(name, caption) k_##name,
STATS_COUNTER_LIST_1(COUNTER_ID)
STATS_COUNTER_LIST_2(COUNTER_ID)
@@ -376,6 +395,11 @@ class Counters {
HISTOGRAM_PERCENTAGE_LIST(HP)
#undef HP
+#define HM(name, caption) \
+ Histogram name##_;
+ HISTOGRAM_MEMORY_LIST(HM)
+#undef HM
+
#define SC(name, caption) \
StatsCounter name##_;
STATS_COUNTER_LIST_1(SC)
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev