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

Side by Side Diff: runtime/vm/heap.cc

Issue 11973035: Added heap capacity and used space status methods, for use by status tools. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « runtime/vm/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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/heap.h" 5 #include "vm/heap.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/heap_profiler.h" 10 #include "vm/heap_profiler.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 delete allocated_set; 271 delete allocated_set;
272 // Only returning a value so that Heap::Validate can be called from an ASSERT. 272 // Only returning a value so that Heap::Validate can be called from an ASSERT.
273 return true; 273 return true;
274 } 274 }
275 275
276 276
277 void Heap::PrintSizes() const { 277 void Heap::PrintSizes() const {
278 OS::PrintErr("New space (%"Pd"k of %"Pd"k) " 278 OS::PrintErr("New space (%"Pd"k of %"Pd"k) "
279 "Old space (%"Pd"k of %"Pd"k)\n", 279 "Old space (%"Pd"k of %"Pd"k)\n",
280 (new_space_->in_use() / KB), (new_space_->capacity() / KB), 280 (new_space_->in_use() / KB), (new_space_->capacity() / KB),
281 (old_space_->in_use() / KB), (old_space_->capacity() / KB)); 281 (old_space_->in_use() / KB), (old_space_->capacity() / KB));
siva 2013/01/17 19:29:03 We could use your new functions here right (that w
Tom Ball 2013/01/17 19:43:55 Done.
282 } 282 }
283 283
284 284
285 intptr_t Heap::Used(Space space) const {
286 return space == kNew ? new_space_->in_use() : old_space_->in_use();
287 }
288
289
290 intptr_t Heap::Capacity(Space space) const {
291 return space == kNew ? new_space_->capacity() : old_space_->capacity();
292 }
293
294
285 void Heap::Profile(Dart_FileWriteCallback callback, void* stream) const { 295 void Heap::Profile(Dart_FileWriteCallback callback, void* stream) const {
286 HeapProfiler profiler(callback, stream); 296 HeapProfiler profiler(callback, stream);
287 297
288 // Dump the root set. 298 // Dump the root set.
289 HeapProfilerRootVisitor root_visitor(&profiler); 299 HeapProfilerRootVisitor root_visitor(&profiler);
290 Isolate* isolate = Isolate::Current(); 300 Isolate* isolate = Isolate::Current();
291 Isolate* vm_isolate = Dart::vm_isolate(); 301 Isolate* vm_isolate = Dart::vm_isolate();
292 isolate->VisitObjectPointers(&root_visitor, false, 302 isolate->VisitObjectPointers(&root_visitor, false,
293 StackFrameIterator::kDontValidateFrames); 303 StackFrameIterator::kDontValidateFrames);
294 HeapProfilerWeakRootVisitor weak_root_visitor(&root_visitor); 304 HeapProfilerWeakRootVisitor weak_root_visitor(&root_visitor);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 isolate()->IncrementNoGCScopeDepth(); 475 isolate()->IncrementNoGCScopeDepth();
466 } 476 }
467 477
468 478
469 NoGCScope::~NoGCScope() { 479 NoGCScope::~NoGCScope() {
470 isolate()->DecrementNoGCScopeDepth(); 480 isolate()->DecrementNoGCScopeDepth();
471 } 481 }
472 #endif // defined(DEBUG) 482 #endif // defined(DEBUG)
473 483
474 } // namespace dart 484 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698