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

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

Issue 353003005: Display average time between collections (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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/bin/vmservice/client/lib/src/service/object.dart ('k') | runtime/vm/scavenger.cc » ('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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 void PageSpace::WriteProtect(bool read_only) { 366 void PageSpace::WriteProtect(bool read_only) {
367 HeapPage* page = pages_; 367 HeapPage* page = pages_;
368 while (page != NULL) { 368 while (page != NULL) {
369 page->WriteProtect(read_only); 369 page->WriteProtect(read_only);
370 page = NextPageAnySize(page); 370 page = NextPageAnySize(page);
371 } 371 }
372 } 372 }
373 373
374 374
375 void PageSpace::PrintToJSONObject(JSONObject* object) { 375 void PageSpace::PrintToJSONObject(JSONObject* object) {
376 Isolate* isolate = Isolate::Current();
377 ASSERT(isolate != NULL);
376 JSONObject space(object, "old"); 378 JSONObject space(object, "old");
377 space.AddProperty("type", "PageSpace"); 379 space.AddProperty("type", "PageSpace");
378 space.AddProperty("id", "heaps/old"); 380 space.AddProperty("id", "heaps/old");
379 space.AddProperty("name", "PageSpace"); 381 space.AddProperty("name", "PageSpace");
380 space.AddProperty("user_name", "old"); 382 space.AddProperty("user_name", "old");
381 space.AddProperty("collections", collections()); 383 space.AddProperty("collections", collections());
382 space.AddProperty("used", UsedInWords() * kWordSize); 384 space.AddProperty("used", UsedInWords() * kWordSize);
383 space.AddProperty("capacity", CapacityInWords() * kWordSize); 385 space.AddProperty("capacity", CapacityInWords() * kWordSize);
384 space.AddProperty("external", ExternalInWords() * kWordSize); 386 space.AddProperty("external", ExternalInWords() * kWordSize);
385 space.AddProperty("time", MicrosecondsToSeconds(gc_time_micros())); 387 space.AddProperty("time", MicrosecondsToSeconds(gc_time_micros()));
388 {
389 int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time();
koda 2014/06/26 19:42:38 Note to self: yet another reason to consider a Spa
390 run_time = Utils::Maximum(run_time, static_cast<int64_t>(0));
391 double run_time_millis = MicrosecondsToMilliseconds(run_time);
392 double avg_time_between_collections =
393 run_time_millis / static_cast<double>(collections());
394 space.AddProperty("avgCollectionPeriodMillis",
395 avg_time_between_collections);
396 }
386 } 397 }
387 398
388 399
389 class HeapMapAsJSONVisitor : public ObjectVisitor { 400 class HeapMapAsJSONVisitor : public ObjectVisitor {
390 public: 401 public:
391 explicit HeapMapAsJSONVisitor(JSONArray* array) 402 explicit HeapMapAsJSONVisitor(JSONArray* array)
392 : ObjectVisitor(NULL), array_(array) {} 403 : ObjectVisitor(NULL), array_(array) {}
393 virtual void VisitObject(RawObject* obj) { 404 virtual void VisitObject(RawObject* obj) {
394 array_->AddValue(obj->Size() / kObjectAlignment); 405 array_->AddValue(obj->Size() / kObjectAlignment);
395 array_->AddValue(obj->GetClassId()); 406 array_->AddValue(obj->GetClassId());
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 return 0; 693 return 0;
683 } else { 694 } else {
684 ASSERT(total_time >= gc_time); 695 ASSERT(total_time >= gc_time);
685 int result= static_cast<int>((static_cast<double>(gc_time) / 696 int result= static_cast<int>((static_cast<double>(gc_time) /
686 static_cast<double>(total_time)) * 100); 697 static_cast<double>(total_time)) * 100);
687 return result; 698 return result;
688 } 699 }
689 } 700 }
690 701
691 } // namespace dart 702 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/service/object.dart ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698