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

Side by Side Diff: src/heap.cc

Issue 9817002: Add OS::GetCurrentProcessId and prepend output from trace-gc with the current pid (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: updates Created 8 years, 5 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 | « no previous file | src/incremental-marking.h » ('j') | 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 new_space_.CollectStatistics(); 313 new_space_.CollectStatistics();
314 new_space_.ReportStatistics(); 314 new_space_.ReportStatistics();
315 new_space_.ClearHistograms(); 315 new_space_.ClearHistograms();
316 } 316 }
317 #endif // DEBUG 317 #endif // DEBUG
318 } 318 }
319 319
320 320
321 void Heap::PrintShortHeapStatistics() { 321 void Heap::PrintShortHeapStatistics() {
322 if (!FLAG_trace_gc_verbose) return; 322 if (!FLAG_trace_gc_verbose) return;
323 PrintF("Memory allocator, used: %6" V8_PTR_PREFIX "d KB" 323 PrintPID("Memory allocator, used: %6" V8_PTR_PREFIX "d KB"
324 ", available: %6" V8_PTR_PREFIX "d KB\n", 324 ", available: %6" V8_PTR_PREFIX "d KB\n",
325 isolate_->memory_allocator()->Size() / KB, 325 isolate_->memory_allocator()->Size() / KB,
326 isolate_->memory_allocator()->Available() / KB); 326 isolate_->memory_allocator()->Available() / KB);
327 PrintF("New space, used: %6" V8_PTR_PREFIX "d KB" 327 PrintPID("New space, used: %6" V8_PTR_PREFIX "d KB"
328 ", available: %6" V8_PTR_PREFIX "d KB" 328 ", available: %6" V8_PTR_PREFIX "d KB"
329 ", committed: %6" V8_PTR_PREFIX "d KB\n", 329 ", committed: %6" V8_PTR_PREFIX "d KB\n",
330 new_space_.Size() / KB, 330 new_space_.Size() / KB,
331 new_space_.Available() / KB, 331 new_space_.Available() / KB,
332 new_space_.CommittedMemory() / KB); 332 new_space_.CommittedMemory() / KB);
333 PrintF("Old pointers, used: %6" V8_PTR_PREFIX "d KB" 333 PrintPID("Old pointers, used: %6" V8_PTR_PREFIX "d KB"
334 ", available: %6" V8_PTR_PREFIX "d KB" 334 ", available: %6" V8_PTR_PREFIX "d KB"
335 ", committed: %6" V8_PTR_PREFIX "d KB\n", 335 ", committed: %6" V8_PTR_PREFIX "d KB\n",
336 old_pointer_space_->SizeOfObjects() / KB, 336 old_pointer_space_->SizeOfObjects() / KB,
337 old_pointer_space_->Available() / KB, 337 old_pointer_space_->Available() / KB,
338 old_pointer_space_->CommittedMemory() / KB); 338 old_pointer_space_->CommittedMemory() / KB);
339 PrintF("Old data space, used: %6" V8_PTR_PREFIX "d KB" 339 PrintPID("Old data space, used: %6" V8_PTR_PREFIX "d KB"
340 ", available: %6" V8_PTR_PREFIX "d KB" 340 ", available: %6" V8_PTR_PREFIX "d KB"
341 ", committed: %6" V8_PTR_PREFIX "d KB\n", 341 ", committed: %6" V8_PTR_PREFIX "d KB\n",
342 old_data_space_->SizeOfObjects() / KB, 342 old_data_space_->SizeOfObjects() / KB,
343 old_data_space_->Available() / KB, 343 old_data_space_->Available() / KB,
344 old_data_space_->CommittedMemory() / KB); 344 old_data_space_->CommittedMemory() / KB);
345 PrintF("Code space, used: %6" V8_PTR_PREFIX "d KB" 345 PrintPID("Code space, used: %6" V8_PTR_PREFIX "d KB"
346 ", available: %6" V8_PTR_PREFIX "d KB" 346 ", available: %6" V8_PTR_PREFIX "d KB"
347 ", committed: %6" V8_PTR_PREFIX "d KB\n", 347 ", committed: %6" V8_PTR_PREFIX "d KB\n",
348 code_space_->SizeOfObjects() / KB, 348 code_space_->SizeOfObjects() / KB,
349 code_space_->Available() / KB, 349 code_space_->Available() / KB,
350 code_space_->CommittedMemory() / KB); 350 code_space_->CommittedMemory() / KB);
351 PrintF("Map space, used: %6" V8_PTR_PREFIX "d KB" 351 PrintPID("Map space, used: %6" V8_PTR_PREFIX "d KB"
352 ", available: %6" V8_PTR_PREFIX "d KB" 352 ", available: %6" V8_PTR_PREFIX "d KB"
353 ", committed: %6" V8_PTR_PREFIX "d KB\n", 353 ", committed: %6" V8_PTR_PREFIX "d KB\n",
354 map_space_->SizeOfObjects() / KB, 354 map_space_->SizeOfObjects() / KB,
355 map_space_->Available() / KB, 355 map_space_->Available() / KB,
356 map_space_->CommittedMemory() / KB); 356 map_space_->CommittedMemory() / KB);
357 PrintF("Cell space, used: %6" V8_PTR_PREFIX "d KB" 357 PrintPID("Cell space, used: %6" V8_PTR_PREFIX "d KB"
358 ", available: %6" V8_PTR_PREFIX "d KB" 358 ", available: %6" V8_PTR_PREFIX "d KB"
359 ", committed: %6" V8_PTR_PREFIX "d KB\n", 359 ", committed: %6" V8_PTR_PREFIX "d KB\n",
360 cell_space_->SizeOfObjects() / KB, 360 cell_space_->SizeOfObjects() / KB,
361 cell_space_->Available() / KB, 361 cell_space_->Available() / KB,
362 cell_space_->CommittedMemory() / KB); 362 cell_space_->CommittedMemory() / KB);
363 PrintF("Large object space, used: %6" V8_PTR_PREFIX "d KB" 363 PrintPID("Large object space, used: %6" V8_PTR_PREFIX "d KB"
364 ", available: %6" V8_PTR_PREFIX "d KB" 364 ", available: %6" V8_PTR_PREFIX "d KB"
365 ", committed: %6" V8_PTR_PREFIX "d KB\n", 365 ", committed: %6" V8_PTR_PREFIX "d KB\n",
366 lo_space_->SizeOfObjects() / KB, 366 lo_space_->SizeOfObjects() / KB,
367 lo_space_->Available() / KB, 367 lo_space_->Available() / KB,
368 lo_space_->CommittedMemory() / KB); 368 lo_space_->CommittedMemory() / KB);
369 } 369 }
370 370
371 371
372 // TODO(1238405): Combine the infrastructure for --heap-stats and 372 // TODO(1238405): Combine the infrastructure for --heap-stats and
373 // --log-gc to avoid the complicated preprocessor and flag testing. 373 // --log-gc to avoid the complicated preprocessor and flag testing.
374 void Heap::ReportStatisticsAfterGC() { 374 void Heap::ReportStatisticsAfterGC() {
375 // Similar to the before GC, we use some complicated logic to ensure that 375 // Similar to the before GC, we use some complicated logic to ensure that
376 // NewSpace statistics are logged exactly once when --log-gc is turned on. 376 // NewSpace statistics are logged exactly once when --log-gc is turned on.
377 #if defined(DEBUG) 377 #if defined(DEBUG)
378 if (FLAG_heap_stats) { 378 if (FLAG_heap_stats) {
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 if (!new_space_high_promotion_mode_active_ && 899 if (!new_space_high_promotion_mode_active_ &&
900 new_space_.Capacity() == new_space_.MaximumCapacity() && 900 new_space_.Capacity() == new_space_.MaximumCapacity() &&
901 IsStableOrIncreasingSurvivalTrend() && 901 IsStableOrIncreasingSurvivalTrend() &&
902 IsHighSurvivalRate()) { 902 IsHighSurvivalRate()) {
903 // Stable high survival rates even though young generation is at 903 // Stable high survival rates even though young generation is at
904 // maximum capacity indicates that most objects will be promoted. 904 // maximum capacity indicates that most objects will be promoted.
905 // To decrease scavenger pauses and final mark-sweep pauses, we 905 // To decrease scavenger pauses and final mark-sweep pauses, we
906 // have to limit maximal capacity of the young generation. 906 // have to limit maximal capacity of the young generation.
907 new_space_high_promotion_mode_active_ = true; 907 new_space_high_promotion_mode_active_ = true;
908 if (FLAG_trace_gc) { 908 if (FLAG_trace_gc) {
909 PrintF("Limited new space size due to high promotion rate: %d MB\n", 909 PrintPID("Limited new space size due to high promotion rate: %d MB\n",
910 new_space_.InitialCapacity() / MB); 910 new_space_.InitialCapacity() / MB);
911 } 911 }
912 } else if (new_space_high_promotion_mode_active_ && 912 } else if (new_space_high_promotion_mode_active_ &&
913 IsStableOrDecreasingSurvivalTrend() && 913 IsStableOrDecreasingSurvivalTrend() &&
914 IsLowSurvivalRate()) { 914 IsLowSurvivalRate()) {
915 // Decreasing low survival rates might indicate that the above high 915 // Decreasing low survival rates might indicate that the above high
916 // promotion mode is over and we should allow the young generation 916 // promotion mode is over and we should allow the young generation
917 // to grow again. 917 // to grow again.
918 new_space_high_promotion_mode_active_ = false; 918 new_space_high_promotion_mode_active_ = false;
919 if (FLAG_trace_gc) { 919 if (FLAG_trace_gc) {
920 PrintF("Unlimited new space size due to low promotion rate: %d MB\n", 920 PrintPID("Unlimited new space size due to low promotion rate: %d MB\n",
921 new_space_.MaximumCapacity() / MB); 921 new_space_.MaximumCapacity() / MB);
922 } 922 }
923 } 923 }
924 924
925 if (new_space_high_promotion_mode_active_ && 925 if (new_space_high_promotion_mode_active_ &&
926 new_space_.Capacity() > new_space_.InitialCapacity()) { 926 new_space_.Capacity() > new_space_.InitialCapacity()) {
927 new_space_.Shrink(); 927 new_space_.Shrink();
928 } 928 }
929 929
930 isolate_->counters()->objs_since_last_young()->Set(0); 930 isolate_->counters()->objs_since_last_young()->Set(0);
931 931
(...skipping 4867 matching lines...) Expand 10 before | Expand all | Expand 10 after
5799 5799
5800 if (FLAG_stress_compaction) { 5800 if (FLAG_stress_compaction) {
5801 // This will cause more frequent GCs when stressing. 5801 // This will cause more frequent GCs when stressing.
5802 max_semispace_size_ = Page::kPageSize; 5802 max_semispace_size_ = Page::kPageSize;
5803 } 5803 }
5804 5804
5805 if (max_semispace_size > 0) { 5805 if (max_semispace_size > 0) {
5806 if (max_semispace_size < Page::kPageSize) { 5806 if (max_semispace_size < Page::kPageSize) {
5807 max_semispace_size = Page::kPageSize; 5807 max_semispace_size = Page::kPageSize;
5808 if (FLAG_trace_gc) { 5808 if (FLAG_trace_gc) {
5809 PrintF("Max semispace size cannot be less than %dkbytes\n", 5809 PrintPID("Max semispace size cannot be less than %dkbytes\n",
5810 Page::kPageSize >> 10); 5810 Page::kPageSize >> 10);
5811 } 5811 }
5812 } 5812 }
5813 max_semispace_size_ = max_semispace_size; 5813 max_semispace_size_ = max_semispace_size;
5814 } 5814 }
5815 5815
5816 if (Snapshot::IsEnabled()) { 5816 if (Snapshot::IsEnabled()) {
5817 // If we are using a snapshot we always reserve the default amount 5817 // If we are using a snapshot we always reserve the default amount
5818 // of memory for each semispace because code in the snapshot has 5818 // of memory for each semispace because code in the snapshot has
5819 // write-barrier code that relies on the size and alignment of new 5819 // write-barrier code that relies on the size and alignment of new
5820 // space. We therefore cannot use a larger max semispace size 5820 // space. We therefore cannot use a larger max semispace size
5821 // than the default reserved semispace size. 5821 // than the default reserved semispace size.
5822 if (max_semispace_size_ > reserved_semispace_size_) { 5822 if (max_semispace_size_ > reserved_semispace_size_) {
5823 max_semispace_size_ = reserved_semispace_size_; 5823 max_semispace_size_ = reserved_semispace_size_;
5824 if (FLAG_trace_gc) { 5824 if (FLAG_trace_gc) {
5825 PrintF("Max semispace size cannot be more than %dkbytes\n", 5825 PrintPID("Max semispace size cannot be more than %dkbytes\n",
5826 reserved_semispace_size_ >> 10); 5826 reserved_semispace_size_ >> 10);
5827 } 5827 }
5828 } 5828 }
5829 } else { 5829 } else {
5830 // If we are not using snapshots we reserve space for the actual 5830 // If we are not using snapshots we reserve space for the actual
5831 // max semispace size. 5831 // max semispace size.
5832 reserved_semispace_size_ = max_semispace_size_; 5832 reserved_semispace_size_ = max_semispace_size_;
5833 } 5833 }
5834 5834
5835 if (max_old_gen_size > 0) max_old_generation_size_ = max_old_gen_size; 5835 if (max_old_gen_size > 0) max_old_generation_size_ = max_old_gen_size;
5836 if (max_executable_size > 0) { 5836 if (max_executable_size > 0) {
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
6910 if (FLAG_print_cumulative_gc_stat) { 6910 if (FLAG_print_cumulative_gc_stat) {
6911 heap_->max_gc_pause_ = Max(heap_->max_gc_pause_, time); 6911 heap_->max_gc_pause_ = Max(heap_->max_gc_pause_, time);
6912 heap_->max_alive_after_gc_ = Max(heap_->max_alive_after_gc_, 6912 heap_->max_alive_after_gc_ = Max(heap_->max_alive_after_gc_,
6913 heap_->alive_after_last_gc_); 6913 heap_->alive_after_last_gc_);
6914 if (!first_gc) { 6914 if (!first_gc) {
6915 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_, 6915 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_,
6916 static_cast<int>(spent_in_mutator_)); 6916 static_cast<int>(spent_in_mutator_));
6917 } 6917 }
6918 } 6918 }
6919 6919
6920 PrintF("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); 6920 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
6921 6921
6922 if (!FLAG_trace_gc_nvp) { 6922 if (!FLAG_trace_gc_nvp) {
6923 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]); 6923 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]);
6924 6924
6925 double end_memory_size_mb = 6925 double end_memory_size_mb =
6926 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB; 6926 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB;
6927 6927
6928 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", 6928 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ",
6929 CollectorString(), 6929 CollectorString(),
6930 static_cast<double>(start_object_size_) / MB, 6930 static_cast<double>(start_object_size_) / MB,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
7221 } else { 7221 } else {
7222 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. 7222 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died.
7223 } 7223 }
7224 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = 7224 remembered_unmapped_pages_[remembered_unmapped_pages_index_] =
7225 reinterpret_cast<Address>(p); 7225 reinterpret_cast<Address>(p);
7226 remembered_unmapped_pages_index_++; 7226 remembered_unmapped_pages_index_++;
7227 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; 7227 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages;
7228 } 7228 }
7229 7229
7230 } } // namespace v8::internal 7230 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698