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

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

Issue 204103009: Add class and address information to heap map; display on hover. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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/service.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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 : ObjectVisitor(NULL), array_(array) {} 434 : ObjectVisitor(NULL), array_(array) {}
435 virtual void VisitObject(RawObject* obj) { 435 virtual void VisitObject(RawObject* obj) {
436 array_->AddValue(obj->Size() / kObjectAlignment); 436 array_->AddValue(obj->Size() / kObjectAlignment);
437 array_->AddValue(obj->GetClassId()); 437 array_->AddValue(obj->GetClassId());
438 } 438 }
439 private: 439 private:
440 JSONArray* array_; 440 JSONArray* array_;
441 }; 441 };
442 442
443 443
444 void PageSpace::PrintHeapMapToJSONStream(JSONStream* stream) { 444 void PageSpace::PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) {
445 JSONObject heap_map(stream); 445 JSONObject heap_map(stream);
446 heap_map.AddProperty("type", "HeapMap"); 446 heap_map.AddProperty("type", "HeapMap");
447 heap_map.AddProperty("id", "heapmap"); 447 heap_map.AddProperty("id", "heapmap");
448 heap_map.AddProperty("free_class_id", 448 heap_map.AddProperty("free_class_id",
449 static_cast<intptr_t>(kFreeListElement)); 449 static_cast<intptr_t>(kFreeListElement));
450 heap_map.AddProperty("unit_size_bytes", 450 heap_map.AddProperty("unit_size_bytes",
451 static_cast<intptr_t>(kObjectAlignment)); 451 static_cast<intptr_t>(kObjectAlignment));
452 heap_map.AddProperty("page_size_bytes", kPageSizeInWords * kWordSize);
452 { 453 {
453 // "pages" is an array [page0, page1, ..., pageN], each page an array 454 JSONObject class_list(&heap_map, "class_list");
454 // [size, class id, size, class id, ...] (size unit is kObjectAlignment). 455 isolate->class_table()->PrintToJSONObject(&class_list);
456 }
457 {
458 // "pages" is an array [page0, page1, ..., pageN], each page of the form
459 // {"object_start": "0x...", "objects": [size, class id, size, ...]}
455 JSONArray all_pages(&heap_map, "pages"); 460 JSONArray all_pages(&heap_map, "pages");
456 for (HeapPage* page = pages_; page != NULL; page = page->next()) { 461 for (HeapPage* page = pages_; page != NULL; page = page->next()) {
457 JSONArray page_map(&all_pages); 462 JSONObject page_container(&all_pages);
463 page_container.AddPropertyF("object_start",
464 "0x%" Px "", page->object_start());
465 JSONArray page_map(&page_container, "objects");
458 HeapMapAsJSONVisitor printer(&page_map); 466 HeapMapAsJSONVisitor printer(&page_map);
459 page->VisitObjects(&printer); 467 page->VisitObjects(&printer);
460 } 468 }
461 } 469 }
462 } 470 }
463 471
464 472
465 bool PageSpace::ShouldCollectCode() { 473 bool PageSpace::ShouldCollectCode() {
466 // Try to collect code if enough time has passed since the last attempt. 474 // Try to collect code if enough time has passed since the last attempt.
467 const int64_t start = OS::GetCurrentTimeMicros(); 475 const int64_t start = OS::GetCurrentTimeMicros();
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 return 0; 745 return 0;
738 } else { 746 } else {
739 ASSERT(total_time >= gc_time); 747 ASSERT(total_time >= gc_time);
740 int result= static_cast<int>((static_cast<double>(gc_time) / 748 int result= static_cast<int>((static_cast<double>(gc_time) /
741 static_cast<double>(total_time)) * 100); 749 static_cast<double>(total_time)) * 100);
742 return result; 750 return result;
743 } 751 }
744 } 752 }
745 753
746 } // namespace dart 754 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698