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

Side by Side Diff: src/heap.cc

Issue 11595006: Precisely measure duration of mark and sweep phases. Changed print_cumulative_gc_stat flag to only … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 amount_of_external_allocated_memory_(0), 127 amount_of_external_allocated_memory_(0),
128 amount_of_external_allocated_memory_at_last_global_gc_(0), 128 amount_of_external_allocated_memory_at_last_global_gc_(0),
129 old_gen_exhausted_(false), 129 old_gen_exhausted_(false),
130 store_buffer_rebuilder_(store_buffer()), 130 store_buffer_rebuilder_(store_buffer()),
131 hidden_symbol_(NULL), 131 hidden_symbol_(NULL),
132 global_gc_prologue_callback_(NULL), 132 global_gc_prologue_callback_(NULL),
133 global_gc_epilogue_callback_(NULL), 133 global_gc_epilogue_callback_(NULL),
134 gc_safe_size_of_old_object_(NULL), 134 gc_safe_size_of_old_object_(NULL),
135 total_regexp_code_generated_(0), 135 total_regexp_code_generated_(0),
136 tracer_(NULL), 136 tracer_(NULL),
137 marking_time_(0.0),
138 sweeping_time_(0.0),
137 young_survivors_after_last_gc_(0), 139 young_survivors_after_last_gc_(0),
138 high_survival_rate_period_length_(0), 140 high_survival_rate_period_length_(0),
139 low_survival_rate_period_length_(0), 141 low_survival_rate_period_length_(0),
140 survival_rate_(0), 142 survival_rate_(0),
141 previous_survival_rate_trend_(Heap::STABLE), 143 previous_survival_rate_trend_(Heap::STABLE),
142 survival_rate_trend_(Heap::STABLE), 144 survival_rate_trend_(Heap::STABLE),
143 max_gc_pause_(0), 145 max_gc_pause_(0),
144 total_gc_time_ms_(0), 146 total_gc_time_ms_(0),
145 max_alive_after_gc_(0), 147 max_alive_after_gc_(0),
146 min_in_mutator_(kMaxInt), 148 min_in_mutator_(kMaxInt),
(...skipping 6079 matching lines...) Expand 10 before | Expand all | Expand 10 after
6226 6228
6227 6229
6228 void Heap::TearDown() { 6230 void Heap::TearDown() {
6229 #ifdef VERIFY_HEAP 6231 #ifdef VERIFY_HEAP
6230 if (FLAG_verify_heap) { 6232 if (FLAG_verify_heap) {
6231 Verify(); 6233 Verify();
6232 } 6234 }
6233 #endif 6235 #endif
6234 6236
6235 if (FLAG_print_cumulative_gc_stat) { 6237 if (FLAG_print_cumulative_gc_stat) {
6236 PrintF("\n\n"); 6238 PrintF("\n");
6237 PrintF("gc_count=%d ", gc_count_); 6239 PrintF("gc_count=%d ", gc_count_);
6238 PrintF("mark_sweep_count=%d ", ms_count_); 6240 PrintF("mark_sweep_count=%d ", ms_count_);
6239 PrintF("max_gc_pause=%d ", get_max_gc_pause()); 6241 PrintF("max_gc_pause=%d ", get_max_gc_pause());
6240 PrintF("total_gc_time=%d ", total_gc_time_ms_); 6242 PrintF("total_gc_time=%d ", total_gc_time_ms_);
6241 PrintF("min_in_mutator=%d ", get_min_in_mutator()); 6243 PrintF("min_in_mutator=%d ", get_min_in_mutator());
6242 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", 6244 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ",
6243 get_max_alive_after_gc()); 6245 get_max_alive_after_gc());
6246 PrintF("total_marking_time=%f ", marking_time());
6247 PrintF("total_sweeping_time=%f ", sweeping_time());
6244 PrintF("\n\n"); 6248 PrintF("\n\n");
6245 } 6249 }
6246 6250
6247 isolate_->global_handles()->TearDown(); 6251 isolate_->global_handles()->TearDown();
6248 6252
6249 external_string_table_.TearDown(); 6253 external_string_table_.TearDown();
6250 6254
6251 error_object_list_.TearDown(); 6255 error_object_list_.TearDown();
6252 6256
6253 new_space_.TearDown(); 6257 new_space_.TearDown();
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
6895 if (heap_->last_gc_end_timestamp_ > 0) { 6899 if (heap_->last_gc_end_timestamp_ > 0) {
6896 spent_in_mutator_ = Max(start_time_ - heap_->last_gc_end_timestamp_, 0.0); 6900 spent_in_mutator_ = Max(start_time_ - heap_->last_gc_end_timestamp_, 0.0);
6897 } 6901 }
6898 6902
6899 steps_count_ = heap_->incremental_marking()->steps_count(); 6903 steps_count_ = heap_->incremental_marking()->steps_count();
6900 steps_took_ = heap_->incremental_marking()->steps_took(); 6904 steps_took_ = heap_->incremental_marking()->steps_took();
6901 longest_step_ = heap_->incremental_marking()->longest_step(); 6905 longest_step_ = heap_->incremental_marking()->longest_step();
6902 steps_count_since_last_gc_ = 6906 steps_count_since_last_gc_ =
6903 heap_->incremental_marking()->steps_count_since_last_gc(); 6907 heap_->incremental_marking()->steps_count_since_last_gc();
6904 steps_took_since_last_gc_ = 6908 steps_took_since_last_gc_ =
6905 heap_->incremental_marking()->steps_took_since_last_gc(); 6909 heap_->incremental_marking()->steps_took_since_last_gc();
Michael Starzinger 2013/01/28 13:55:39 As discussed offline, the GCTracer should ask the
Hannes Payer (out of office) 2013/01/29 12:01:54 I think the current solution is the "cleanest" hac
6906 } 6910 }
6907 6911
6908 6912
6909 GCTracer::~GCTracer() { 6913 GCTracer::~GCTracer() {
6910 // Printf ONE line iff flag is set. 6914 // Printf ONE line iff flag is set.
6911 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; 6915 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
6912 6916
6913 bool first_gc = (heap_->last_gc_end_timestamp_ == 0); 6917 bool first_gc = (heap_->last_gc_end_timestamp_ == 0);
6914 6918
6915 heap_->alive_after_last_gc_ = heap_->SizeOfObjects(); 6919 heap_->alive_after_last_gc_ = heap_->SizeOfObjects();
(...skipping 10 matching lines...) Expand all
6926 if (!first_gc) { 6930 if (!first_gc) {
6927 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_, 6931 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_,
6928 static_cast<int>(spent_in_mutator_)); 6932 static_cast<int>(spent_in_mutator_));
6929 } 6933 }
6930 } else if (FLAG_trace_gc_verbose) { 6934 } else if (FLAG_trace_gc_verbose) {
6931 heap_->total_gc_time_ms_ += time; 6935 heap_->total_gc_time_ms_ += time;
6932 } 6936 }
6933 6937
6934 if (collector_ == SCAVENGER && FLAG_trace_gc_ignore_scavenger) return; 6938 if (collector_ == SCAVENGER && FLAG_trace_gc_ignore_scavenger) return;
6935 6939
6940 heap_->AddMarkingTime(scopes_[Scope::MC_MARK]);
6941
6942 if (FLAG_print_cumulative_gc_stat && !FLAG_trace_gc) return;
6936 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); 6943 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
6937 6944
6938 if (!FLAG_trace_gc_nvp) { 6945 if (!FLAG_trace_gc_nvp) {
6939 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]); 6946 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]);
6940 6947
6941 double end_memory_size_mb = 6948 double end_memory_size_mb =
6942 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB; 6949 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB;
6943 6950
6944 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", 6951 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ",
6945 CollectorString(), 6952 CollectorString(),
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
7406 static_cast<int>(object_sizes_last_time_[index])); 7413 static_cast<int>(object_sizes_last_time_[index]));
7407 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7414 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7408 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7415 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7409 7416
7410 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7417 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7411 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7418 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7412 ClearObjectStats(); 7419 ClearObjectStats();
7413 } 7420 }
7414 7421
7415 } } // namespace v8::internal 7422 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698