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

Side by Side Diff: src/heap.cc

Issue 3046049: Add information about memory allocator's size and capacity and heap snapshot into heap stats. (Closed)
Patch Set: Slava's variant of wording Created 10 years, 4 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
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 4088 matching lines...) Expand 10 before | Expand all | Expand 10 after
4099 heap_configured = true; 4099 heap_configured = true;
4100 return true; 4100 return true;
4101 } 4101 }
4102 4102
4103 4103
4104 bool Heap::ConfigureHeapDefault() { 4104 bool Heap::ConfigureHeapDefault() {
4105 return ConfigureHeap(FLAG_max_new_space_size / 2, FLAG_max_old_space_size); 4105 return ConfigureHeap(FLAG_max_new_space_size / 2, FLAG_max_old_space_size);
4106 } 4106 }
4107 4107
4108 4108
4109 void Heap::RecordStats(HeapStats* stats) { 4109 void Heap::RecordStats(HeapStats* stats, bool take_snapshot) {
4110 *stats->start_marker = 0xDECADE00; 4110 *stats->start_marker = 0xDECADE00;
4111 *stats->end_marker = 0xDECADE01; 4111 *stats->end_marker = 0xDECADE01;
4112 *stats->new_space_size = new_space_.Size(); 4112 *stats->new_space_size = new_space_.Size();
4113 *stats->new_space_capacity = new_space_.Capacity(); 4113 *stats->new_space_capacity = new_space_.Capacity();
4114 *stats->old_pointer_space_size = old_pointer_space_->Size(); 4114 *stats->old_pointer_space_size = old_pointer_space_->Size();
4115 *stats->old_pointer_space_capacity = old_pointer_space_->Capacity(); 4115 *stats->old_pointer_space_capacity = old_pointer_space_->Capacity();
4116 *stats->old_data_space_size = old_data_space_->Size(); 4116 *stats->old_data_space_size = old_data_space_->Size();
4117 *stats->old_data_space_capacity = old_data_space_->Capacity(); 4117 *stats->old_data_space_capacity = old_data_space_->Capacity();
4118 *stats->code_space_size = code_space_->Size(); 4118 *stats->code_space_size = code_space_->Size();
4119 *stats->code_space_capacity = code_space_->Capacity(); 4119 *stats->code_space_capacity = code_space_->Capacity();
4120 *stats->map_space_size = map_space_->Size(); 4120 *stats->map_space_size = map_space_->Size();
4121 *stats->map_space_capacity = map_space_->Capacity(); 4121 *stats->map_space_capacity = map_space_->Capacity();
4122 *stats->cell_space_size = cell_space_->Size(); 4122 *stats->cell_space_size = cell_space_->Size();
4123 *stats->cell_space_capacity = cell_space_->Capacity(); 4123 *stats->cell_space_capacity = cell_space_->Capacity();
4124 *stats->lo_space_size = lo_space_->Size(); 4124 *stats->lo_space_size = lo_space_->Size();
4125 GlobalHandles::RecordStats(stats); 4125 GlobalHandles::RecordStats(stats);
4126 *stats->memory_allocator_size = MemoryAllocator::Size();
4127 *stats->memory_allocator_capacity =
4128 MemoryAllocator::Size() + MemoryAllocator::Available();
4129 if (take_snapshot) {
4130 HeapIterator iterator;
4131 for (HeapObject* obj = iterator.next();
4132 obj != NULL;
4133 obj = iterator.next()) {
4134 // Note: snapshot won't be precise because IsFreeListNode returns true
4135 // for any bytearray.
4136 if (FreeListNode::IsFreeListNode(obj)) continue;
4137 InstanceType type = obj->map()->instance_type();
4138 ASSERT(0 <= type && type <= LAST_TYPE);
4139 stats->objects_per_type[type]++;
4140 stats->size_per_type[type] += obj->Size();
4141 }
4142 }
4126 } 4143 }
4127 4144
4128 4145
4129 int Heap::PromotedSpaceSize() { 4146 int Heap::PromotedSpaceSize() {
4130 return old_pointer_space_->Size() 4147 return old_pointer_space_->Size()
4131 + old_data_space_->Size() 4148 + old_data_space_->Size()
4132 + code_space_->Size() 4149 + code_space_->Size()
4133 + map_space_->Size() 4150 + map_space_->Size()
4134 + cell_space_->Size() 4151 + cell_space_->Size()
4135 + lo_space_->Size(); 4152 + lo_space_->Size();
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
4985 void ExternalStringTable::TearDown() { 5002 void ExternalStringTable::TearDown() {
4986 new_space_strings_.Free(); 5003 new_space_strings_.Free();
4987 old_space_strings_.Free(); 5004 old_space_strings_.Free();
4988 } 5005 }
4989 5006
4990 5007
4991 List<Object*> ExternalStringTable::new_space_strings_; 5008 List<Object*> ExternalStringTable::new_space_strings_;
4992 List<Object*> ExternalStringTable::old_space_strings_; 5009 List<Object*> ExternalStringTable::old_space_strings_;
4993 5010
4994 } } // namespace v8::internal 5011 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698