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

Side by Side Diff: src/heap/gc-tracer.cc

Issue 710603003: Perform context disposal garbage collections only if contexts disposals happen at a high rate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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-tracer.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/heap/gc-tracer.h" 7 #include "src/heap/gc-tracer.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 11
12 static intptr_t CountTotalHolesSize(Heap* heap) { 12 static intptr_t CountTotalHolesSize(Heap* heap) {
13 intptr_t holes_size = 0; 13 intptr_t holes_size = 0;
14 OldSpaces spaces(heap); 14 OldSpaces spaces(heap);
15 for (OldSpace* space = spaces.next(); space != NULL; space = spaces.next()) { 15 for (OldSpace* space = spaces.next(); space != NULL; space = spaces.next()) {
16 holes_size += space->Waste() + space->Available(); 16 holes_size += space->Waste() + space->Available();
17 } 17 }
18 return holes_size; 18 return holes_size;
19 } 19 }
20 20
21 21
22 GCTracer::AllocationEvent::AllocationEvent(double duration, 22 GCTracer::AllocationEvent::AllocationEvent(double duration,
23 intptr_t allocation_in_bytes) { 23 intptr_t allocation_in_bytes) {
24 duration_ = duration; 24 duration_ = duration;
25 allocation_in_bytes_ = allocation_in_bytes; 25 allocation_in_bytes_ = allocation_in_bytes;
26 } 26 }
27 27
28 28
29 GCTracer::ContextDisposalEvent::ContextDisposalEvent(double time) {
30 time_ = time;
31 }
32
33
29 GCTracer::Event::Event(Type type, const char* gc_reason, 34 GCTracer::Event::Event(Type type, const char* gc_reason,
30 const char* collector_reason) 35 const char* collector_reason)
31 : type(type), 36 : type(type),
32 gc_reason(gc_reason), 37 gc_reason(gc_reason),
33 collector_reason(collector_reason), 38 collector_reason(collector_reason),
34 start_time(0.0), 39 start_time(0.0),
35 end_time(0.0), 40 end_time(0.0),
36 start_object_size(0), 41 start_object_size(0),
37 end_object_size(0), 42 end_object_size(0),
38 start_memory_size(0), 43 start_memory_size(0),
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 205 }
201 } 206 }
202 207
203 208
204 void GCTracer::AddNewSpaceAllocationTime(double duration, 209 void GCTracer::AddNewSpaceAllocationTime(double duration,
205 intptr_t allocation_in_bytes) { 210 intptr_t allocation_in_bytes) {
206 allocation_events_.push_front(AllocationEvent(duration, allocation_in_bytes)); 211 allocation_events_.push_front(AllocationEvent(duration, allocation_in_bytes));
207 } 212 }
208 213
209 214
215 void GCTracer::AddContextDisposalTime(double time) {
216 context_disposal_events_.push_front(ContextDisposalEvent(time));
217 }
218
219
210 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) { 220 void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) {
211 cumulative_incremental_marking_steps_++; 221 cumulative_incremental_marking_steps_++;
212 cumulative_incremental_marking_bytes_ += bytes; 222 cumulative_incremental_marking_bytes_ += bytes;
213 cumulative_incremental_marking_duration_ += duration; 223 cumulative_incremental_marking_duration_ += duration;
214 longest_incremental_marking_step_ = 224 longest_incremental_marking_step_ =
215 Max(longest_incremental_marking_step_, duration); 225 Max(longest_incremental_marking_step_, duration);
216 cumulative_marking_duration_ += duration; 226 cumulative_marking_duration_ += duration;
217 if (bytes > 0) { 227 if (bytes > 0) {
218 cumulative_pure_incremental_marking_duration_ += duration; 228 cumulative_pure_incremental_marking_duration_ += duration;
219 } 229 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); 322 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_);
313 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", 323 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ",
314 heap_->semi_space_copied_object_size_); 324 heap_->semi_space_copied_object_size_);
315 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); 325 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_);
316 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); 326 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_);
317 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); 327 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_);
318 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); 328 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_);
319 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); 329 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);
320 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ", 330 PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ",
321 NewSpaceAllocationThroughputInBytesPerMillisecond()); 331 NewSpaceAllocationThroughputInBytesPerMillisecond());
332 PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds());
322 333
323 if (current_.type == Event::SCAVENGER) { 334 if (current_.type == Event::SCAVENGER) {
324 PrintF("steps_count=%d ", current_.incremental_marking_steps); 335 PrintF("steps_count=%d ", current_.incremental_marking_steps);
325 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); 336 PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
326 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ", 337 PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ",
327 ScavengeSpeedInBytesPerMillisecond()); 338 ScavengeSpeedInBytesPerMillisecond());
328 } else { 339 } else {
329 PrintF("steps_count=%d ", current_.incremental_marking_steps); 340 PrintF("steps_count=%d ", current_.incremental_marking_steps);
330 PrintF("steps_took=%.1f ", current_.incremental_marking_duration); 341 PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
331 PrintF("longest_step=%.1f ", current_.longest_incremental_marking_step); 342 PrintF("longest_step=%.1f ", current_.longest_incremental_marking_step);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 while (iter != allocation_events_.end()) { 480 while (iter != allocation_events_.end()) {
470 bytes += iter->allocation_in_bytes_; 481 bytes += iter->allocation_in_bytes_;
471 durations += iter->duration_; 482 durations += iter->duration_;
472 ++iter; 483 ++iter;
473 } 484 }
474 485
475 if (durations == 0.0) return 0; 486 if (durations == 0.0) return 0;
476 487
477 return static_cast<intptr_t>(bytes / durations); 488 return static_cast<intptr_t>(bytes / durations);
478 } 489 }
490
491
492 double GCTracer::ContextDisposalRateInMilliseconds() const {
493 if (context_disposal_events_.size() == 0) return 0.0;
494
495 double begin = context_disposal_events_.begin()->time_;
496 double end = 0.0;
497 ContextDisposalEventBuffer::const_iterator iter =
498 context_disposal_events_.begin();
499 while (iter != context_disposal_events_.end()) {
500 end = iter->time_;
501 ++iter;
502 }
503
504 return (begin - end) / context_disposal_events_.size();
505 }
479 } 506 }
480 } // namespace v8::internal 507 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/gc-tracer.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698