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

Side by Side Diff: src/heap.cc

Issue 29203003: Add counters to track the maximum amount of memory committed by the heap. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // a multiple of Page::kPageSize. 72 // a multiple of Page::kPageSize.
73 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), 73 reserved_semispace_size_(8 * (kPointerSize / 4) * MB),
74 max_semispace_size_(8 * (kPointerSize / 4) * MB), 74 max_semispace_size_(8 * (kPointerSize / 4) * MB),
75 initial_semispace_size_(Page::kPageSize), 75 initial_semispace_size_(Page::kPageSize),
76 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), 76 max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
77 max_executable_size_(256ul * (kPointerSize / 4) * MB), 77 max_executable_size_(256ul * (kPointerSize / 4) * MB),
78 // Variables set based on semispace_size_ and old_generation_size_ in 78 // Variables set based on semispace_size_ and old_generation_size_ in
79 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_) 79 // ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_)
80 // Will be 4 * reserved_semispace_size_ to ensure that young 80 // Will be 4 * reserved_semispace_size_ to ensure that young
81 // generation can be aligned to its size. 81 // generation can be aligned to its size.
82 maximum_committed_(0),
82 survived_since_last_expansion_(0), 83 survived_since_last_expansion_(0),
83 sweep_generation_(0), 84 sweep_generation_(0),
84 always_allocate_scope_depth_(0), 85 always_allocate_scope_depth_(0),
85 linear_allocation_scope_depth_(0), 86 linear_allocation_scope_depth_(0),
86 contexts_disposed_(0), 87 contexts_disposed_(0),
87 global_ic_age_(0), 88 global_ic_age_(0),
88 flush_monomorphic_ics_(false), 89 flush_monomorphic_ics_(false),
89 allocation_mementos_found_(0), 90 allocation_mementos_found_(0),
90 scan_on_scavenge_pages_(0), 91 scan_on_scavenge_pages_(0),
91 new_space_(this), 92 new_space_(this),
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 226 }
226 227
227 228
228 intptr_t Heap::CommittedMemoryExecutable() { 229 intptr_t Heap::CommittedMemoryExecutable() {
229 if (!HasBeenSetUp()) return 0; 230 if (!HasBeenSetUp()) return 0;
230 231
231 return isolate()->memory_allocator()->SizeExecutable(); 232 return isolate()->memory_allocator()->SizeExecutable();
232 } 233 }
233 234
234 235
236 void Heap::UpdateMaximumCommitted() {
237 if (!HasBeenSetUp()) return;
238
239 intptr_t current_committed_memory = CommittedMemory();
240 if (current_committed_memory > maximum_committed_) {
241 maximum_committed_ = current_committed_memory;
242 }
243 }
244
245
235 intptr_t Heap::Available() { 246 intptr_t Heap::Available() {
236 if (!HasBeenSetUp()) return 0; 247 if (!HasBeenSetUp()) return 0;
237 248
238 return new_space_.Available() + 249 return new_space_.Available() +
239 old_pointer_space_->Available() + 250 old_pointer_space_->Available() +
240 old_data_space_->Available() + 251 old_data_space_->Available() +
241 code_space_->Available() + 252 code_space_->Available() +
242 map_space_->Available() + 253 map_space_->Available() +
243 cell_space_->Available() + 254 cell_space_->Available() +
244 property_cell_space_->Available(); 255 property_cell_space_->Available();
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 isolate_->counters()->heap_sample_map_space_committed()->AddSample( 567 isolate_->counters()->heap_sample_map_space_committed()->AddSample(
557 static_cast<int>(map_space()->CommittedMemory() / KB)); 568 static_cast<int>(map_space()->CommittedMemory() / KB));
558 isolate_->counters()->heap_sample_cell_space_committed()->AddSample( 569 isolate_->counters()->heap_sample_cell_space_committed()->AddSample(
559 static_cast<int>(cell_space()->CommittedMemory() / KB)); 570 static_cast<int>(cell_space()->CommittedMemory() / KB));
560 isolate_->counters()-> 571 isolate_->counters()->
561 heap_sample_property_cell_space_committed()-> 572 heap_sample_property_cell_space_committed()->
562 AddSample(static_cast<int>( 573 AddSample(static_cast<int>(
563 property_cell_space()->CommittedMemory() / KB)); 574 property_cell_space()->CommittedMemory() / KB));
564 isolate_->counters()->heap_sample_code_space_committed()->AddSample( 575 isolate_->counters()->heap_sample_code_space_committed()->AddSample(
565 static_cast<int>(code_space()->CommittedMemory() / KB)); 576 static_cast<int>(code_space()->CommittedMemory() / KB));
577
578 isolate_->counters()->heap_sample_maximum_committed()->AddSample(
579 static_cast<int>(MaximumCommittedMemory() / KB));
566 } 580 }
567 581
568 #define UPDATE_COUNTERS_FOR_SPACE(space) \ 582 #define UPDATE_COUNTERS_FOR_SPACE(space) \
569 isolate_->counters()->space##_bytes_available()->Set( \ 583 isolate_->counters()->space##_bytes_available()->Set( \
570 static_cast<int>(space()->Available())); \ 584 static_cast<int>(space()->Available())); \
571 isolate_->counters()->space##_bytes_committed()->Set( \ 585 isolate_->counters()->space##_bytes_committed()->Set( \
572 static_cast<int>(space()->CommittedMemory())); \ 586 static_cast<int>(space()->CommittedMemory())); \
573 isolate_->counters()->space##_bytes_used()->Set( \ 587 isolate_->counters()->space##_bytes_used()->Set( \
574 static_cast<int>(space()->SizeOfObjects())); 588 static_cast<int>(space()->SizeOfObjects()));
575 #define UPDATE_FRAGMENTATION_FOR_SPACE(space) \ 589 #define UPDATE_FRAGMENTATION_FOR_SPACE(space) \
(...skipping 6288 matching lines...) Expand 10 before | Expand all | Expand 10 after
6864 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); 6878 PrintF("max_gc_pause=%.1f ", get_max_gc_pause());
6865 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); 6879 PrintF("total_gc_time=%.1f ", total_gc_time_ms_);
6866 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); 6880 PrintF("min_in_mutator=%.1f ", get_min_in_mutator());
6867 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", 6881 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ",
6868 get_max_alive_after_gc()); 6882 get_max_alive_after_gc());
6869 PrintF("total_marking_time=%.1f ", marking_time()); 6883 PrintF("total_marking_time=%.1f ", marking_time());
6870 PrintF("total_sweeping_time=%.1f ", sweeping_time()); 6884 PrintF("total_sweeping_time=%.1f ", sweeping_time());
6871 PrintF("\n\n"); 6885 PrintF("\n\n");
6872 } 6886 }
6873 6887
6888 if (FLAG_print_max_heap_committed) {
6889 PrintF("\n");
6890 PrintF("maximum_committed_by_heap=%" V8_PTR_PREFIX "d ",
6891 MaximumCommittedMemory());
6892 PrintF("maximum_committed_by_new_space=%" V8_PTR_PREFIX "d ",
6893 new_space_.MaximumCommittedMemory());
6894 PrintF("maximum_committed_by_old_pointer_space=%" V8_PTR_PREFIX "d ",
6895 old_data_space_->MaximumCommittedMemory());
6896 PrintF("maximum_committed_by_old_data_space=%" V8_PTR_PREFIX "d ",
6897 old_pointer_space_->MaximumCommittedMemory());
6898 PrintF("maximum_committed_by_old_data_space=%" V8_PTR_PREFIX "d ",
6899 old_pointer_space_->MaximumCommittedMemory());
6900 PrintF("maximum_committed_by_code_space=%" V8_PTR_PREFIX "d ",
6901 code_space_->MaximumCommittedMemory());
6902 PrintF("maximum_committed_by_map_space=%" V8_PTR_PREFIX "d ",
6903 map_space_->MaximumCommittedMemory());
6904 PrintF("maximum_committed_by_cell_space=%" V8_PTR_PREFIX "d ",
6905 cell_space_->MaximumCommittedMemory());
6906 PrintF("maximum_committed_by_property_space=%" V8_PTR_PREFIX "d ",
6907 property_cell_space_->MaximumCommittedMemory());
6908 PrintF("maximum_committed_by_lo_space=%" V8_PTR_PREFIX "d ",
6909 lo_space_->MaximumCommittedMemory());
6910 PrintF("\n\n");
6911 }
6912
6874 TearDownArrayBuffers(); 6913 TearDownArrayBuffers();
6875 6914
6876 isolate_->global_handles()->TearDown(); 6915 isolate_->global_handles()->TearDown();
6877 6916
6878 external_string_table_.TearDown(); 6917 external_string_table_.TearDown();
6879 6918
6880 mark_compact_collector()->TearDown(); 6919 mark_compact_collector()->TearDown();
6881 6920
6882 new_space_.TearDown(); 6921 new_space_.TearDown();
6883 6922
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
8000 if (FLAG_concurrent_recompilation) { 8039 if (FLAG_concurrent_recompilation) {
8001 heap_->relocation_mutex_->Lock(); 8040 heap_->relocation_mutex_->Lock();
8002 #ifdef DEBUG 8041 #ifdef DEBUG
8003 heap_->relocation_mutex_locked_by_optimizer_thread_ = 8042 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8004 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 8043 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8005 #endif // DEBUG 8044 #endif // DEBUG
8006 } 8045 }
8007 } 8046 }
8008 8047
8009 } } // namespace v8::internal 8048 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698