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

Side by Side Diff: src/heap.cc

Issue 10536147: Adjust GC tracing: add a flag to ignore scavenger traces and print total GC time in verbose mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix PrintF to PrintPID Created 8 years, 4 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.h ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 global_gc_epilogue_callback_(NULL), 132 global_gc_epilogue_callback_(NULL),
133 gc_safe_size_of_old_object_(NULL), 133 gc_safe_size_of_old_object_(NULL),
134 total_regexp_code_generated_(0), 134 total_regexp_code_generated_(0),
135 tracer_(NULL), 135 tracer_(NULL),
136 young_survivors_after_last_gc_(0), 136 young_survivors_after_last_gc_(0),
137 high_survival_rate_period_length_(0), 137 high_survival_rate_period_length_(0),
138 survival_rate_(0), 138 survival_rate_(0),
139 previous_survival_rate_trend_(Heap::STABLE), 139 previous_survival_rate_trend_(Heap::STABLE),
140 survival_rate_trend_(Heap::STABLE), 140 survival_rate_trend_(Heap::STABLE),
141 max_gc_pause_(0), 141 max_gc_pause_(0),
142 total_gc_time_ms_(0),
142 max_alive_after_gc_(0), 143 max_alive_after_gc_(0),
143 min_in_mutator_(kMaxInt), 144 min_in_mutator_(kMaxInt),
144 alive_after_last_gc_(0), 145 alive_after_last_gc_(0),
145 last_gc_end_timestamp_(0.0), 146 last_gc_end_timestamp_(0.0),
146 store_buffer_(this), 147 store_buffer_(this),
147 marking_(this), 148 marking_(this),
148 incremental_marking_(this), 149 incremental_marking_(this),
149 number_idle_notifications_(0), 150 number_idle_notifications_(0),
150 last_idle_notification_gc_count_(0), 151 last_idle_notification_gc_count_(0),
151 last_idle_notification_gc_count_init_(false), 152 last_idle_notification_gc_count_init_(false),
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 ", committed: %6" V8_PTR_PREFIX "d KB\n", 363 ", committed: %6" V8_PTR_PREFIX "d KB\n",
363 cell_space_->SizeOfObjects() / KB, 364 cell_space_->SizeOfObjects() / KB,
364 cell_space_->Available() / KB, 365 cell_space_->Available() / KB,
365 cell_space_->CommittedMemory() / KB); 366 cell_space_->CommittedMemory() / KB);
366 PrintPID("Large object space, used: %6" V8_PTR_PREFIX "d KB" 367 PrintPID("Large object space, used: %6" V8_PTR_PREFIX "d KB"
367 ", available: %6" V8_PTR_PREFIX "d KB" 368 ", available: %6" V8_PTR_PREFIX "d KB"
368 ", committed: %6" V8_PTR_PREFIX "d KB\n", 369 ", committed: %6" V8_PTR_PREFIX "d KB\n",
369 lo_space_->SizeOfObjects() / KB, 370 lo_space_->SizeOfObjects() / KB,
370 lo_space_->Available() / KB, 371 lo_space_->Available() / KB,
371 lo_space_->CommittedMemory() / KB); 372 lo_space_->CommittedMemory() / KB);
373 PrintPID("Total time spent in GC : %d ms\n", total_gc_time_ms_);
372 } 374 }
373 375
374 376
375 // TODO(1238405): Combine the infrastructure for --heap-stats and 377 // TODO(1238405): Combine the infrastructure for --heap-stats and
376 // --log-gc to avoid the complicated preprocessor and flag testing. 378 // --log-gc to avoid the complicated preprocessor and flag testing.
377 void Heap::ReportStatisticsAfterGC() { 379 void Heap::ReportStatisticsAfterGC() {
378 // Similar to the before GC, we use some complicated logic to ensure that 380 // Similar to the before GC, we use some complicated logic to ensure that
379 // NewSpace statistics are logged exactly once when --log-gc is turned on. 381 // NewSpace statistics are logged exactly once when --log-gc is turned on.
380 #if defined(DEBUG) 382 #if defined(DEBUG)
381 if (FLAG_heap_stats) { 383 if (FLAG_heap_stats) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 #ifdef DEBUG 541 #ifdef DEBUG
540 // Reset the allocation timeout to the GC interval, but make sure to 542 // Reset the allocation timeout to the GC interval, but make sure to
541 // allow at least a few allocations after a collection. The reason 543 // allow at least a few allocations after a collection. The reason
542 // for this is that we have a lot of allocation sequences and we 544 // for this is that we have a lot of allocation sequences and we
543 // assume that a garbage collection will allow the subsequent 545 // assume that a garbage collection will allow the subsequent
544 // allocation attempts to go through. 546 // allocation attempts to go through.
545 allocation_timeout_ = Max(6, FLAG_gc_interval); 547 allocation_timeout_ = Max(6, FLAG_gc_interval);
546 #endif 548 #endif
547 549
548 if (collector == SCAVENGER && !incremental_marking()->IsStopped()) { 550 if (collector == SCAVENGER && !incremental_marking()->IsStopped()) {
549 if (FLAG_trace_incremental_marking) { 551 if (FLAG_trace_incremental_marking && !FLAG_trace_gc_ignore_scavenger) {
Michael Starzinger 2012/08/06 14:21:36 Actually, I would like to see that with --trace-in
ulan 2012/08/06 14:28:15 Done.
550 PrintF("[IncrementalMarking] Scavenge during marking.\n"); 552 PrintF("[IncrementalMarking] Scavenge during marking.\n");
551 } 553 }
552 } 554 }
553 555
554 if (collector == MARK_COMPACTOR && 556 if (collector == MARK_COMPACTOR &&
555 !mark_compact_collector()->abort_incremental_marking_ && 557 !mark_compact_collector()->abort_incremental_marking_ &&
556 !incremental_marking()->IsStopped() && 558 !incremental_marking()->IsStopped() &&
557 !incremental_marking()->should_hurry() && 559 !incremental_marking()->should_hurry() &&
558 FLAG_incremental_marking_steps) { 560 FLAG_incremental_marking_steps) {
559 // Make progress in incremental marking. 561 // Make progress in incremental marking.
(...skipping 5618 matching lines...) Expand 10 before | Expand all | Expand 10 after
6178 #ifdef DEBUG 6180 #ifdef DEBUG
6179 if (FLAG_verify_heap) { 6181 if (FLAG_verify_heap) {
6180 Verify(); 6182 Verify();
6181 } 6183 }
6182 #endif 6184 #endif
6183 if (FLAG_print_cumulative_gc_stat) { 6185 if (FLAG_print_cumulative_gc_stat) {
6184 PrintF("\n\n"); 6186 PrintF("\n\n");
6185 PrintF("gc_count=%d ", gc_count_); 6187 PrintF("gc_count=%d ", gc_count_);
6186 PrintF("mark_sweep_count=%d ", ms_count_); 6188 PrintF("mark_sweep_count=%d ", ms_count_);
6187 PrintF("max_gc_pause=%d ", get_max_gc_pause()); 6189 PrintF("max_gc_pause=%d ", get_max_gc_pause());
6190 PrintF("total_gc_time=%d ", total_gc_time_ms_);
6188 PrintF("min_in_mutator=%d ", get_min_in_mutator()); 6191 PrintF("min_in_mutator=%d ", get_min_in_mutator());
6189 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", 6192 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ",
6190 get_max_alive_after_gc()); 6193 get_max_alive_after_gc());
6191 PrintF("\n\n"); 6194 PrintF("\n\n");
6192 } 6195 }
6193 6196
6194 isolate_->global_handles()->TearDown(); 6197 isolate_->global_handles()->TearDown();
6195 6198
6196 external_string_table_.TearDown(); 6199 external_string_table_.TearDown();
6197 6200
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
6859 6862
6860 bool first_gc = (heap_->last_gc_end_timestamp_ == 0); 6863 bool first_gc = (heap_->last_gc_end_timestamp_ == 0);
6861 6864
6862 heap_->alive_after_last_gc_ = heap_->SizeOfObjects(); 6865 heap_->alive_after_last_gc_ = heap_->SizeOfObjects();
6863 heap_->last_gc_end_timestamp_ = OS::TimeCurrentMillis(); 6866 heap_->last_gc_end_timestamp_ = OS::TimeCurrentMillis();
6864 6867
6865 int time = static_cast<int>(heap_->last_gc_end_timestamp_ - start_time_); 6868 int time = static_cast<int>(heap_->last_gc_end_timestamp_ - start_time_);
6866 6869
6867 // Update cumulative GC statistics if required. 6870 // Update cumulative GC statistics if required.
6868 if (FLAG_print_cumulative_gc_stat) { 6871 if (FLAG_print_cumulative_gc_stat) {
6872 heap_->total_gc_time_ms_ += time;
6869 heap_->max_gc_pause_ = Max(heap_->max_gc_pause_, time); 6873 heap_->max_gc_pause_ = Max(heap_->max_gc_pause_, time);
6870 heap_->max_alive_after_gc_ = Max(heap_->max_alive_after_gc_, 6874 heap_->max_alive_after_gc_ = Max(heap_->max_alive_after_gc_,
6871 heap_->alive_after_last_gc_); 6875 heap_->alive_after_last_gc_);
6872 if (!first_gc) { 6876 if (!first_gc) {
6873 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_, 6877 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_,
6874 static_cast<int>(spent_in_mutator_)); 6878 static_cast<int>(spent_in_mutator_));
6875 } 6879 }
6880 } else if (FLAG_trace_gc_verbose) {
6881 heap_->total_gc_time_ms_ += time;
6876 } 6882 }
6877 6883
6884 if (collector_ == SCAVENGER && FLAG_trace_gc_ignore_scavenger) return;
6885
6878 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); 6886 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
6879
Michael Starzinger 2012/08/06 14:21:36 Can we have that empty newline back?
ulan 2012/08/06 14:28:15 Done.
6880 if (!FLAG_trace_gc_nvp) { 6887 if (!FLAG_trace_gc_nvp) {
6881 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]); 6888 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]);
6882 6889
6883 double end_memory_size_mb = 6890 double end_memory_size_mb =
6884 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB; 6891 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB;
6885 6892
6886 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", 6893 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ",
6887 CollectorString(), 6894 CollectorString(),
6888 static_cast<double>(start_object_size_) / MB, 6895 static_cast<double>(start_object_size_) / MB,
6889 static_cast<double>(start_memory_size_) / MB, 6896 static_cast<double>(start_memory_size_) / MB,
(...skipping 20 matching lines...) Expand all
6910 PrintF(" [%s]", gc_reason_); 6917 PrintF(" [%s]", gc_reason_);
6911 } 6918 }
6912 6919
6913 if (collector_reason_ != NULL) { 6920 if (collector_reason_ != NULL) {
6914 PrintF(" [%s]", collector_reason_); 6921 PrintF(" [%s]", collector_reason_);
6915 } 6922 }
6916 6923
6917 PrintF(".\n"); 6924 PrintF(".\n");
6918 } else { 6925 } else {
6919 PrintF("pause=%d ", time); 6926 PrintF("pause=%d ", time);
6920 PrintF("mutator=%d ", 6927 PrintF("mutator=%d ", static_cast<int>(spent_in_mutator_));
6921 static_cast<int>(spent_in_mutator_));
6922
6923 PrintF("gc="); 6928 PrintF("gc=");
6924 switch (collector_) { 6929 switch (collector_) {
6925 case SCAVENGER: 6930 case SCAVENGER:
6926 PrintF("s"); 6931 PrintF("s");
6927 break; 6932 break;
6928 case MARK_COMPACTOR: 6933 case MARK_COMPACTOR:
6929 PrintF("ms"); 6934 PrintF("ms");
6930 break; 6935 break;
6931 default: 6936 default:
6932 UNREACHABLE(); 6937 UNREACHABLE();
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
7238 static_cast<int>(object_sizes_last_time_[index])); 7243 static_cast<int>(object_sizes_last_time_[index]));
7239 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7244 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7240 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7245 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7241 7246
7242 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7247 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7243 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7248 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7244 ClearObjectStats(); 7249 ClearObjectStats();
7245 } 7250 }
7246 7251
7247 } } // namespace v8::internal 7252 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698