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

Side by Side Diff: src/heap.cc

Issue 12209090: Precise GC time measurements. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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
« src/heap.h ('K') | « 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 6330 matching lines...) Expand 10 before | Expand all | Expand 10 after
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=%d ", total_gc_time_ms_);
6353 PrintF("min_in_mutator=%d ", get_min_in_mutator()); 6353 PrintF("min_in_mutator=%d ", 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=%f ", marking_time());
6357 PrintF("total_sweeping_time=%f ", sweeping_time()); 6357 PrintF("total_sweeping_time=%f ", sweeping_time());
6358 PrintF("\n\n"); 6358 PrintF("\n\n");
6359 } 6359 }
6360 6360
6361 isolate_->global_handles()->TearDown(); 6361 isolate_->global_handles()->TearDown();
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 float 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 static_cast<int>(spent_in_mutator_));
(...skipping 16 matching lines...) Expand all
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(" (+ %d ms in %d steps since last GC)",
7077 static_cast<int>(steps_took_since_last_gc_), 7077 static_cast<int>(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(" (+ %d ms in %d steps since start of marking, "
7081 "biggest step %f ms)", 7081 "biggest step %f ms)",
7082 static_cast<int>(steps_took_), 7082 static_cast<int>(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=%d ", static_cast<int>(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:
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
7537 static_cast<int>(object_sizes_last_time_[index])); 7537 static_cast<int>(object_sizes_last_time_[index]));
7538 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7538 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7539 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7539 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7540 7540
7541 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7541 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7542 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7542 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7543 ClearObjectStats(); 7543 ClearObjectStats();
7544 } 7544 }
7545 7545
7546 } } // namespace v8::internal 7546 } } // namespace v8::internal
OLDNEW
« src/heap.h ('K') | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698