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 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 Loading... |
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 5796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 | 6887 |
6880 if (!FLAG_trace_gc_nvp) { | 6888 if (!FLAG_trace_gc_nvp) { |
6881 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]); | 6889 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]); |
6882 | 6890 |
6883 double end_memory_size_mb = | 6891 double end_memory_size_mb = |
6884 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB; | 6892 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB; |
6885 | 6893 |
6886 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", | 6894 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", |
6887 CollectorString(), | 6895 CollectorString(), |
(...skipping 22 matching lines...) Expand all Loading... |
6910 PrintF(" [%s]", gc_reason_); | 6918 PrintF(" [%s]", gc_reason_); |
6911 } | 6919 } |
6912 | 6920 |
6913 if (collector_reason_ != NULL) { | 6921 if (collector_reason_ != NULL) { |
6914 PrintF(" [%s]", collector_reason_); | 6922 PrintF(" [%s]", collector_reason_); |
6915 } | 6923 } |
6916 | 6924 |
6917 PrintF(".\n"); | 6925 PrintF(".\n"); |
6918 } else { | 6926 } else { |
6919 PrintF("pause=%d ", time); | 6927 PrintF("pause=%d ", time); |
6920 PrintF("mutator=%d ", | 6928 PrintF("mutator=%d ", static_cast<int>(spent_in_mutator_)); |
6921 static_cast<int>(spent_in_mutator_)); | |
6922 | |
6923 PrintF("gc="); | 6929 PrintF("gc="); |
6924 switch (collector_) { | 6930 switch (collector_) { |
6925 case SCAVENGER: | 6931 case SCAVENGER: |
6926 PrintF("s"); | 6932 PrintF("s"); |
6927 break; | 6933 break; |
6928 case MARK_COMPACTOR: | 6934 case MARK_COMPACTOR: |
6929 PrintF("ms"); | 6935 PrintF("ms"); |
6930 break; | 6936 break; |
6931 default: | 6937 default: |
6932 UNREACHABLE(); | 6938 UNREACHABLE(); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7238 static_cast<int>(object_sizes_last_time_[index])); | 7244 static_cast<int>(object_sizes_last_time_[index])); |
7239 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7245 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7240 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7246 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7241 | 7247 |
7242 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7248 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7243 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7249 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7244 ClearObjectStats(); | 7250 ClearObjectStats(); |
7245 } | 7251 } |
7246 | 7252 |
7247 } } // namespace v8::internal | 7253 } } // namespace v8::internal |
OLD | NEW |