Chromium Code Reviews| Index: runtime/vm/class_table.h |
| diff --git a/runtime/vm/class_table.h b/runtime/vm/class_table.h |
| index 6ea4dfa7034b94199d53dd94381ad803e3af19c8..0c3e22b55e3d3fe03309d5b36510f19de2231d73 100644 |
| --- a/runtime/vm/class_table.h |
| +++ b/runtime/vm/class_table.h |
| @@ -11,9 +11,42 @@ |
| namespace dart { |
| class Class; |
| +class ClassStats; |
| +class JSONStream; |
| class ObjectPointerVisitor; |
| class RawClass; |
| -class JSONStream; |
| + |
| + |
| +class ClassHeapStats { |
| + public: |
| + intptr_t live_count_old_space; |
| + intptr_t live_count_new_space; |
| + intptr_t live_size_old_space; |
| + intptr_t live_size_new_space; |
| + |
| + // These fields are updated by generated code: |
| + intptr_t new_count_since_gc_new_space; |
|
Ivan Posva
2013/12/13 23:13:18
new_count_since_gc -> allocated
|
| + intptr_t new_count_since_gc_old_space; |
| + intptr_t new_size_since_gc_new_space; |
| + intptr_t new_size_since_gc_old_space; |
| + |
| + static intptr_t new_count_since_gc_new_space_offset() { |
| + return OFFSET_OF(ClassHeapStats, new_count_since_gc_new_space); |
| + } |
| + static intptr_t new_count_since_gc_old_space_offset() { |
| + return OFFSET_OF(ClassHeapStats, new_count_since_gc_old_space); |
| + } |
| + static intptr_t new_size_since_gc_new_space_offset() { |
| + return OFFSET_OF(ClassHeapStats, new_size_since_gc_new_space); |
| + } |
| + static intptr_t new_size_since_gc_old_space_offset() { |
| + return OFFSET_OF(ClassHeapStats, new_size_since_gc_old_space); |
| + } |
| + |
| + void Initialize(); |
| + void ResetAtGC(); |
| +}; |
| + |
| class ClassTable { |
| public: |
| @@ -48,14 +81,41 @@ class ClassTable { |
| return OFFSET_OF(ClassTable, table_); |
| } |
| + // Called whenever a class is allocated in the runtime. |
| + void ReportAllocationNew(intptr_t cid, intptr_t size); |
|
Ivan Posva
2013/12/13 23:13:18
UpdateAllocatedNew which would be in sync with Upd
|
| + void ReportAllocationOld(intptr_t cid, intptr_t size); |
| + |
| + // Called whenever a major GC occurs. |
| + void ResetCounters(); |
| + |
| + // Used by the generated code. |
| + uword PredefinedClassHeapStatsTableAddress() { |
| + return reinterpret_cast<uword>(predefined_class_heap_stats_table_); |
| + } |
| + |
| + // Used by generated code. |
| + uword ClassStatsTableAddress() { |
| + return reinterpret_cast<uword>(&class_heap_stats_table_); |
| + } |
| + |
| private: |
| + friend class MarkingVisitor; |
| static const int initial_capacity_ = 512; |
| static const int capacity_increment_ = 256; |
| + static bool CollectInstanceSizesForClass(intptr_t cid); |
| + |
| intptr_t top_; |
| intptr_t capacity_; |
| RawClass** table_; |
| + ClassHeapStats* class_heap_stats_table_; |
| + |
| + ClassHeapStats* predefined_class_heap_stats_table_; |
| + |
| + ClassHeapStats* StatsAt(intptr_t cid); |
| + void UpdateLiveOld(intptr_t cid, intptr_t size); |
| + void UpdateLiveNew(intptr_t cid, intptr_t size); |
| DISALLOW_COPY_AND_ASSIGN(ClassTable); |
| }; |