| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 JSONObject space(object, "old"); | 378 JSONObject space(object, "old"); |
| 379 space.AddProperty("type", "PageSpace"); | 379 space.AddProperty("type", "PageSpace"); |
| 380 space.AddProperty("id", "heaps/old"); | 380 space.AddProperty("id", "heaps/old"); |
| 381 space.AddProperty("name", "PageSpace"); | 381 space.AddProperty("name", "PageSpace"); |
| 382 space.AddProperty("user_name", "old"); | 382 space.AddProperty("user_name", "old"); |
| 383 space.AddProperty("collections", collections()); | 383 space.AddProperty("collections", collections()); |
| 384 space.AddProperty("used", UsedInWords() * kWordSize); | 384 space.AddProperty("used", UsedInWords() * kWordSize); |
| 385 space.AddProperty("capacity", CapacityInWords() * kWordSize); | 385 space.AddProperty("capacity", CapacityInWords() * kWordSize); |
| 386 space.AddProperty("external", ExternalInWords() * kWordSize); | 386 space.AddProperty("external", ExternalInWords() * kWordSize); |
| 387 space.AddProperty("time", MicrosecondsToSeconds(gc_time_micros())); | 387 space.AddProperty("time", MicrosecondsToSeconds(gc_time_micros())); |
| 388 { | 388 if (collections() > 0) { |
| 389 int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time(); | 389 int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time(); |
| 390 run_time = Utils::Maximum(run_time, static_cast<int64_t>(0)); | 390 run_time = Utils::Maximum(run_time, static_cast<int64_t>(0)); |
| 391 double run_time_millis = MicrosecondsToMilliseconds(run_time); | 391 double run_time_millis = MicrosecondsToMilliseconds(run_time); |
| 392 double avg_time_between_collections = | 392 double avg_time_between_collections = |
| 393 run_time_millis / static_cast<double>(collections()); | 393 run_time_millis / static_cast<double>(collections()); |
| 394 space.AddProperty("avgCollectionPeriodMillis", | 394 space.AddProperty("avgCollectionPeriodMillis", |
| 395 avg_time_between_collections); | 395 avg_time_between_collections); |
| 396 } else { |
| 397 space.AddProperty("avgCollectionPeriodMillis", 0.0); |
| 396 } | 398 } |
| 397 } | 399 } |
| 398 | 400 |
| 399 | 401 |
| 400 class HeapMapAsJSONVisitor : public ObjectVisitor { | 402 class HeapMapAsJSONVisitor : public ObjectVisitor { |
| 401 public: | 403 public: |
| 402 explicit HeapMapAsJSONVisitor(JSONArray* array) | 404 explicit HeapMapAsJSONVisitor(JSONArray* array) |
| 403 : ObjectVisitor(NULL), array_(array) {} | 405 : ObjectVisitor(NULL), array_(array) {} |
| 404 virtual void VisitObject(RawObject* obj) { | 406 virtual void VisitObject(RawObject* obj) { |
| 405 array_->AddValue(obj->Size() / kObjectAlignment); | 407 array_->AddValue(obj->Size() / kObjectAlignment); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 return 0; | 695 return 0; |
| 694 } else { | 696 } else { |
| 695 ASSERT(total_time >= gc_time); | 697 ASSERT(total_time >= gc_time); |
| 696 int result= static_cast<int>((static_cast<double>(gc_time) / | 698 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 697 static_cast<double>(total_time)) * 100); | 699 static_cast<double>(total_time)) * 100); |
| 698 return result; | 700 return result; |
| 699 } | 701 } |
| 700 } | 702 } |
| 701 | 703 |
| 702 } // namespace dart | 704 } // namespace dart |
| OLD | NEW |