OLD | NEW |
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 Loading... |
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 low_survival_rate_period_length_(0), | 138 low_survival_rate_period_length_(0), |
139 survival_rate_(0), | 139 survival_rate_(0), |
140 previous_survival_rate_trend_(Heap::STABLE), | 140 previous_survival_rate_trend_(Heap::STABLE), |
141 survival_rate_trend_(Heap::STABLE), | 141 survival_rate_trend_(Heap::STABLE), |
142 max_gc_pause_(0), | 142 max_gc_pause_(0.0), |
143 total_gc_time_ms_(0), | 143 total_gc_time_ms_(0.0), |
144 max_alive_after_gc_(0), | 144 max_alive_after_gc_(0), |
145 min_in_mutator_(kMaxInt), | 145 min_in_mutator_(kMaxInt), |
146 alive_after_last_gc_(0), | 146 alive_after_last_gc_(0), |
147 last_gc_end_timestamp_(0.0), | 147 last_gc_end_timestamp_(0.0), |
148 marking_time_(0.0), | 148 marking_time_(0.0), |
149 sweeping_time_(0.0), | 149 sweeping_time_(0.0), |
150 store_buffer_(this), | 150 store_buffer_(this), |
151 marking_(this), | 151 marking_(this), |
152 incremental_marking_(this), | 152 incremental_marking_(this), |
153 number_idle_notifications_(0), | 153 number_idle_notifications_(0), |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 ", committed: %6" V8_PTR_PREFIX "d KB\n", | 389 ", committed: %6" V8_PTR_PREFIX "d KB\n", |
390 lo_space_->SizeOfObjects() / KB, | 390 lo_space_->SizeOfObjects() / KB, |
391 lo_space_->Available() / KB, | 391 lo_space_->Available() / KB, |
392 lo_space_->CommittedMemory() / KB); | 392 lo_space_->CommittedMemory() / KB); |
393 PrintPID("All spaces, used: %6" V8_PTR_PREFIX "d KB" | 393 PrintPID("All spaces, used: %6" V8_PTR_PREFIX "d KB" |
394 ", available: %6" V8_PTR_PREFIX "d KB" | 394 ", available: %6" V8_PTR_PREFIX "d KB" |
395 ", committed: %6" V8_PTR_PREFIX "d KB\n", | 395 ", committed: %6" V8_PTR_PREFIX "d KB\n", |
396 this->SizeOfObjects() / KB, | 396 this->SizeOfObjects() / KB, |
397 this->Available() / KB, | 397 this->Available() / KB, |
398 this->CommittedMemory() / KB); | 398 this->CommittedMemory() / KB); |
399 PrintPID("Total time spent in GC : %d ms\n", total_gc_time_ms_); | 399 PrintPID("Total time spent in GC : %.1f ms\n", total_gc_time_ms_); |
400 } | 400 } |
401 | 401 |
402 | 402 |
403 // TODO(1238405): Combine the infrastructure for --heap-stats and | 403 // TODO(1238405): Combine the infrastructure for --heap-stats and |
404 // --log-gc to avoid the complicated preprocessor and flag testing. | 404 // --log-gc to avoid the complicated preprocessor and flag testing. |
405 void Heap::ReportStatisticsAfterGC() { | 405 void Heap::ReportStatisticsAfterGC() { |
406 // Similar to the before GC, we use some complicated logic to ensure that | 406 // Similar to the before GC, we use some complicated logic to ensure that |
407 // NewSpace statistics are logged exactly once when --log-gc is turned on. | 407 // NewSpace statistics are logged exactly once when --log-gc is turned on. |
408 #if defined(DEBUG) | 408 #if defined(DEBUG) |
409 if (FLAG_heap_stats) { | 409 if (FLAG_heap_stats) { |
(...skipping 5931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6341 #ifdef VERIFY_HEAP | 6341 #ifdef VERIFY_HEAP |
6342 if (FLAG_verify_heap) { | 6342 if (FLAG_verify_heap) { |
6343 Verify(); | 6343 Verify(); |
6344 } | 6344 } |
6345 #endif | 6345 #endif |
6346 | 6346 |
6347 if (FLAG_print_cumulative_gc_stat) { | 6347 if (FLAG_print_cumulative_gc_stat) { |
6348 PrintF("\n"); | 6348 PrintF("\n"); |
6349 PrintF("gc_count=%d ", gc_count_); | 6349 PrintF("gc_count=%d ", gc_count_); |
6350 PrintF("mark_sweep_count=%d ", ms_count_); | 6350 PrintF("mark_sweep_count=%d ", ms_count_); |
6351 PrintF("max_gc_pause=%d ", get_max_gc_pause()); | 6351 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); |
6352 PrintF("total_gc_time=%d ", total_gc_time_ms_); | 6352 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); |
6353 PrintF("min_in_mutator=%d ", get_min_in_mutator()); | 6353 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); |
6354 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", | 6354 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", |
6355 get_max_alive_after_gc()); | 6355 get_max_alive_after_gc()); |
6356 PrintF("total_marking_time=%f ", marking_time()); | 6356 PrintF("total_marking_time=%.1f ", marking_time()); |
6357 PrintF("total_sweeping_time=%f ", sweeping_time()); | 6357 PrintF("total_sweeping_time=%.1f ", sweeping_time()); |
6358 PrintF("\n\n"); | 6358 PrintF("\n\n"); |
6359 } | 6359 } |
6360 | 6360 |
6361 isolate_->global_handles()->TearDown(); | 6361 isolate_->global_handles()->TearDown(); |
6362 | 6362 |
6363 external_string_table_.TearDown(); | 6363 external_string_table_.TearDown(); |
6364 | 6364 |
6365 error_object_list_.TearDown(); | 6365 error_object_list_.TearDown(); |
6366 | 6366 |
6367 new_space_.TearDown(); | 6367 new_space_.TearDown(); |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7026 | 7026 |
7027 GCTracer::~GCTracer() { | 7027 GCTracer::~GCTracer() { |
7028 // Printf ONE line iff flag is set. | 7028 // Printf ONE line iff flag is set. |
7029 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; | 7029 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; |
7030 | 7030 |
7031 bool first_gc = (heap_->last_gc_end_timestamp_ == 0); | 7031 bool first_gc = (heap_->last_gc_end_timestamp_ == 0); |
7032 | 7032 |
7033 heap_->alive_after_last_gc_ = heap_->SizeOfObjects(); | 7033 heap_->alive_after_last_gc_ = heap_->SizeOfObjects(); |
7034 heap_->last_gc_end_timestamp_ = OS::TimeCurrentMillis(); | 7034 heap_->last_gc_end_timestamp_ = OS::TimeCurrentMillis(); |
7035 | 7035 |
7036 int time = static_cast<int>(heap_->last_gc_end_timestamp_ - start_time_); | 7036 double time = heap_->last_gc_end_timestamp_ - start_time_; |
7037 | 7037 |
7038 // Update cumulative GC statistics if required. | 7038 // Update cumulative GC statistics if required. |
7039 if (FLAG_print_cumulative_gc_stat) { | 7039 if (FLAG_print_cumulative_gc_stat) { |
7040 heap_->total_gc_time_ms_ += time; | 7040 heap_->total_gc_time_ms_ += time; |
7041 heap_->max_gc_pause_ = Max(heap_->max_gc_pause_, time); | 7041 heap_->max_gc_pause_ = Max(heap_->max_gc_pause_, time); |
7042 heap_->max_alive_after_gc_ = Max(heap_->max_alive_after_gc_, | 7042 heap_->max_alive_after_gc_ = Max(heap_->max_alive_after_gc_, |
7043 heap_->alive_after_last_gc_); | 7043 heap_->alive_after_last_gc_); |
7044 if (!first_gc) { | 7044 if (!first_gc) { |
7045 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_, | 7045 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_, |
7046 static_cast<int>(spent_in_mutator_)); | 7046 spent_in_mutator_); |
7047 } | 7047 } |
7048 } else if (FLAG_trace_gc_verbose) { | 7048 } else if (FLAG_trace_gc_verbose) { |
7049 heap_->total_gc_time_ms_ += time; | 7049 heap_->total_gc_time_ms_ += time; |
7050 } | 7050 } |
7051 | 7051 |
7052 if (collector_ == SCAVENGER && FLAG_trace_gc_ignore_scavenger) return; | 7052 if (collector_ == SCAVENGER && FLAG_trace_gc_ignore_scavenger) return; |
7053 | 7053 |
7054 heap_->AddMarkingTime(scopes_[Scope::MC_MARK]); | 7054 heap_->AddMarkingTime(scopes_[Scope::MC_MARK]); |
7055 | 7055 |
7056 if (FLAG_print_cumulative_gc_stat && !FLAG_trace_gc) return; | 7056 if (FLAG_print_cumulative_gc_stat && !FLAG_trace_gc) return; |
7057 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); | 7057 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); |
7058 | 7058 |
7059 if (!FLAG_trace_gc_nvp) { | 7059 if (!FLAG_trace_gc_nvp) { |
7060 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]); | 7060 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]); |
7061 | 7061 |
7062 double end_memory_size_mb = | 7062 double end_memory_size_mb = |
7063 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB; | 7063 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB; |
7064 | 7064 |
7065 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", | 7065 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", |
7066 CollectorString(), | 7066 CollectorString(), |
7067 static_cast<double>(start_object_size_) / MB, | 7067 static_cast<double>(start_object_size_) / MB, |
7068 static_cast<double>(start_memory_size_) / MB, | 7068 static_cast<double>(start_memory_size_) / MB, |
7069 SizeOfHeapObjects(), | 7069 SizeOfHeapObjects(), |
7070 end_memory_size_mb); | 7070 end_memory_size_mb); |
7071 | 7071 |
7072 if (external_time > 0) PrintF("%d / ", external_time); | 7072 if (external_time > 0) PrintF("%d / ", external_time); |
7073 PrintF("%d ms", time); | 7073 PrintF("%.1f ms", time); |
7074 if (steps_count_ > 0) { | 7074 if (steps_count_ > 0) { |
7075 if (collector_ == SCAVENGER) { | 7075 if (collector_ == SCAVENGER) { |
7076 PrintF(" (+ %d ms in %d steps since last GC)", | 7076 PrintF(" (+ %.1f ms in %d steps since last GC)", |
7077 static_cast<int>(steps_took_since_last_gc_), | 7077 steps_took_since_last_gc_, |
7078 steps_count_since_last_gc_); | 7078 steps_count_since_last_gc_); |
7079 } else { | 7079 } else { |
7080 PrintF(" (+ %d ms in %d steps since start of marking, " | 7080 PrintF(" (+ %.1f ms in %d steps since start of marking, " |
7081 "biggest step %f ms)", | 7081 "biggest step %.1f ms)", |
7082 static_cast<int>(steps_took_), | 7082 steps_took_, |
7083 steps_count_, | 7083 steps_count_, |
7084 longest_step_); | 7084 longest_step_); |
7085 } | 7085 } |
7086 } | 7086 } |
7087 | 7087 |
7088 if (gc_reason_ != NULL) { | 7088 if (gc_reason_ != NULL) { |
7089 PrintF(" [%s]", gc_reason_); | 7089 PrintF(" [%s]", gc_reason_); |
7090 } | 7090 } |
7091 | 7091 |
7092 if (collector_reason_ != NULL) { | 7092 if (collector_reason_ != NULL) { |
7093 PrintF(" [%s]", collector_reason_); | 7093 PrintF(" [%s]", collector_reason_); |
7094 } | 7094 } |
7095 | 7095 |
7096 PrintF(".\n"); | 7096 PrintF(".\n"); |
7097 } else { | 7097 } else { |
7098 PrintF("pause=%d ", time); | 7098 PrintF("pause=%.1f ", time); |
7099 PrintF("mutator=%d ", static_cast<int>(spent_in_mutator_)); | 7099 PrintF("mutator=%.1f ", spent_in_mutator_); |
7100 PrintF("gc="); | 7100 PrintF("gc="); |
7101 switch (collector_) { | 7101 switch (collector_) { |
7102 case SCAVENGER: | 7102 case SCAVENGER: |
7103 PrintF("s"); | 7103 PrintF("s"); |
7104 break; | 7104 break; |
7105 case MARK_COMPACTOR: | 7105 case MARK_COMPACTOR: |
7106 PrintF("ms"); | 7106 PrintF("ms"); |
7107 break; | 7107 break; |
7108 default: | 7108 default: |
7109 UNREACHABLE(); | 7109 UNREACHABLE(); |
7110 } | 7110 } |
7111 PrintF(" "); | 7111 PrintF(" "); |
7112 | 7112 |
7113 PrintF("external=%d ", static_cast<int>(scopes_[Scope::EXTERNAL])); | 7113 PrintF("external=%.1f ", scopes_[Scope::EXTERNAL]); |
7114 PrintF("mark=%d ", static_cast<int>(scopes_[Scope::MC_MARK])); | 7114 PrintF("mark=%.1f ", scopes_[Scope::MC_MARK]); |
7115 PrintF("sweep=%d ", static_cast<int>(scopes_[Scope::MC_SWEEP])); | 7115 PrintF("sweep=%.1f ", scopes_[Scope::MC_SWEEP]); |
7116 PrintF("sweepns=%d ", static_cast<int>(scopes_[Scope::MC_SWEEP_NEWSPACE])); | 7116 PrintF("sweepns=%.1f ", scopes_[Scope::MC_SWEEP_NEWSPACE]); |
7117 PrintF("evacuate=%d ", static_cast<int>(scopes_[Scope::MC_EVACUATE_PAGES])); | 7117 PrintF("evacuate=%.1f ", scopes_[Scope::MC_EVACUATE_PAGES]); |
7118 PrintF("new_new=%d ", | 7118 PrintF("new_new=%.1f ", scopes_[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS]); |
7119 static_cast<int>(scopes_[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS])); | 7119 PrintF("root_new=%.1f ", scopes_[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS]); |
7120 PrintF("root_new=%d ", | 7120 PrintF("old_new=%.1f ", scopes_[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS]); |
7121 static_cast<int>(scopes_[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS])); | 7121 PrintF("compaction_ptrs=%.1f ", |
7122 PrintF("old_new=%d ", | 7122 scopes_[Scope::MC_UPDATE_POINTERS_TO_EVACUATED]); |
7123 static_cast<int>(scopes_[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS])); | 7123 PrintF("intracompaction_ptrs=%.1f ", |
7124 PrintF("compaction_ptrs=%d ", | 7124 scopes_[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]); |
7125 static_cast<int>(scopes_[Scope::MC_UPDATE_POINTERS_TO_EVACUATED])); | 7125 PrintF("misc_compaction=%.1f ", scopes_[Scope::MC_UPDATE_MISC_POINTERS]); |
7126 PrintF("intracompaction_ptrs=%d ", static_cast<int>(scopes_[ | |
7127 Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED])); | |
7128 PrintF("misc_compaction=%d ", | |
7129 static_cast<int>(scopes_[Scope::MC_UPDATE_MISC_POINTERS])); | |
7130 | 7126 |
7131 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_); | 7127 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_); |
7132 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", heap_->SizeOfObjects()); | 7128 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", heap_->SizeOfObjects()); |
7133 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", | 7129 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", |
7134 in_free_list_or_wasted_before_gc_); | 7130 in_free_list_or_wasted_before_gc_); |
7135 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize(heap_)); | 7131 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize(heap_)); |
7136 | 7132 |
7137 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_); | 7133 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_); |
7138 PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_); | 7134 PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_); |
7139 PrintF("nodes_died_in_new=%d ", nodes_died_in_new_space_); | 7135 PrintF("nodes_died_in_new=%d ", nodes_died_in_new_space_); |
7140 PrintF("nodes_copied_in_new=%d ", nodes_copied_in_new_space_); | 7136 PrintF("nodes_copied_in_new=%d ", nodes_copied_in_new_space_); |
7141 PrintF("nodes_promoted=%d ", nodes_promoted_); | 7137 PrintF("nodes_promoted=%d ", nodes_promoted_); |
7142 | 7138 |
7143 if (collector_ == SCAVENGER) { | 7139 if (collector_ == SCAVENGER) { |
7144 PrintF("stepscount=%d ", steps_count_since_last_gc_); | 7140 PrintF("stepscount=%d ", steps_count_since_last_gc_); |
7145 PrintF("stepstook=%d ", static_cast<int>(steps_took_since_last_gc_)); | 7141 PrintF("stepstook=%.1f ", steps_took_since_last_gc_); |
7146 } else { | 7142 } else { |
7147 PrintF("stepscount=%d ", steps_count_); | 7143 PrintF("stepscount=%d ", steps_count_); |
7148 PrintF("stepstook=%d ", static_cast<int>(steps_took_)); | 7144 PrintF("stepstook=%.1f ", steps_took_); |
7149 PrintF("longeststep=%.f ", longest_step_); | 7145 PrintF("longeststep=%.1f ", longest_step_); |
7150 } | 7146 } |
7151 | 7147 |
7152 PrintF("\n"); | 7148 PrintF("\n"); |
7153 } | 7149 } |
7154 | 7150 |
7155 heap_->PrintShortHeapStatistics(); | 7151 heap_->PrintShortHeapStatistics(); |
7156 } | 7152 } |
7157 | 7153 |
7158 | 7154 |
7159 const char* GCTracer::CollectorString() { | 7155 const char* GCTracer::CollectorString() { |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7537 static_cast<int>(object_sizes_last_time_[index])); | 7533 static_cast<int>(object_sizes_last_time_[index])); |
7538 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7534 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7539 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7535 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7540 | 7536 |
7541 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7537 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7542 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7538 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7543 ClearObjectStats(); | 7539 ClearObjectStats(); |
7544 } | 7540 } |
7545 | 7541 |
7546 } } // namespace v8::internal | 7542 } } // namespace v8::internal |
OLD | NEW |