Revision: 12291
Author:   [email protected]
Date:     Fri Aug 10 06:09:31 2012
Log: 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]

Review URL: https://chromiumcodereview.appspot.com/10854043
Patch from Jochen Eisinger <[email protected]>.
http://code.google.com/p/v8/source/detail?r=12291

Modified:
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/v8-counters.cc
 /branches/bleeding_edge/src/v8-counters.h

=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Aug  7 01:19:11 2012
+++ /branches/bleeding_edge/src/heap.cc Fri Aug 10 06:09:31 2012
@@ -453,6 +453,22 @@
   if (CommittedMemory() > 0) {
     isolate_->counters()->external_fragmentation_total()->AddSample(
static_cast<int>(100 - (SizeOfObjects() * 100.0) / CommittedMemory()));
+
+    isolate_->counters()->heap_fraction_map_space()->AddSample(
+        static_cast<int>(
+            (map_space()->CommittedMemory() * 100.0) / CommittedMemory()));
+    isolate_->counters()->heap_fraction_cell_space()->AddSample(
+        static_cast<int>(
+ (cell_space()->CommittedMemory() * 100.0) / CommittedMemory()));
+
+    isolate_->counters()->heap_sample_total_committed()->AddSample(
+        CommittedMemory() / KB);
+    isolate_->counters()->heap_sample_total_used()->AddSample(
+        SizeOfObjects() / KB);
+    isolate_->counters()->heap_sample_map_space_committed()->AddSample(
+        map_space()->CommittedMemory() / KB);
+    isolate_->counters()->heap_sample_cell_space_committed()->AddSample(
+        cell_space()->CommittedMemory() / KB);
   }

#define UPDATE_COUNTERS_FOR_SPACE(space) \
=======================================
--- /branches/bleeding_edge/src/v8-counters.cc  Wed Aug  1 05:51:24 2012
+++ /branches/bleeding_edge/src/v8-counters.cc  Fri Aug 10 06:09:31 2012
@@ -45,6 +45,12 @@
     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 @@
 #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
=======================================
--- /branches/bleeding_edge/src/v8-counters.h   Wed Aug  1 05:51:24 2012
+++ /branches/bleeding_edge/src/v8-counters.h   Fri Aug 10 06:09:31 2012
@@ -65,7 +65,20 @@
   HP(external_fragmentation_cell_space,                               \
      V8.MemoryExternalFragmentationCellSpace)                         \
   HP(external_fragmentation_lo_space,                                 \
-     V8.MemoryExternalFragmentationLoSpace)
+     V8.MemoryExternalFragmentationLoSpace)                           \
+  HP(heap_fraction_map_space,                                         \
+     V8.MemoryHeapFractionMapSpace)                                   \
+  HP(heap_fraction_cell_space,                                        \
+     V8.MemoryHeapFractionCellSpace)                                  \
+
+
+#define HISTOGRAM_MEMORY_LIST(HM)                                     \
+  HM(heap_sample_total_committed, V8.MemoryHeapSampleTotalCommitted)  \
+  HM(heap_sample_total_used, V8.MemoryHeapSampleTotalUsed)            \
+  HM(heap_sample_map_space_committed,                                 \
+     V8.MemoryHeapSampleMapSpaceCommitted)                            \
+  HM(heap_sample_cell_space_committed,                                \
+     V8.MemoryHeapSampleCellSpaceCommitted)


 // WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
@@ -303,6 +316,11 @@
   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 +356,9 @@
 #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 +397,11 @@
   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

Reply via email to