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

Side by Side Diff: src/heap/heap.cc

Issue 521873006: Trace idle notification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap/gc-idle-time-handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/once.h" 9 #include "src/base/once.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 4269 matching lines...) Expand 10 before | Expand all | Expand 10 after
4280 4280
4281 bool Heap::WorthActivatingIncrementalMarking() { 4281 bool Heap::WorthActivatingIncrementalMarking() {
4282 return incremental_marking()->IsStopped() && 4282 return incremental_marking()->IsStopped() &&
4283 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); 4283 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull();
4284 } 4284 }
4285 4285
4286 4286
4287 bool Heap::IdleNotification(int idle_time_in_ms) { 4287 bool Heap::IdleNotification(int idle_time_in_ms) {
4288 // If incremental marking is off, we do not perform idle notification. 4288 // If incremental marking is off, we do not perform idle notification.
4289 if (!FLAG_incremental_marking) return true; 4289 if (!FLAG_incremental_marking) return true;
4290 base::ElapsedTimer timer;
4291 if (FLAG_trace_idle_notification) {
4292 timer.Start();
4293 }
4290 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( 4294 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample(
4291 idle_time_in_ms); 4295 idle_time_in_ms);
4292 HistogramTimerScope idle_notification_scope( 4296 HistogramTimerScope idle_notification_scope(
4293 isolate_->counters()->gc_idle_notification()); 4297 isolate_->counters()->gc_idle_notification());
4294 4298
4295 GCIdleTimeHandler::HeapState heap_state; 4299 GCIdleTimeHandler::HeapState heap_state;
4296 heap_state.contexts_disposed = contexts_disposed_; 4300 heap_state.contexts_disposed = contexts_disposed_;
4297 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); 4301 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects());
4298 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); 4302 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped();
4299 // TODO(ulan): Start incremental marking only for large heaps. 4303 // TODO(ulan): Start incremental marking only for large heaps.
(...skipping 29 matching lines...) Expand all
4329 case DO_SCAVENGE: 4333 case DO_SCAVENGE:
4330 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); 4334 CollectGarbage(NEW_SPACE, "idle notification: scavenge");
4331 break; 4335 break;
4332 case DO_FINALIZE_SWEEPING: 4336 case DO_FINALIZE_SWEEPING:
4333 mark_compact_collector()->EnsureSweepingCompleted(); 4337 mark_compact_collector()->EnsureSweepingCompleted();
4334 break; 4338 break;
4335 case DO_NOTHING: 4339 case DO_NOTHING:
4336 result = true; 4340 result = true;
4337 break; 4341 break;
4338 } 4342 }
4343 if (FLAG_trace_idle_notification) {
4344 int actual_time_ms = static_cast<int>(timer.Elapsed().InMilliseconds());
4345 PrintF("Idle notification: requested idle time %d ms, actual time %d ms [",
4346 idle_time_in_ms, actual_time_ms);
4347 action.Print();
4348 PrintF("]\n");
4349 }
4339 4350
4340 return result; 4351 return result;
4341 } 4352 }
4342 4353
4343 4354
4344 #ifdef DEBUG 4355 #ifdef DEBUG
4345 4356
4346 void Heap::Print() { 4357 void Heap::Print() {
4347 if (!HasBeenSetUp()) return; 4358 if (!HasBeenSetUp()) return;
4348 isolate()->PrintStack(stdout); 4359 isolate()->PrintStack(stdout);
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after
6109 static_cast<int>(object_sizes_last_time_[index])); 6120 static_cast<int>(object_sizes_last_time_[index]));
6110 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6121 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6111 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6122 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6112 6123
6113 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6124 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6114 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6125 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6115 ClearObjectStats(); 6126 ClearObjectStats();
6116 } 6127 }
6117 } 6128 }
6118 } // namespace v8::internal 6129 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/gc-idle-time-handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698