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

Side by Side Diff: src/heap.cc

Issue 9316060: Extend --trace-gc to output amount of memory reserved for V8 heap. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
« no previous file with comments | « 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 6495 matching lines...) Expand 10 before | Expand all | Expand 10 after
6506 space != NULL; 6506 space != NULL;
6507 space = spaces.next()) { 6507 space = spaces.next()) {
6508 holes_size += space->Waste() + space->Available(); 6508 holes_size += space->Waste() + space->Available();
6509 } 6509 }
6510 return holes_size; 6510 return holes_size;
6511 } 6511 }
6512 6512
6513 6513
6514 GCTracer::GCTracer(Heap* heap) 6514 GCTracer::GCTracer(Heap* heap)
6515 : start_time_(0.0), 6515 : start_time_(0.0),
6516 start_size_(0), 6516 start_object_size_(0),
6517 start_memory_size_(0),
6517 gc_count_(0), 6518 gc_count_(0),
6518 full_gc_count_(0), 6519 full_gc_count_(0),
6519 allocated_since_last_gc_(0), 6520 allocated_since_last_gc_(0),
6520 spent_in_mutator_(0), 6521 spent_in_mutator_(0),
6521 promoted_objects_size_(0), 6522 promoted_objects_size_(0),
6522 heap_(heap) { 6523 heap_(heap) {
6523 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; 6524 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
6524 start_time_ = OS::TimeCurrentMillis(); 6525 start_time_ = OS::TimeCurrentMillis();
6525 start_size_ = heap_->SizeOfObjects(); 6526 start_object_size_ = heap_->SizeOfObjects();
6527 start_memory_size_ = heap_->isolate()->memory_allocator()->Size();
6526 6528
6527 for (int i = 0; i < Scope::kNumberOfScopes; i++) { 6529 for (int i = 0; i < Scope::kNumberOfScopes; i++) {
6528 scopes_[i] = 0; 6530 scopes_[i] = 0;
6529 } 6531 }
6530 6532
6531 in_free_list_or_wasted_before_gc_ = CountTotalHolesSize(); 6533 in_free_list_or_wasted_before_gc_ = CountTotalHolesSize();
6532 6534
6533 allocated_since_last_gc_ = 6535 allocated_since_last_gc_ =
6534 heap_->SizeOfObjects() - heap_->alive_after_last_gc_; 6536 heap_->SizeOfObjects() - heap_->alive_after_last_gc_;
6535 6537
(...skipping 29 matching lines...) Expand all
6565 heap_->alive_after_last_gc_); 6567 heap_->alive_after_last_gc_);
6566 if (!first_gc) { 6568 if (!first_gc) {
6567 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_, 6569 heap_->min_in_mutator_ = Min(heap_->min_in_mutator_,
6568 static_cast<int>(spent_in_mutator_)); 6570 static_cast<int>(spent_in_mutator_));
6569 } 6571 }
6570 } 6572 }
6571 6573
6572 if (!FLAG_trace_gc_nvp) { 6574 if (!FLAG_trace_gc_nvp) {
6573 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]); 6575 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]);
6574 6576
6575 PrintF("%s %.1f -> %.1f MB, ", 6577 double end_memory_size_mb =
6578 static_cast<double>(heap_->isolate()->memory_allocator()->Size()) / MB;
6579
6580 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ",
6576 CollectorString(), 6581 CollectorString(),
6577 static_cast<double>(start_size_) / MB, 6582 static_cast<double>(start_object_size_) / MB,
6578 SizeOfHeapObjects()); 6583 static_cast<double>(start_memory_size_) / MB,
6584 SizeOfHeapObjects(),
6585 end_memory_size_mb);
6579 6586
6580 if (external_time > 0) PrintF("%d / ", external_time); 6587 if (external_time > 0) PrintF("%d / ", external_time);
6581 PrintF("%d ms", time); 6588 PrintF("%d ms", time);
6582 if (steps_count_ > 0) { 6589 if (steps_count_ > 0) {
6583 if (collector_ == SCAVENGER) { 6590 if (collector_ == SCAVENGER) {
6584 PrintF(" (+ %d ms in %d steps since last GC)", 6591 PrintF(" (+ %d ms in %d steps since last GC)",
6585 static_cast<int>(steps_took_since_last_gc_), 6592 static_cast<int>(steps_took_since_last_gc_),
6586 steps_count_since_last_gc_); 6593 steps_count_since_last_gc_);
6587 } else { 6594 } else {
6588 PrintF(" (+ %d ms in %d steps since start of marking, " 6595 PrintF(" (+ %d ms in %d steps since start of marking, "
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
6622 static_cast<int>(scopes_[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS])); 6629 static_cast<int>(scopes_[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS]));
6623 PrintF("old_new=%d ", 6630 PrintF("old_new=%d ",
6624 static_cast<int>(scopes_[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS])); 6631 static_cast<int>(scopes_[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS]));
6625 PrintF("compaction_ptrs=%d ", 6632 PrintF("compaction_ptrs=%d ",
6626 static_cast<int>(scopes_[Scope::MC_UPDATE_POINTERS_TO_EVACUATED])); 6633 static_cast<int>(scopes_[Scope::MC_UPDATE_POINTERS_TO_EVACUATED]));
6627 PrintF("intracompaction_ptrs=%d ", static_cast<int>(scopes_[ 6634 PrintF("intracompaction_ptrs=%d ", static_cast<int>(scopes_[
6628 Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED])); 6635 Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]));
6629 PrintF("misc_compaction=%d ", 6636 PrintF("misc_compaction=%d ",
6630 static_cast<int>(scopes_[Scope::MC_UPDATE_MISC_POINTERS])); 6637 static_cast<int>(scopes_[Scope::MC_UPDATE_MISC_POINTERS]));
6631 6638
6632 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_size_); 6639 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_);
6633 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", heap_->SizeOfObjects()); 6640 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", heap_->SizeOfObjects());
6634 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", 6641 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ",
6635 in_free_list_or_wasted_before_gc_); 6642 in_free_list_or_wasted_before_gc_);
6636 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize()); 6643 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize());
6637 6644
6638 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_); 6645 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_);
6639 PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_); 6646 PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_);
6640 6647
6641 if (collector_ == SCAVENGER) { 6648 if (collector_ == SCAVENGER) {
6642 PrintF("stepscount=%d ", steps_count_since_last_gc_); 6649 PrintF("stepscount=%d ", steps_count_since_last_gc_);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
6838 isolate_->heap()->store_buffer()->Compact(); 6845 isolate_->heap()->store_buffer()->Compact();
6839 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 6846 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
6840 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 6847 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
6841 next = chunk->next_chunk(); 6848 next = chunk->next_chunk();
6842 isolate_->memory_allocator()->Free(chunk); 6849 isolate_->memory_allocator()->Free(chunk);
6843 } 6850 }
6844 chunks_queued_for_free_ = NULL; 6851 chunks_queued_for_free_ = NULL;
6845 } 6852 }
6846 6853
6847 } } // namespace v8::internal 6854 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698