| OLD | NEW |
| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 416 |
| 417 void PageSpace::PrintToJSONObject(JSONObject* object) { | 417 void PageSpace::PrintToJSONObject(JSONObject* object) { |
| 418 JSONObject space(object, "old"); | 418 JSONObject space(object, "old"); |
| 419 space.AddProperty("type", "PageSpace"); | 419 space.AddProperty("type", "PageSpace"); |
| 420 space.AddProperty("id", "heaps/old"); | 420 space.AddProperty("id", "heaps/old"); |
| 421 space.AddProperty("name", "PageSpace"); | 421 space.AddProperty("name", "PageSpace"); |
| 422 space.AddProperty("user_name", "old"); | 422 space.AddProperty("user_name", "old"); |
| 423 space.AddProperty("collections", collections()); | 423 space.AddProperty("collections", collections()); |
| 424 space.AddProperty("used", UsedInWords() * kWordSize); | 424 space.AddProperty("used", UsedInWords() * kWordSize); |
| 425 space.AddProperty("capacity", CapacityInWords() * kWordSize); | 425 space.AddProperty("capacity", CapacityInWords() * kWordSize); |
| 426 space.AddProperty("time", RoundMicrosecondsToSeconds(gc_time_micros())); | 426 space.AddProperty("time", MicrosecondsToSeconds(gc_time_micros())); |
| 427 } | 427 } |
| 428 | 428 |
| 429 | 429 |
| 430 bool PageSpace::ShouldCollectCode() { | 430 bool PageSpace::ShouldCollectCode() { |
| 431 // Try to collect code if enough time has passed since the last attempt. | 431 // Try to collect code if enough time has passed since the last attempt. |
| 432 const int64_t start = OS::GetCurrentTimeMicros(); | 432 const int64_t start = OS::GetCurrentTimeMicros(); |
| 433 const int64_t last_code_collection_in_us = | 433 const int64_t last_code_collection_in_us = |
| 434 page_space_controller_.last_code_collection_in_us(); | 434 page_space_controller_.last_code_collection_in_us(); |
| 435 | 435 |
| 436 if ((start - last_code_collection_in_us) > | 436 if ((start - last_code_collection_in_us) > |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 return 0; | 702 return 0; |
| 703 } else { | 703 } else { |
| 704 ASSERT(total_time >= gc_time); | 704 ASSERT(total_time >= gc_time); |
| 705 int result= static_cast<int>((static_cast<double>(gc_time) / | 705 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 706 static_cast<double>(total_time)) * 100); | 706 static_cast<double>(total_time)) * 100); |
| 707 return result; | 707 return result; |
| 708 } | 708 } |
| 709 } | 709 } |
| 710 | 710 |
| 711 } // namespace dart | 711 } // namespace dart |
| OLD | NEW |