Reviewers: ernstm, Hannes Payer,

Description:
Add a histogram timer around low memory notifications from API

BUG=397026
[email protected],[email protected]
LOG=n

Please review this at https://codereview.chromium.org/416853002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+11, -2 lines):
  M src/api.cc
  M src/counters.h


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 0fcae28294bd86c2f95866b67725ac058a540e95..117427a55d25d9cd23562b5708a9ccaae8676b7b 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5063,7 +5063,11 @@ bool v8::V8::IdleNotification(int hint) {
 void v8::V8::LowMemoryNotification() {
   i::Isolate* isolate = i::Isolate::Current();
   if (isolate == NULL || !isolate->IsInitialized()) return;
-  isolate->heap()->CollectAllAvailableGarbage("low memory notification");
+  {
+    i::HistogramTimerScope idle_notification_scope(
+        isolate->counters()->gc_low_memory_notification());
+    isolate->heap()->CollectAllAvailableGarbage("low memory notification");
+  }
 }


@@ -6723,7 +6727,11 @@ bool v8::Isolate::IdleNotification(int idle_time_in_ms) {

 void v8::Isolate::LowMemoryNotification() {
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
-  isolate->heap()->CollectAllAvailableGarbage("low memory notification");
+  {
+    i::HistogramTimerScope idle_notification_scope(
+        isolate->counters()->gc_low_memory_notification());
+    isolate->heap()->CollectAllAvailableGarbage("low memory notification");
+  }
 }


Index: src/counters.h
diff --git a/src/counters.h b/src/counters.h
index 4a35bf493f2c24809d742e31fcdc2c8db406f360..895caf8e0f548ba8287c74d46c01f406168b1de9 100644
--- a/src/counters.h
+++ b/src/counters.h
@@ -299,6 +299,7 @@ class HistogramTimerScope BASE_EMBEDDED {
   HT(gc_context, V8.GCContext) /* GC context cleanup time */ \
   HT(gc_idle_notification, V8.GCIdleNotification)            \
   HT(gc_incremental_marking, V8.GCIncrementalMarking)        \
+  HT(gc_low_memory_notification, V8.GCLowMemoryNotification) \
   /* Parsing timers. */                                      \
   HT(parse, V8.Parse)                                        \
   HT(parse_lazy, V8.ParseLazy)                               \


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to