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

Side by Side Diff: runtime/vm/class_table.h

Issue 487973002: Track per-class promotion stats. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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
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 #ifndef VM_CLASS_TABLE_H_ 5 #ifndef VM_CLASS_TABLE_H_
6 #define VM_CLASS_TABLE_H_ 6 #define VM_CLASS_TABLE_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Snapshot before GC. 67 // Snapshot before GC.
68 AllocStats<intptr_t> pre_gc; 68 AllocStats<intptr_t> pre_gc;
69 // Live after GC. 69 // Live after GC.
70 AllocStats<intptr_t> post_gc; 70 AllocStats<intptr_t> post_gc;
71 // Allocations since the last GC. 71 // Allocations since the last GC.
72 AllocStats<intptr_t> recent; 72 AllocStats<intptr_t> recent;
73 // Accumulated (across GC) allocations . 73 // Accumulated (across GC) allocations .
74 AllocStats<int64_t> accumulated; 74 AllocStats<int64_t> accumulated;
75 // Snapshot of recent at the time of the last reset. 75 // Snapshot of recent at the time of the last reset.
76 AllocStats<intptr_t> last_reset; 76 AllocStats<intptr_t> last_reset;
77 // Promoted from new to old by last new GC.
78 intptr_t promoted_count;
79 intptr_t promoted_size;
77 80
78 static intptr_t allocated_since_gc_new_space_offset() { 81 static intptr_t allocated_since_gc_new_space_offset() {
79 return OFFSET_OF(ClassHeapStats, recent) + 82 return OFFSET_OF(ClassHeapStats, recent) +
80 OFFSET_OF(AllocStats<intptr_t>, new_count); 83 OFFSET_OF(AllocStats<intptr_t>, new_count);
81 } 84 }
82 static intptr_t allocated_since_gc_old_space_offset() { 85 static intptr_t allocated_since_gc_old_space_offset() {
83 return OFFSET_OF(ClassHeapStats, recent) + 86 return OFFSET_OF(ClassHeapStats, recent) +
84 OFFSET_OF(AllocStats<intptr_t>, old_count); 87 OFFSET_OF(AllocStats<intptr_t>, old_count);
85 } 88 }
86 static intptr_t allocated_size_since_gc_new_space_offset() { 89 static intptr_t allocated_size_since_gc_new_space_offset() {
87 return OFFSET_OF(ClassHeapStats, recent) + 90 return OFFSET_OF(ClassHeapStats, recent) +
88 OFFSET_OF(AllocStats<intptr_t>, new_size); 91 OFFSET_OF(AllocStats<intptr_t>, new_size);
89 } 92 }
90 static intptr_t allocated_size_since_gc_old_space_offset() { 93 static intptr_t allocated_size_since_gc_old_space_offset() {
91 return OFFSET_OF(ClassHeapStats, recent) + 94 return OFFSET_OF(ClassHeapStats, recent) +
92 OFFSET_OF(AllocStats<intptr_t>, old_size); 95 OFFSET_OF(AllocStats<intptr_t>, old_size);
93 } 96 }
94 97
95 void Initialize(); 98 void Initialize();
96 void ResetAtNewGC(); 99 void ResetAtNewGC();
97 void ResetAtOldGC(); 100 void ResetAtOldGC();
98 void ResetAccumulator(); 101 void ResetAccumulator();
102 void UpdatePromotedAfterNewGC();
99 void UpdateSize(intptr_t instance_size); 103 void UpdateSize(intptr_t instance_size);
100 void PrintToJSONObject(const Class& cls, JSONObject* obj) const; 104 void PrintToJSONObject(const Class& cls, JSONObject* obj) const;
105
106 private:
107 // Recent old at start of last new GC (used to compute promoted_*).
108 intptr_t old_pre_new_gc_count_;
109 intptr_t old_pre_new_gc_size_;
101 }; 110 };
102 111
103 112
104 class ClassTable { 113 class ClassTable {
105 public: 114 public:
106 ClassTable(); 115 ClassTable();
107 ~ClassTable(); 116 ~ClassTable();
108 117
109 RawClass* At(intptr_t index) const { 118 RawClass* At(intptr_t index) const {
110 ASSERT(IsValidIndex(index)); 119 ASSERT(IsValidIndex(index));
(...skipping 28 matching lines...) Expand all
139 } 148 }
140 149
141 // Called whenever a class is allocated in the runtime. 150 // Called whenever a class is allocated in the runtime.
142 void UpdateAllocatedNew(intptr_t cid, intptr_t size); 151 void UpdateAllocatedNew(intptr_t cid, intptr_t size);
143 void UpdateAllocatedOld(intptr_t cid, intptr_t size); 152 void UpdateAllocatedOld(intptr_t cid, intptr_t size);
144 153
145 // Called whenever a old GC occurs. 154 // Called whenever a old GC occurs.
146 void ResetCountersOld(); 155 void ResetCountersOld();
147 // Called whenever a new GC occurs. 156 // Called whenever a new GC occurs.
148 void ResetCountersNew(); 157 void ResetCountersNew();
158 // Called immediately after a new GC.
159 void UpdatePromoted();
149 160
150 // Used by the generated code. 161 // Used by the generated code.
151 uword PredefinedClassHeapStatsTableAddress() { 162 uword PredefinedClassHeapStatsTableAddress() {
152 return reinterpret_cast<uword>(predefined_class_heap_stats_table_); 163 return reinterpret_cast<uword>(predefined_class_heap_stats_table_);
153 } 164 }
154 165
155 // Used by generated code. 166 // Used by generated code.
156 uword ClassStatsTableAddress() { 167 uword ClassStatsTableAddress() {
157 return reinterpret_cast<uword>(&class_heap_stats_table_); 168 return reinterpret_cast<uword>(&class_heap_stats_table_);
158 } 169 }
(...skipping 24 matching lines...) Expand all
183 ClassHeapStats* PreliminaryStatsAt(intptr_t cid); 194 ClassHeapStats* PreliminaryStatsAt(intptr_t cid);
184 void UpdateLiveOld(intptr_t cid, intptr_t size); 195 void UpdateLiveOld(intptr_t cid, intptr_t size);
185 void UpdateLiveNew(intptr_t cid, intptr_t size); 196 void UpdateLiveNew(intptr_t cid, intptr_t size);
186 197
187 DISALLOW_COPY_AND_ASSIGN(ClassTable); 198 DISALLOW_COPY_AND_ASSIGN(ClassTable);
188 }; 199 };
189 200
190 } // namespace dart 201 } // namespace dart
191 202
192 #endif // VM_CLASS_TABLE_H_ 203 #endif // VM_CLASS_TABLE_H_
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/service/object.dart ('k') | runtime/vm/class_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698