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

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

Issue 51653006: Track live instance and allocation counts for classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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/pages.h ('k') | runtime/vm/raw_object.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 (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"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 heap_(heap), 124 heap_(heap),
125 pages_(NULL), 125 pages_(NULL),
126 pages_tail_(NULL), 126 pages_tail_(NULL),
127 large_pages_(NULL), 127 large_pages_(NULL),
128 max_capacity_in_words_(max_capacity_in_words), 128 max_capacity_in_words_(max_capacity_in_words),
129 capacity_in_words_(0), 129 capacity_in_words_(0),
130 used_in_words_(0), 130 used_in_words_(0),
131 sweeping_(false), 131 sweeping_(false),
132 page_space_controller_(FLAG_heap_growth_space_ratio, 132 page_space_controller_(FLAG_heap_growth_space_ratio,
133 FLAG_heap_growth_rate, 133 FLAG_heap_growth_rate,
134 FLAG_heap_growth_time_ratio) { 134 FLAG_heap_growth_time_ratio),
135 gc_time_micros_(0),
136 collections_(0) {
135 } 137 }
136 138
137 139
138 PageSpace::~PageSpace() { 140 PageSpace::~PageSpace() {
139 FreePages(pages_); 141 FreePages(pages_);
140 FreePages(large_pages_); 142 FreePages(large_pages_);
141 } 143 }
142 144
143 145
144 intptr_t PageSpace::LargePageSizeInWordsFor(intptr_t size) { 146 intptr_t PageSpace::LargePageSizeInWordsFor(intptr_t size) {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 page = page->next(); 386 page = page->next();
385 } 387 }
386 page = large_pages_; 388 page = large_pages_;
387 while (page != NULL) { 389 while (page != NULL) {
388 page->WriteProtect(read_only); 390 page->WriteProtect(read_only);
389 page = page->next(); 391 page = page->next();
390 } 392 }
391 } 393 }
392 394
393 395
396 void PageSpace::PrintToJSONObject(JSONObject* object) {
397 JSONObject space(object, "old");
398 space.AddProperty("type", "PageSpace");
399 space.AddProperty("id", "heaps/old");
400 space.AddProperty("name", "PageSpace");
401 space.AddProperty("user_name", "old");
402 space.AddProperty("collections", collections());
403 space.AddProperty("used", UsedInWords() * kWordSize);
404 space.AddProperty("capacity", CapacityInWords() * kWordSize);
405 space.AddProperty("time", RoundMicrosecondsToSeconds(gc_time_micros()));
406 }
407
408
394 bool PageSpace::ShouldCollectCode() { 409 bool PageSpace::ShouldCollectCode() {
395 // Try to collect code if enough time has passed since the last attempt. 410 // Try to collect code if enough time has passed since the last attempt.
396 const int64_t start = OS::GetCurrentTimeMicros(); 411 const int64_t start = OS::GetCurrentTimeMicros();
397 const int64_t last_code_collection_in_us = 412 const int64_t last_code_collection_in_us =
398 page_space_controller_.last_code_collection_in_us(); 413 page_space_controller_.last_code_collection_in_us();
399 414
400 if ((start - last_code_collection_in_us) > 415 if ((start - last_code_collection_in_us) >
401 FLAG_code_collection_interval_in_us) { 416 FLAG_code_collection_interval_in_us) {
402 if (FLAG_log_code_drop) { 417 if (FLAG_log_code_drop) {
403 OS::Print("Trying to detach code.\n"); 418 OS::Print("Trying to detach code.\n");
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 return 0; 641 return 0;
627 } else { 642 } else {
628 ASSERT(total_time >= gc_time); 643 ASSERT(total_time >= gc_time);
629 int result= static_cast<int>((static_cast<double>(gc_time) / 644 int result= static_cast<int>((static_cast<double>(gc_time) /
630 static_cast<double>(total_time)) * 100); 645 static_cast<double>(total_time)) * 100);
631 return result; 646 return result;
632 } 647 }
633 } 648 }
634 649
635 } // namespace dart 650 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698