Sample allocation throughput in all idle notifications.
authorulan <ulan@chromium.org>
Mon, 8 Jun 2015 11:23:56 +0000 (04:23 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 8 Jun 2015 11:24:08 +0000 (11:24 +0000)
This removes special handling of long idle notifications.

BUG=

Review URL: https://codereview.chromium.org/1159153003

Cr-Commit-Position: refs/heads/master@{#28833}

src/heap/gc-tracer.cc
src/heap/heap.cc
src/heap/heap.h

index 11c682d..e4d992c 100644 (file)
@@ -273,7 +273,7 @@ void GCTracer::SampleAllocation(double current_ms,
   size_t old_generation_allocated_bytes =
       old_generation_counter_bytes - old_generation_allocation_counter_bytes_;
   double duration = current_ms - allocation_time_ms_;
-  const double kMinDurationMs = 1;
+  const double kMinDurationMs = 100;
   if (duration < kMinDurationMs) {
     // Do not sample small durations to avoid precision errors.
     return;
index 6ef3607..37eb004 100644 (file)
@@ -138,7 +138,6 @@ Heap::Heap()
       store_buffer_(this),
       marking_(this),
       incremental_marking_(this),
-      gc_count_at_last_idle_gc_(0),
       full_codegen_bytes_generated_(0),
       crankshaft_codegen_bytes_generated_(0),
       new_space_allocation_counter_(0),
@@ -4591,8 +4590,7 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState() {
 
 bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
                                  GCIdleTimeHandler::HeapState heap_state,
-                                 double deadline_in_ms,
-                                 bool is_long_idle_notification) {
+                                 double deadline_in_ms) {
   bool result = false;
   switch (action.type) {
     case DONE:
@@ -4623,7 +4621,7 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
       break;
     }
     case DO_FULL_GC: {
-      if (is_long_idle_notification && gc_count_at_last_idle_gc_ == gc_count_) {
+      if (action.reduce_memory) {
         isolate_->compilation_cache()->Clear();
       }
       if (contexts_disposed_) {
@@ -4633,7 +4631,6 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
         CollectAllGarbage(kReduceMemoryFootprintMask,
                           "idle notification: finalize idle round");
       }
-      gc_count_at_last_idle_gc_ = gc_count_;
       gc_idle_time_handler_.NotifyIdleMarkCompact();
       break;
     }
@@ -4653,8 +4650,7 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
 
 void Heap::IdleNotificationEpilogue(GCIdleTimeAction action,
                                     GCIdleTimeHandler::HeapState heap_state,
-                                    double start_ms, double deadline_in_ms,
-                                    bool is_long_idle_notification) {
+                                    double start_ms, double deadline_in_ms) {
   double idle_time_in_ms = deadline_in_ms - start_ms;
   double current_time = MonotonicallyIncreasingTimeInMs();
   last_idle_notification_time_ = current_time;
@@ -4665,15 +4661,6 @@ void Heap::IdleNotificationEpilogue(GCIdleTimeAction action,
   isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample(
       static_cast<int>(idle_time_in_ms));
 
-  if (is_long_idle_notification) {
-    int committed_memory = static_cast<int>(CommittedMemory() / KB);
-    int used_memory = static_cast<int>(heap_state.size_of_objects / KB);
-    isolate()->counters()->aggregated_memory_heap_committed()->AddSample(
-        start_ms, committed_memory);
-    isolate()->counters()->aggregated_memory_heap_used()->AddSample(
-        start_ms, used_memory);
-  }
-
   if (deadline_difference >= 0) {
     if (action.type != DONE && action.type != DO_NOTHING) {
       isolate()->counters()->gc_idle_time_limit_undershot()->AddSample(
@@ -4727,25 +4714,18 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
       isolate_->counters()->gc_idle_notification());
   double start_ms = MonotonicallyIncreasingTimeInMs();
   double idle_time_in_ms = deadline_in_ms - start_ms;
-  bool is_long_idle_notification =
-      static_cast<size_t>(idle_time_in_ms) >
-      GCIdleTimeHandler::kMaxFrameRenderingIdleTime;
 
-  if (is_long_idle_notification) {
-    tracer()->SampleAllocation(start_ms, NewSpaceAllocationCounter(),
-                               OldGenerationAllocationCounter());
-  }
+  tracer()->SampleAllocation(start_ms, NewSpaceAllocationCounter(),
+                             OldGenerationAllocationCounter());
 
   GCIdleTimeHandler::HeapState heap_state = ComputeHeapState();
 
   GCIdleTimeAction action =
       gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state);
 
-  bool result = PerformIdleTimeAction(action, heap_state, deadline_in_ms,
-                                      is_long_idle_notification);
+  bool result = PerformIdleTimeAction(action, heap_state, deadline_in_ms);
 
-  IdleNotificationEpilogue(action, heap_state, start_ms, deadline_in_ms,
-                           is_long_idle_notification);
+  IdleNotificationEpilogue(action, heap_state, start_ms, deadline_in_ms);
   return result;
 }
 
index 8a8bb3f..2782ed8 100644 (file)
@@ -2154,13 +2154,11 @@ class Heap {
 
   bool PerformIdleTimeAction(GCIdleTimeAction action,
                              GCIdleTimeHandler::HeapState heap_state,
-                             double deadline_in_ms,
-                             bool is_long_idle_notification);
+                             double deadline_in_ms);
 
   void IdleNotificationEpilogue(GCIdleTimeAction action,
                                 GCIdleTimeHandler::HeapState heap_state,
-                                double start_ms, double deadline_in_ms,
-                                bool is_long_idle_notification);
+                                double start_ms, double deadline_in_ms);
 
   void ClearObjectStats(bool clear_last_time_stats = false);
 
@@ -2211,8 +2209,6 @@ class Heap {
 
   GCIdleTimeHandler gc_idle_time_handler_;
 
-  unsigned int gc_count_at_last_idle_gc_;
-
   // These two counters are monotomically increasing and never reset.
   size_t full_codegen_bytes_generated_;
   size_t crankshaft_codegen_bytes_generated_;