OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_GC_TRACER_H_ | 5 #ifndef V8_GC_TRACER_H_ |
6 #define V8_GC_TRACER_H_ | 6 #define V8_GC_TRACER_H_ |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 154 matching lines...) Loading... | |
165 // Total amount of space either wasted or contained in one of free lists | 165 // Total amount of space either wasted or contained in one of free lists |
166 // before the current GC. | 166 // before the current GC. |
167 intptr_t start_holes_size; | 167 intptr_t start_holes_size; |
168 | 168 |
169 // Total amount of space either wasted or contained in one of free lists | 169 // Total amount of space either wasted or contained in one of free lists |
170 // after the current GC. | 170 // after the current GC. |
171 intptr_t end_holes_size; | 171 intptr_t end_holes_size; |
172 | 172 |
173 // Number of incremental marking steps since creation of tracer. | 173 // Number of incremental marking steps since creation of tracer. |
174 // (value at start of event) | 174 // (value at start of event) |
175 int cumulative_incremental_marking_steps; | |
176 | |
177 // Incremental marking steps since | |
178 // - last event for SCAVENGER events | |
179 // - last MARK_COMPACTOR event for MARK_COMPACTOR events | |
175 int incremental_marking_steps; | 180 int incremental_marking_steps; |
176 | 181 |
182 // Bytes marked since creation of tracer (value at start of event). | |
183 intptr_t cumulative_incremental_marking_bytes; | |
184 | |
185 // Bytes marked since | |
186 // - last event for SCAVENGER events | |
187 // - last MARK_COMPACTOR event for MARK_COMPACTOR events | |
188 intptr_t incremental_marking_bytes; | |
189 | |
177 // Cumulative duration of incremental marking steps since creation of | 190 // Cumulative duration of incremental marking steps since creation of |
178 // tracer. (value at start of event) | 191 // tracer. (value at start of event) |
192 double cumulative_incremental_marking_duration; | |
193 | |
194 // Duration of incremental marking steps since | |
195 // - last event for SCAVENGER events | |
196 // - last MARK_COMPACTOR event for MARK_COMPACTOR events | |
179 double incremental_marking_duration; | 197 double incremental_marking_duration; |
180 | 198 |
181 // Longest incremental marking step since start of marking. | 199 // Longest incremental marking step since start of marking. |
182 // (value at start of event) | 200 // (value at start of event) |
183 double longest_incremental_marking_step; | 201 double longest_incremental_marking_step; |
184 | 202 |
185 // Amounts of time spent in different scopes during GC. | 203 // Amounts of time spent in different scopes during GC. |
186 double scopes[Scope::NUMBER_OF_SCOPES]; | 204 double scopes[Scope::NUMBER_OF_SCOPES]; |
187 }; | 205 }; |
188 | 206 |
189 static const int kRingBufferMaxSize = 10; | 207 static const int kRingBufferMaxSize = 10; |
190 | 208 |
191 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; | 209 typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer; |
192 | 210 |
193 explicit GCTracer(Heap* heap); | 211 explicit GCTracer(Heap* heap); |
194 | 212 |
195 // Start collecting data. | 213 // Start collecting data. |
196 void Start(GarbageCollector collector, const char* gc_reason, | 214 void Start(GarbageCollector collector, const char* gc_reason, |
197 const char* collector_reason); | 215 const char* collector_reason); |
198 | 216 |
199 // Stop collecting data and print results. | 217 // Stop collecting data and print results. |
200 void Stop(); | 218 void Stop(); |
201 | 219 |
202 // Log an incremental marking step. | 220 // Log an incremental marking step. |
203 void AddIncrementalMarkingStep(double duration); | 221 void AddIncrementalMarkingStep(double duration, intptr_t bytes); |
204 | 222 |
205 // Compute the mean duration of the last scavenger events. Returns 0 if no | 223 // Compute the mean duration of the last scavenger events. Returns 0 if no |
206 // events have been recorded. | 224 // events have been recorded. |
207 double MeanScavengerDuration() const { | 225 double MeanScavengerDuration() const { |
208 return MeanDuration(scavenger_events_); | 226 return MeanDuration(scavenger_events_); |
209 } | 227 } |
210 | 228 |
211 // Compute the max duration of the last scavenger events. Returns 0 if no | 229 // Compute the max duration of the last scavenger events. Returns 0 if no |
212 // events have been recorded. | 230 // events have been recorded. |
213 double MaxScavengerDuration() const { return MaxDuration(scavenger_events_); } | 231 double MaxScavengerDuration() const { return MaxDuration(scavenger_events_); } |
(...skipping 11 matching lines...) Loading... | |
225 } | 243 } |
226 | 244 |
227 // Compute the mean step duration of the last incremental marking round. | 245 // Compute the mean step duration of the last incremental marking round. |
228 // Returns 0 if no incremental marking round has been completed. | 246 // Returns 0 if no incremental marking round has been completed. |
229 double MeanIncrementalMarkingDuration() const; | 247 double MeanIncrementalMarkingDuration() const; |
230 | 248 |
231 // Compute the max step duration of the last incremental marking round. | 249 // Compute the max step duration of the last incremental marking round. |
232 // Returns 0 if no incremental marking round has been completed. | 250 // Returns 0 if no incremental marking round has been completed. |
233 double MaxIncrementalMarkingDuration() const; | 251 double MaxIncrementalMarkingDuration() const; |
234 | 252 |
253 // Compute the average incremental marking speed in bytes/second. Returns 0 if | |
254 // no events have been recorded. | |
255 double MarkingSpeedInBytesPerMillisecond() const; | |
Hannes Payer (out of office)
2014/07/28 13:04:13
No need for double here, lets cast it to e.g. intp
ernstm
2014/07/28 14:43:26
Done.
| |
256 | |
235 private: | 257 private: |
236 // Print one detailed trace line in name=value format. | 258 // Print one detailed trace line in name=value format. |
237 // TODO(ernstm): Move to Heap. | 259 // TODO(ernstm): Move to Heap. |
238 void PrintNVP() const; | 260 void PrintNVP() const; |
239 | 261 |
240 // Print one trace line. | 262 // Print one trace line. |
241 // TODO(ernstm): Move to Heap. | 263 // TODO(ernstm): Move to Heap. |
242 void Print() const; | 264 void Print() const; |
243 | 265 |
244 // Compute the mean duration of the events in the given ring buffer. | 266 // Compute the mean duration of the events in the given ring buffer. |
(...skipping 15 matching lines...) Loading... | |
260 // Previous MARK_COMPACTOR event. | 282 // Previous MARK_COMPACTOR event. |
261 Event previous_mark_compactor_event_; | 283 Event previous_mark_compactor_event_; |
262 | 284 |
263 // RingBuffers for SCAVENGER events. | 285 // RingBuffers for SCAVENGER events. |
264 EventBuffer scavenger_events_; | 286 EventBuffer scavenger_events_; |
265 | 287 |
266 // RingBuffers for MARK_COMPACTOR events. | 288 // RingBuffers for MARK_COMPACTOR events. |
267 EventBuffer mark_compactor_events_; | 289 EventBuffer mark_compactor_events_; |
268 | 290 |
269 // Cumulative number of incremental marking steps since creation of tracer. | 291 // Cumulative number of incremental marking steps since creation of tracer. |
270 int incremental_marking_steps_; | 292 int cumulative_incremental_marking_steps_; |
293 | |
294 // Cumulative size of incremental marking steps (in bytes) since creation of | |
295 // tracer. | |
296 intptr_t cumulative_incremental_marking_bytes_; | |
271 | 297 |
272 // Cumulative duration of incremental marking steps since creation of tracer. | 298 // Cumulative duration of incremental marking steps since creation of tracer. |
273 double incremental_marking_duration_; | 299 double cumulative_incremental_marking_duration_; |
274 | 300 |
275 // Longest incremental marking step since start of marking. | 301 // Longest incremental marking step since start of marking. |
276 double longest_incremental_marking_step_; | 302 double longest_incremental_marking_step_; |
277 | 303 |
278 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 304 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
279 }; | 305 }; |
280 } | 306 } |
281 } // namespace v8::internal | 307 } // namespace v8::internal |
282 | 308 |
283 #endif // V8_GC_TRACER_H_ | 309 #endif // V8_GC_TRACER_H_ |
OLD | NEW |