| 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_HEAP_GC_TRACER_H_ | 5 #ifndef V8_HEAP_GC_TRACER_H_ |
| 6 #define V8_HEAP_GC_TRACER_H_ | 6 #define V8_HEAP_GC_TRACER_H_ |
| 7 | 7 |
| 8 #include "src/base/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/counters.h" | 10 #include "src/counters.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 typedef std::pair<uint64_t, double> BytesAndDuration; | 55 typedef std::pair<uint64_t, double> BytesAndDuration; |
| 56 | 56 |
| 57 inline BytesAndDuration MakeBytesAndDuration(uint64_t bytes, double duration) { | 57 inline BytesAndDuration MakeBytesAndDuration(uint64_t bytes, double duration) { |
| 58 return std::make_pair(bytes, duration); | 58 return std::make_pair(bytes, duration); |
| 59 } | 59 } |
| 60 | 60 |
| 61 enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects }; | 61 enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects }; |
| 62 | 62 |
| 63 #define INCREMENTAL_SCOPES(F) \ | 63 #define INCREMENTAL_SCOPES(F) \ |
| 64 F(MC_INCREMENTAL_WRAPPER_PROLOGUE) \ | 64 /* MC_INCREMENTAL is the top-level incremental marking scope. */ \ |
| 65 F(MC_INCREMENTAL_WRAPPER_TRACING) \ | 65 F(MC_INCREMENTAL) \ |
| 66 F(MC_INCREMENTAL_FINALIZE) \ | 66 F(MC_INCREMENTAL_WRAPPER_PROLOGUE) \ |
| 67 F(MC_INCREMENTAL_FINALIZE_OBJECT_GROUPING) \ | 67 F(MC_INCREMENTAL_WRAPPER_TRACING) \ |
| 68 F(MC_INCREMENTAL_EXTERNAL_EPILOGUE) \ | 68 F(MC_INCREMENTAL_FINALIZE) \ |
| 69 F(MC_INCREMENTAL_FINALIZE_BODY) \ |
| 70 F(MC_INCREMENTAL_FINALIZE_OBJECT_GROUPING) \ |
| 71 F(MC_INCREMENTAL_EXTERNAL_EPILOGUE) \ |
| 69 F(MC_INCREMENTAL_EXTERNAL_PROLOGUE) | 72 F(MC_INCREMENTAL_EXTERNAL_PROLOGUE) |
| 70 | 73 |
| 71 #define TRACER_SCOPES(F) \ | 74 #define TRACER_SCOPES(F) \ |
| 72 INCREMENTAL_SCOPES(F) \ | 75 INCREMENTAL_SCOPES(F) \ |
| 73 F(EXTERNAL_WEAK_GLOBAL_HANDLES) \ | 76 F(EXTERNAL_WEAK_GLOBAL_HANDLES) \ |
| 74 F(MC_CLEAR) \ | 77 F(MC_CLEAR) \ |
| 75 F(MC_CLEAR_CODE_FLUSH) \ | 78 F(MC_CLEAR_CODE_FLUSH) \ |
| 76 F(MC_CLEAR_DEPENDENT_CODE) \ | 79 F(MC_CLEAR_DEPENDENT_CODE) \ |
| 77 F(MC_CLEAR_GLOBAL_HANDLES) \ | 80 F(MC_CLEAR_GLOBAL_HANDLES) \ |
| 78 F(MC_CLEAR_MAPS) \ | 81 F(MC_CLEAR_MAPS) \ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 F(SCAVENGER_WEAK) | 124 F(SCAVENGER_WEAK) |
| 122 | 125 |
| 123 #define TRACE_GC(tracer, scope_id) \ | 126 #define TRACE_GC(tracer, scope_id) \ |
| 124 GCTracer::Scope::ScopeId gc_tracer_scope_id(scope_id); \ | 127 GCTracer::Scope::ScopeId gc_tracer_scope_id(scope_id); \ |
| 125 GCTracer::Scope gc_tracer_scope(tracer, gc_tracer_scope_id); \ | 128 GCTracer::Scope gc_tracer_scope(tracer, gc_tracer_scope_id); \ |
| 126 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"), \ | 129 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.gc"), \ |
| 127 GCTracer::Scope::Name(gc_tracer_scope_id)) | 130 GCTracer::Scope::Name(gc_tracer_scope_id)) |
| 128 | 131 |
| 129 // GCTracer collects and prints ONE line after each garbage collector | 132 // GCTracer collects and prints ONE line after each garbage collector |
| 130 // invocation IFF --trace_gc is used. | 133 // invocation IFF --trace_gc is used. |
| 131 // TODO(ernstm): Unit tests. | |
| 132 class GCTracer { | 134 class GCTracer { |
| 133 public: | 135 public: |
| 136 struct IncrementalMarkingInfos { |
| 137 IncrementalMarkingInfos() |
| 138 : cumulative_duration(0), longest_step(0), steps(0) {} |
| 139 |
| 140 void Update(double duration) { |
| 141 steps++; |
| 142 cumulative_duration += duration; |
| 143 if (duration > longest_step) { |
| 144 longest_step = duration; |
| 145 } |
| 146 } |
| 147 |
| 148 void ResetCurrentCycle() { |
| 149 longest_step = 0; |
| 150 steps = 0; |
| 151 } |
| 152 |
| 153 double cumulative_duration; |
| 154 double longest_step; |
| 155 int steps; |
| 156 }; |
| 157 |
| 134 class Scope { | 158 class Scope { |
| 135 public: | 159 public: |
| 136 enum ScopeId { | 160 enum ScopeId { |
| 137 #define DEFINE_SCOPE(scope) scope, | 161 #define DEFINE_SCOPE(scope) scope, |
| 138 TRACER_SCOPES(DEFINE_SCOPE) | 162 TRACER_SCOPES(DEFINE_SCOPE) |
| 139 #undef DEFINE_SCOPE | 163 #undef DEFINE_SCOPE |
| 140 NUMBER_OF_SCOPES, | 164 NUMBER_OF_SCOPES, |
| 141 | 165 |
| 142 FIRST_INCREMENTAL_SCOPE = MC_INCREMENTAL_WRAPPER_PROLOGUE, | 166 FIRST_INCREMENTAL_SCOPE = MC_INCREMENTAL, |
| 143 LAST_INCREMENTAL_SCOPE = MC_INCREMENTAL_EXTERNAL_PROLOGUE, | 167 LAST_INCREMENTAL_SCOPE = MC_INCREMENTAL_EXTERNAL_PROLOGUE, |
| 144 NUMBER_OF_INCREMENTAL_SCOPES = | 168 NUMBER_OF_INCREMENTAL_SCOPES = |
| 145 LAST_INCREMENTAL_SCOPE - FIRST_INCREMENTAL_SCOPE + 1 | 169 LAST_INCREMENTAL_SCOPE - FIRST_INCREMENTAL_SCOPE + 1 |
| 146 }; | 170 }; |
| 147 | 171 |
| 148 Scope(GCTracer* tracer, ScopeId scope); | 172 Scope(GCTracer* tracer, ScopeId scope); |
| 149 ~Scope(); | 173 ~Scope(); |
| 150 static const char* Name(ScopeId id); | 174 static const char* Name(ScopeId id); |
| 151 | 175 |
| 152 private: | 176 private: |
| 153 GCTracer* tracer_; | 177 GCTracer* tracer_; |
| 154 ScopeId scope_; | 178 ScopeId scope_; |
| 155 double start_time_; | 179 double start_time_; |
| 156 RuntimeCallTimer timer_; | 180 RuntimeCallTimer timer_; |
| 157 | 181 |
| 158 DISALLOW_COPY_AND_ASSIGN(Scope); | 182 DISALLOW_COPY_AND_ASSIGN(Scope); |
| 159 }; | 183 }; |
| 160 | 184 |
| 161 | 185 |
| 162 class Event { | 186 class Event { |
| 163 public: | 187 public: |
| 164 enum Type { | 188 enum Type { |
| 165 SCAVENGER = 0, | 189 SCAVENGER = 0, |
| 166 MARK_COMPACTOR = 1, | 190 MARK_COMPACTOR = 1, |
| 167 INCREMENTAL_MARK_COMPACTOR = 2, | 191 INCREMENTAL_MARK_COMPACTOR = 2, |
| 168 START = 3 | 192 START = 3 |
| 169 }; | 193 }; |
| 170 | 194 |
| 171 // Default constructor leaves the event uninitialized. | |
| 172 Event() {} | |
| 173 | |
| 174 Event(Type type, const char* gc_reason, const char* collector_reason); | 195 Event(Type type, const char* gc_reason, const char* collector_reason); |
| 175 | 196 |
| 176 // Returns a string describing the event type. | 197 // Returns a string describing the event type. |
| 177 const char* TypeName(bool short_name) const; | 198 const char* TypeName(bool short_name) const; |
| 178 | 199 |
| 179 // Type of event | 200 // Type of event |
| 180 Type type; | 201 Type type; |
| 181 | 202 |
| 182 const char* gc_reason; | 203 const char* gc_reason; |
| 183 const char* collector_reason; | 204 const char* collector_reason; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 206 // Total amount of space either wasted or contained in one of free lists | 227 // Total amount of space either wasted or contained in one of free lists |
| 207 // before the current GC. | 228 // before the current GC. |
| 208 intptr_t start_holes_size; | 229 intptr_t start_holes_size; |
| 209 | 230 |
| 210 // Total amount of space either wasted or contained in one of free lists | 231 // Total amount of space either wasted or contained in one of free lists |
| 211 // after the current GC. | 232 // after the current GC. |
| 212 intptr_t end_holes_size; | 233 intptr_t end_holes_size; |
| 213 | 234 |
| 214 // Size of new space objects in constructor. | 235 // Size of new space objects in constructor. |
| 215 intptr_t new_space_object_size; | 236 intptr_t new_space_object_size; |
| 237 |
| 216 // Size of survived new space objects in destructor. | 238 // Size of survived new space objects in destructor. |
| 217 intptr_t survived_new_space_object_size; | 239 intptr_t survived_new_space_object_size; |
| 218 | 240 |
| 219 // Number of incremental marking steps since creation of tracer. | |
| 220 // (value at start of event) | |
| 221 int cumulative_incremental_marking_steps; | |
| 222 | |
| 223 // Incremental marking steps since | |
| 224 // - last event for SCAVENGER events | |
| 225 // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR | |
| 226 // events | |
| 227 int incremental_marking_steps; | |
| 228 | |
| 229 // Bytes marked since creation of tracer (value at start of event). | 241 // Bytes marked since creation of tracer (value at start of event). |
| 230 intptr_t cumulative_incremental_marking_bytes; | 242 intptr_t cumulative_incremental_marking_bytes; |
| 231 | 243 |
| 232 // Bytes marked since | 244 // Bytes marked since |
| 233 // - last event for SCAVENGER events | 245 // - last event for SCAVENGER events |
| 234 // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR | 246 // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR |
| 235 // events | 247 // events |
| 236 intptr_t incremental_marking_bytes; | 248 intptr_t incremental_marking_bytes; |
| 237 | 249 |
| 238 // Cumulative duration of incremental marking steps since creation of | |
| 239 // tracer. (value at start of event) | |
| 240 double cumulative_incremental_marking_duration; | |
| 241 | |
| 242 // Duration of incremental marking steps since | |
| 243 // - last event for SCAVENGER events | |
| 244 // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR | |
| 245 // events | |
| 246 double incremental_marking_duration; | |
| 247 | |
| 248 // Cumulative pure duration of incremental marking steps since creation of | 250 // Cumulative pure duration of incremental marking steps since creation of |
| 249 // tracer. (value at start of event) | 251 // tracer. (value at start of event) |
| 250 double cumulative_pure_incremental_marking_duration; | 252 double cumulative_pure_incremental_marking_duration; |
| 251 | 253 |
| 252 // Duration of pure incremental marking steps since | 254 // Duration of pure incremental marking steps since |
| 253 // - last event for SCAVENGER events | 255 // - last event for SCAVENGER events |
| 254 // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR | 256 // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR |
| 255 // events | 257 // events |
| 256 double pure_incremental_marking_duration; | 258 double pure_incremental_marking_duration; |
| 257 | 259 |
| 258 // Longest incremental marking step since start of marking (start of event). | |
| 259 double longest_incremental_marking_step; | |
| 260 | |
| 261 // Number of incremental marking finalization steps since creation of | |
| 262 // tracer. | |
| 263 int cumulative_incremental_marking_finalization_steps; | |
| 264 | |
| 265 // Cumulative pure duration of incremental marking steps since creation of | |
| 266 // tracer. (value at start of event) | |
| 267 double cumulative_incremental_marking_finalizaton_duration; | |
| 268 | |
| 269 // Longest incremental marking finalization step since start of marking | |
| 270 // (start of event). | |
| 271 double longest_incremental_marking_finalization_step; | |
| 272 | |
| 273 // Incremental marking finalization steps since | |
| 274 // - last event for SCAVENGER events | |
| 275 // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR | |
| 276 // events | |
| 277 int incremental_marking_finalizaton_steps; | |
| 278 | |
| 279 // Duration of incremental marking finalization steps since | |
| 280 // - last event for SCAVENGER events | |
| 281 // - last INCREMENTAL_MARK_COMPACTOR event for INCREMENTAL_MARK_COMPACTOR | |
| 282 // events | |
| 283 double incremental_marking_finalization_duration; | |
| 284 | |
| 285 double cumulative_incremental_scopes[Scope::NUMBER_OF_INCREMENTAL_SCOPES]; | |
| 286 | |
| 287 // Amounts of time spent in different scopes during GC. | 260 // Amounts of time spent in different scopes during GC. |
| 288 double scopes[Scope::NUMBER_OF_SCOPES]; | 261 double scopes[Scope::NUMBER_OF_SCOPES]; |
| 262 |
| 263 // Holds details for incremental marking scopes. |
| 264 IncrementalMarkingInfos |
| 265 incremental_marking_scopes[Scope::NUMBER_OF_INCREMENTAL_SCOPES]; |
| 289 }; | 266 }; |
| 290 | 267 |
| 291 static const int kThroughputTimeFrameMs = 5000; | 268 static const int kThroughputTimeFrameMs = 5000; |
| 292 | 269 |
| 293 explicit GCTracer(Heap* heap); | 270 explicit GCTracer(Heap* heap); |
| 294 | 271 |
| 295 // Start collecting data. | 272 // Start collecting data. |
| 296 void Start(GarbageCollector collector, const char* gc_reason, | 273 void Start(GarbageCollector collector, const char* gc_reason, |
| 297 const char* collector_reason); | 274 const char* collector_reason); |
| 298 | 275 |
| 299 // Stop collecting data and print results. | 276 // Stop collecting data and print results. |
| 300 void Stop(GarbageCollector collector); | 277 void Stop(GarbageCollector collector); |
| 301 | 278 |
| 302 // Sample and accumulate bytes allocated since the last GC. | 279 // Sample and accumulate bytes allocated since the last GC. |
| 303 void SampleAllocation(double current_ms, size_t new_space_counter_bytes, | 280 void SampleAllocation(double current_ms, size_t new_space_counter_bytes, |
| 304 size_t old_generation_counter_bytes); | 281 size_t old_generation_counter_bytes); |
| 305 | 282 |
| 306 // Log the accumulated new space allocation bytes. | 283 // Log the accumulated new space allocation bytes. |
| 307 void AddAllocation(double current_ms); | 284 void AddAllocation(double current_ms); |
| 308 | 285 |
| 309 void AddContextDisposalTime(double time); | 286 void AddContextDisposalTime(double time); |
| 310 | 287 |
| 311 void AddCompactionEvent(double duration, intptr_t live_bytes_compacted); | 288 void AddCompactionEvent(double duration, intptr_t live_bytes_compacted); |
| 312 | 289 |
| 313 void AddSurvivalRatio(double survival_ratio); | 290 void AddSurvivalRatio(double survival_ratio); |
| 314 | 291 |
| 315 // Log an incremental marking step. | 292 // Log an incremental marking step. |
| 316 void AddIncrementalMarkingStep(double duration, intptr_t bytes); | 293 void AddIncrementalMarkingStep(double duration, intptr_t bytes); |
| 317 | 294 |
| 318 void AddIncrementalMarkingFinalizationStep(double duration); | |
| 319 | |
| 320 // Log time spent in marking. | 295 // Log time spent in marking. |
| 321 void AddMarkingTime(double duration) { | 296 void AddMarkingTime(double duration) { |
| 322 cumulative_marking_duration_ += duration; | 297 cumulative_marking_duration_ += duration; |
| 323 } | 298 } |
| 324 | 299 |
| 325 // Time spent in marking. | 300 // Time spent in marking. |
| 326 double cumulative_marking_duration() const { | 301 double cumulative_marking_duration() const { |
| 327 return cumulative_marking_duration_; | 302 return cumulative_marking_duration_; |
| 328 } | 303 } |
| 329 | 304 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 // events. | 374 // events. |
| 400 // Returns 0 if no events have been recorded. | 375 // Returns 0 if no events have been recorded. |
| 401 double AverageSurvivalRatio() const; | 376 double AverageSurvivalRatio() const; |
| 402 | 377 |
| 403 // Returns true if at least one survival event was recorded. | 378 // Returns true if at least one survival event was recorded. |
| 404 bool SurvivalEventsRecorded() const; | 379 bool SurvivalEventsRecorded() const; |
| 405 | 380 |
| 406 // Discard all recorded survival events. | 381 // Discard all recorded survival events. |
| 407 void ResetSurvivalEvents(); | 382 void ResetSurvivalEvents(); |
| 408 | 383 |
| 409 void AddScopeSample(Scope::ScopeId scope, double duration); | 384 V8_INLINE void AddScopeSample(Scope::ScopeId scope, double duration) { |
| 385 DCHECK(scope < Scope::NUMBER_OF_SCOPES); |
| 386 if (scope >= Scope::FIRST_INCREMENTAL_SCOPE && |
| 387 scope <= Scope::LAST_INCREMENTAL_SCOPE) { |
| 388 incremental_marking_scopes_[scope].Update(duration); |
| 389 } else { |
| 390 current_.scopes[scope] += duration; |
| 391 } |
| 392 } |
| 410 | 393 |
| 411 private: | 394 private: |
| 412 FRIEND_TEST(GCTracer, AverageSpeed); | 395 FRIEND_TEST(GCTracer, AverageSpeed); |
| 413 FRIEND_TEST(GCTracerTest, AllocationThroughput); | 396 FRIEND_TEST(GCTracerTest, AllocationThroughput); |
| 414 FRIEND_TEST(GCTracerTest, NewSpaceAllocationThroughput); | 397 FRIEND_TEST(GCTracerTest, NewSpaceAllocationThroughput); |
| 415 FRIEND_TEST(GCTracerTest, NewSpaceAllocationThroughputWithProvidedTime); | 398 FRIEND_TEST(GCTracerTest, NewSpaceAllocationThroughputWithProvidedTime); |
| 416 FRIEND_TEST(GCTracerTest, OldGenerationAllocationThroughputWithProvidedTime); | 399 FRIEND_TEST(GCTracerTest, OldGenerationAllocationThroughputWithProvidedTime); |
| 417 FRIEND_TEST(GCTracerTest, RegularScope); | 400 FRIEND_TEST(GCTracerTest, RegularScope); |
| 401 FRIEND_TEST(GCTracerTest, IncrementalMarkingDetails); |
| 418 FRIEND_TEST(GCTracerTest, IncrementalScope); | 402 FRIEND_TEST(GCTracerTest, IncrementalScope); |
| 419 | 403 |
| 420 // Returns the average speed of the events in the buffer. | 404 // Returns the average speed of the events in the buffer. |
| 421 // If the buffer is empty, the result is 0. | 405 // If the buffer is empty, the result is 0. |
| 422 // Otherwise, the result is between 1 byte/ms and 1 GB/ms. | 406 // Otherwise, the result is between 1 byte/ms and 1 GB/ms. |
| 423 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer); | 407 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer); |
| 424 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer, | 408 static double AverageSpeed(const RingBuffer<BytesAndDuration>& buffer, |
| 425 const BytesAndDuration& initial, double time_ms); | 409 const BytesAndDuration& initial, double time_ms); |
| 426 | 410 |
| 411 void MergeBaseline(const Event& baseline); |
| 412 |
| 427 void ResetForTesting(); | 413 void ResetForTesting(); |
| 428 | 414 |
| 429 // Print one detailed trace line in name=value format. | 415 // Print one detailed trace line in name=value format. |
| 430 // TODO(ernstm): Move to Heap. | 416 // TODO(ernstm): Move to Heap. |
| 431 void PrintNVP() const; | 417 void PrintNVP() const; |
| 432 | 418 |
| 433 // Print one trace line. | 419 // Print one trace line. |
| 434 // TODO(ernstm): Move to Heap. | 420 // TODO(ernstm): Move to Heap. |
| 435 void Print() const; | 421 void Print() const; |
| 436 | 422 |
| 437 // Prints a line and also adds it to the heap's ring buffer so that | 423 // Prints a line and also adds it to the heap's ring buffer so that |
| 438 // it can be included in later crash dumps. | 424 // it can be included in later crash dumps. |
| 439 void PRINTF_FORMAT(2, 3) Output(const char* format, ...) const; | 425 void PRINTF_FORMAT(2, 3) Output(const char* format, ...) const; |
| 440 | 426 |
| 441 void ClearMarkCompactStatistics() { | |
| 442 cumulative_incremental_marking_steps_ = 0; | |
| 443 cumulative_incremental_marking_bytes_ = 0; | |
| 444 cumulative_incremental_marking_duration_ = 0; | |
| 445 cumulative_pure_incremental_marking_duration_ = 0; | |
| 446 longest_incremental_marking_step_ = 0; | |
| 447 cumulative_incremental_marking_finalization_steps_ = 0; | |
| 448 cumulative_incremental_marking_finalization_duration_ = 0; | |
| 449 longest_incremental_marking_finalization_step_ = 0; | |
| 450 cumulative_marking_duration_ = 0; | |
| 451 cumulative_sweeping_duration_ = 0; | |
| 452 } | |
| 453 | |
| 454 double TotalExternalTime() const { | 427 double TotalExternalTime() const { |
| 455 return current_.scopes[Scope::EXTERNAL_WEAK_GLOBAL_HANDLES] + | 428 return current_.scopes[Scope::EXTERNAL_WEAK_GLOBAL_HANDLES] + |
| 456 current_.scopes[Scope::MC_EXTERNAL_EPILOGUE] + | 429 current_.scopes[Scope::MC_EXTERNAL_EPILOGUE] + |
| 457 current_.scopes[Scope::MC_EXTERNAL_PROLOGUE] + | 430 current_.scopes[Scope::MC_EXTERNAL_PROLOGUE] + |
| 458 current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_EPILOGUE] + | 431 current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_EPILOGUE] + |
| 459 current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_PROLOGUE] + | 432 current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_PROLOGUE] + |
| 460 current_.scopes[Scope::SCAVENGER_EXTERNAL_EPILOGUE] + | 433 current_.scopes[Scope::SCAVENGER_EXTERNAL_EPILOGUE] + |
| 461 current_.scopes[Scope::SCAVENGER_EXTERNAL_PROLOGUE]; | 434 current_.scopes[Scope::SCAVENGER_EXTERNAL_PROLOGUE]; |
| 462 } | 435 } |
| 463 | 436 |
| 464 // Pointer to the heap that owns this tracer. | 437 // Pointer to the heap that owns this tracer. |
| 465 Heap* heap_; | 438 Heap* heap_; |
| 466 | 439 |
| 467 // Current tracer event. Populated during Start/Stop cycle. Valid after Stop() | 440 // Current tracer event. Populated during Start/Stop cycle. Valid after Stop() |
| 468 // has returned. | 441 // has returned. |
| 469 Event current_; | 442 Event current_; |
| 470 | 443 |
| 471 // Previous tracer event. | 444 // Previous tracer event. |
| 472 Event previous_; | 445 Event previous_; |
| 473 | 446 |
| 474 // Previous INCREMENTAL_MARK_COMPACTOR event. | 447 // Previous INCREMENTAL_MARK_COMPACTOR event. |
| 475 Event previous_incremental_mark_compactor_event_; | 448 Event previous_incremental_mark_compactor_event_; |
| 476 | 449 |
| 477 // Cumulative number of incremental marking steps since creation of tracer. | |
| 478 int cumulative_incremental_marking_steps_; | |
| 479 | |
| 480 // Cumulative size of incremental marking steps (in bytes) since creation of | 450 // Cumulative size of incremental marking steps (in bytes) since creation of |
| 481 // tracer. | 451 // tracer. |
| 482 intptr_t cumulative_incremental_marking_bytes_; | 452 intptr_t cumulative_incremental_marking_bytes_; |
| 483 | 453 |
| 484 // Cumulative duration of incremental marking steps since creation of tracer. | 454 // Cumulative duration of incremental marking steps since creation of tracer. |
| 485 double cumulative_incremental_marking_duration_; | 455 double cumulative_incremental_marking_duration_; |
| 486 | 456 |
| 487 // Cumulative duration of pure incremental marking steps since creation of | 457 // Cumulative duration of pure incremental marking steps since creation of |
| 488 // tracer. | 458 // tracer. |
| 489 double cumulative_pure_incremental_marking_duration_; | 459 double cumulative_pure_incremental_marking_duration_; |
| 490 | 460 |
| 491 // Longest incremental marking step since start of marking. | |
| 492 double longest_incremental_marking_step_; | |
| 493 | |
| 494 // Cumulative number of incremental marking finalization steps since creation | |
| 495 // of tracer. | |
| 496 int cumulative_incremental_marking_finalization_steps_; | |
| 497 | |
| 498 // Cumulative duration of incremental marking finalization steps since | |
| 499 // creation of tracer. | |
| 500 double cumulative_incremental_marking_finalization_duration_; | |
| 501 | |
| 502 // Longest incremental marking finalization step since start of marking. | |
| 503 double longest_incremental_marking_finalization_step_; | |
| 504 | |
| 505 // Total marking time. | 461 // Total marking time. |
| 506 // This timer is precise when run with --print-cumulative-gc-stat | 462 // This timer is precise when run with --print-cumulative-gc-stat |
| 507 double cumulative_marking_duration_; | 463 double cumulative_marking_duration_; |
| 508 | 464 |
| 509 // Cumulative duration of incremental marking scopes since the creation of | 465 // Incremental scopes carry more information than just the duration. The infos |
| 510 // the tracer. | 466 // here are merged back upon starting/stopping the GC tracer. |
| 511 double cumulative_incremental_scopes_[Scope::NUMBER_OF_INCREMENTAL_SCOPES]; | 467 IncrementalMarkingInfos |
| 468 incremental_marking_scopes_[Scope::NUMBER_OF_INCREMENTAL_SCOPES]; |
| 512 | 469 |
| 513 // Total sweeping time on the main thread. | 470 // Total sweeping time on the main thread. |
| 514 // This timer is precise when run with --print-cumulative-gc-stat | 471 // This timer is precise when run with --print-cumulative-gc-stat |
| 515 // TODO(hpayer): Account for sweeping time on sweeper threads. Add a | 472 // TODO(hpayer): Account for sweeping time on sweeper threads. Add a |
| 516 // different field for that. | 473 // different field for that. |
| 517 // TODO(hpayer): This timer right now just holds the sweeping time | 474 // TODO(hpayer): This timer right now just holds the sweeping time |
| 518 // of the initial atomic sweeping pause. Make sure that it accumulates | 475 // of the initial atomic sweeping pause. Make sure that it accumulates |
| 519 // all sweeping operations performed on the main thread. | 476 // all sweeping operations performed on the main thread. |
| 520 double cumulative_sweeping_duration_; | 477 double cumulative_sweeping_duration_; |
| 521 | 478 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 547 RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; | 504 RingBuffer<BytesAndDuration> recorded_old_generation_allocations_; |
| 548 RingBuffer<double> recorded_context_disposal_times_; | 505 RingBuffer<double> recorded_context_disposal_times_; |
| 549 RingBuffer<double> recorded_survival_ratios_; | 506 RingBuffer<double> recorded_survival_ratios_; |
| 550 | 507 |
| 551 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 508 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
| 552 }; | 509 }; |
| 553 } // namespace internal | 510 } // namespace internal |
| 554 } // namespace v8 | 511 } // namespace v8 |
| 555 | 512 |
| 556 #endif // V8_HEAP_GC_TRACER_H_ | 513 #endif // V8_HEAP_GC_TRACER_H_ |
| OLD | NEW |