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

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

Issue 231983004: Fix used vs. capacity growth computation mismatch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 | 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/pages.h" 5 #include "vm/pages.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/compiler_stats.h" 8 #include "vm/compiler_stats.h"
9 #include "vm/gc_marker.h" 9 #include "vm/gc_marker.h"
10 #include "vm/gc_sweeper.h" 10 #include "vm/gc_sweeper.h"
11 #include "vm/object.h" 11 #include "vm/object.h"
12 #include "vm/virtual_memory.h" 12 #include "vm/virtual_memory.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 DEFINE_FLAG(int, heap_growth_space_ratio, 10, 16 DEFINE_FLAG(int, heap_growth_space_ratio, 20,
17 "The desired maximum percentage of free space after GC"); 17 "The desired maximum percentage of free space after GC");
18 DEFINE_FLAG(int, heap_growth_time_ratio, 3, 18 DEFINE_FLAG(int, heap_growth_time_ratio, 3,
19 "The desired maximum percentage of time spent in GC"); 19 "The desired maximum percentage of time spent in GC");
20 DEFINE_FLAG(int, heap_growth_rate, 4, 20 DEFINE_FLAG(int, heap_growth_rate, 4,
21 "The size the heap is grown, in heap pages"); 21 "The size the heap is grown, in heap pages");
22 DEFINE_FLAG(bool, print_free_list_before_gc, false, 22 DEFINE_FLAG(bool, print_free_list_before_gc, false,
23 "Print free list statistics before a GC"); 23 "Print free list statistics before a GC");
24 DEFINE_FLAG(bool, print_free_list_after_gc, false, 24 DEFINE_FLAG(bool, print_free_list_after_gc, false,
25 "Print free list statistics after a GC"); 25 "Print free list statistics after a GC");
26 DEFINE_FLAG(bool, collect_code, true, 26 DEFINE_FLAG(bool, collect_code, true,
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 (collected_garbage_ratio >= heap_growth_ratio_); 685 (collected_garbage_ratio >= heap_growth_ratio_);
686 int garbage_collection_time_fraction = 686 int garbage_collection_time_fraction =
687 history_.GarbageCollectionTimeFraction(); 687 history_.GarbageCollectionTimeFraction();
688 bool enough_free_time = 688 bool enough_free_time =
689 (garbage_collection_time_fraction <= garbage_collection_time_ratio_); 689 (garbage_collection_time_fraction <= garbage_collection_time_ratio_);
690 690
691 Heap* heap = Isolate::Current()->heap(); 691 Heap* heap = Isolate::Current()->heap();
692 if (enough_free_space && enough_free_time) { 692 if (enough_free_space && enough_free_time) {
693 grow_heap_ = 0; 693 grow_heap_ = 0;
694 } else { 694 } else {
695 intptr_t growth_target = static_cast<intptr_t>( 695 intptr_t used_target = static_cast<intptr_t>(
696 after_total_in_words / desired_utilization_); 696 after_total_in_words / desired_utilization_);
697 intptr_t growth_in_words = Utils::RoundUp( 697 intptr_t capacity_growth_in_words =
698 growth_target - after_total_in_words, 698 Utils::RoundUp(Utils::Maximum(static_cast<intptr_t>(0),
699 PageSpace::kPageSizeInWords); 699 used_target - after.capacity_in_words),
700 int growth_in_pages = 700 PageSpace::kPageSizeInWords);
701 growth_in_words / PageSpace::kPageSizeInWords; 701 int capacity_growth_in_pages =
702 grow_heap_ = Utils::Maximum(growth_in_pages, heap_growth_rate_); 702 capacity_growth_in_words / PageSpace::kPageSizeInWords;
703 heap->RecordData(PageSpace::kPageGrowth, growth_in_pages); 703 grow_heap_ = Utils::Maximum(capacity_growth_in_pages, heap_growth_rate_);
704 heap->RecordData(PageSpace::kPageGrowth, capacity_growth_in_pages);
704 } 705 }
705 heap->RecordData(PageSpace::kGarbageRatio, collected_garbage_ratio); 706 heap->RecordData(PageSpace::kGarbageRatio, collected_garbage_ratio);
706 heap->RecordData(PageSpace::kGCTimeFraction, 707 heap->RecordData(PageSpace::kGCTimeFraction,
707 garbage_collection_time_fraction); 708 garbage_collection_time_fraction);
708 heap->RecordData(PageSpace::kAllowedGrowth, grow_heap_); 709 heap->RecordData(PageSpace::kAllowedGrowth, grow_heap_);
709 last_usage_ = after; 710 last_usage_ = after;
710 } 711 }
711 712
712 713
713 PageSpaceGarbageCollectionHistory::PageSpaceGarbageCollectionHistory() 714 PageSpaceGarbageCollectionHistory::PageSpaceGarbageCollectionHistory()
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 return 0; 748 return 0;
748 } else { 749 } else {
749 ASSERT(total_time >= gc_time); 750 ASSERT(total_time >= gc_time);
750 int result= static_cast<int>((static_cast<double>(gc_time) / 751 int result= static_cast<int>((static_cast<double>(gc_time) /
751 static_cast<double>(total_time)) * 100); 752 static_cast<double>(total_time)) * 100);
752 return result; 753 return result;
753 } 754 }
754 } 755 }
755 756
756 } // namespace dart 757 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698