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/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 | 91 |
92 // GCTracer collects and prints ONE line after each garbage collector | 92 // GCTracer collects and prints ONE line after each garbage collector |
93 // invocation IFF --trace_gc is used. | 93 // invocation IFF --trace_gc is used. |
94 // TODO(ernstm): Unit tests. | 94 // TODO(ernstm): Unit tests. |
95 class GCTracer { | 95 class GCTracer { |
96 public: | 96 public: |
97 class Scope { | 97 class Scope { |
98 public: | 98 public: |
99 enum ScopeId { | 99 enum ScopeId { |
100 EXTERNAL, | 100 EXTERNAL_WEAK_GLOBAL_HANDLES, |
101 MC_CLEAR, | 101 MC_CLEAR, |
102 MC_CLEAR_CODE_FLUSH, | 102 MC_CLEAR_CODE_FLUSH, |
103 MC_CLEAR_DEPENDENT_CODE, | 103 MC_CLEAR_DEPENDENT_CODE, |
104 MC_CLEAR_GLOBAL_HANDLES, | 104 MC_CLEAR_GLOBAL_HANDLES, |
105 MC_CLEAR_MAPS, | 105 MC_CLEAR_MAPS, |
106 MC_CLEAR_SLOTS_BUFFER, | 106 MC_CLEAR_SLOTS_BUFFER, |
107 MC_CLEAR_STORE_BUFFER, | 107 MC_CLEAR_STORE_BUFFER, |
108 MC_CLEAR_STRING_TABLE, | 108 MC_CLEAR_STRING_TABLE, |
109 MC_CLEAR_WEAK_CELLS, | 109 MC_CLEAR_WEAK_CELLS, |
110 MC_CLEAR_WEAK_COLLECTIONS, | 110 MC_CLEAR_WEAK_COLLECTIONS, |
111 MC_CLEAR_WEAK_LISTS, | 111 MC_CLEAR_WEAK_LISTS, |
112 MC_EVACUATE, | 112 MC_EVACUATE, |
113 MC_EVACUATE_CANDIDATES, | 113 MC_EVACUATE_CANDIDATES, |
114 MC_EVACUATE_CLEAN_UP, | 114 MC_EVACUATE_CLEAN_UP, |
115 MC_EVACUATE_COPY, | 115 MC_EVACUATE_COPY, |
116 MC_EVACUATE_UPDATE_POINTERS, | 116 MC_EVACUATE_UPDATE_POINTERS, |
117 MC_EVACUATE_UPDATE_POINTERS_BETWEEN_EVACUATED, | 117 MC_EVACUATE_UPDATE_POINTERS_BETWEEN_EVACUATED, |
118 MC_EVACUATE_UPDATE_POINTERS_TO_EVACUATED, | 118 MC_EVACUATE_UPDATE_POINTERS_TO_EVACUATED, |
119 MC_EVACUATE_UPDATE_POINTERS_TO_NEW, | 119 MC_EVACUATE_UPDATE_POINTERS_TO_NEW, |
120 MC_EVACUATE_UPDATE_POINTERS_WEAK, | 120 MC_EVACUATE_UPDATE_POINTERS_WEAK, |
| 121 MC_EXTERNAL_EPILOGUE, |
| 122 MC_EXTERNAL_PROLOGUE, |
121 MC_FINISH, | 123 MC_FINISH, |
122 MC_INCREMENTAL_FINALIZE, | 124 MC_INCREMENTAL_FINALIZE, |
| 125 MC_INCREMENTAL_EXTERNAL_EPILOGUE, |
| 126 MC_INCREMENTAL_EXTERNAL_PROLOGUE, |
123 MC_MARK, | 127 MC_MARK, |
124 MC_MARK_FINISH_INCREMENTAL, | 128 MC_MARK_FINISH_INCREMENTAL, |
125 MC_MARK_PREPARE_CODE_FLUSH, | 129 MC_MARK_PREPARE_CODE_FLUSH, |
126 MC_MARK_ROOTS, | 130 MC_MARK_ROOTS, |
127 MC_MARK_WEAK_CLOSURE, | 131 MC_MARK_WEAK_CLOSURE, |
128 MC_SWEEP, | 132 MC_SWEEP, |
129 MC_SWEEP_CODE, | 133 MC_SWEEP_CODE, |
130 MC_SWEEP_MAP, | 134 MC_SWEEP_MAP, |
131 MC_SWEEP_OLD, | 135 MC_SWEEP_OLD, |
132 SCAVENGER_CODE_FLUSH_CANDIDATES, | 136 SCAVENGER_CODE_FLUSH_CANDIDATES, |
| 137 SCAVENGER_EXTERNAL_EPILOGUE, |
| 138 SCAVENGER_EXTERNAL_PROLOGUE, |
133 SCAVENGER_OBJECT_GROUPS, | 139 SCAVENGER_OBJECT_GROUPS, |
134 SCAVENGER_OLD_TO_NEW_POINTERS, | 140 SCAVENGER_OLD_TO_NEW_POINTERS, |
135 SCAVENGER_ROOTS, | 141 SCAVENGER_ROOTS, |
136 SCAVENGER_SCAVENGE, | 142 SCAVENGER_SCAVENGE, |
137 SCAVENGER_SEMISPACE, | 143 SCAVENGER_SEMISPACE, |
138 SCAVENGER_WEAK, | 144 SCAVENGER_WEAK, |
139 NUMBER_OF_SCOPES | 145 NUMBER_OF_SCOPES |
140 }; | 146 }; |
141 | 147 |
142 Scope(GCTracer* tracer, ScopeId scope); | 148 Scope(GCTracer* tracer, ScopeId scope); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 cumulative_incremental_marking_duration_ = 0; | 505 cumulative_incremental_marking_duration_ = 0; |
500 cumulative_pure_incremental_marking_duration_ = 0; | 506 cumulative_pure_incremental_marking_duration_ = 0; |
501 longest_incremental_marking_step_ = 0; | 507 longest_incremental_marking_step_ = 0; |
502 cumulative_incremental_marking_finalization_steps_ = 0; | 508 cumulative_incremental_marking_finalization_steps_ = 0; |
503 cumulative_incremental_marking_finalization_duration_ = 0; | 509 cumulative_incremental_marking_finalization_duration_ = 0; |
504 longest_incremental_marking_finalization_step_ = 0; | 510 longest_incremental_marking_finalization_step_ = 0; |
505 cumulative_marking_duration_ = 0; | 511 cumulative_marking_duration_ = 0; |
506 cumulative_sweeping_duration_ = 0; | 512 cumulative_sweeping_duration_ = 0; |
507 } | 513 } |
508 | 514 |
| 515 double TotalExternalTime() const { |
| 516 return current_.scopes[Scope::EXTERNAL_WEAK_GLOBAL_HANDLES] + |
| 517 current_.scopes[Scope::MC_EXTERNAL_EPILOGUE] + |
| 518 current_.scopes[Scope::MC_EXTERNAL_PROLOGUE] + |
| 519 current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_EPILOGUE] + |
| 520 current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_PROLOGUE] + |
| 521 current_.scopes[Scope::SCAVENGER_EXTERNAL_EPILOGUE] + |
| 522 current_.scopes[Scope::SCAVENGER_EXTERNAL_PROLOGUE]; |
| 523 } |
| 524 |
509 // Pointer to the heap that owns this tracer. | 525 // Pointer to the heap that owns this tracer. |
510 Heap* heap_; | 526 Heap* heap_; |
511 | 527 |
512 // Current tracer event. Populated during Start/Stop cycle. Valid after Stop() | 528 // Current tracer event. Populated during Start/Stop cycle. Valid after Stop() |
513 // has returned. | 529 // has returned. |
514 Event current_; | 530 Event current_; |
515 | 531 |
516 // Previous tracer event. | 532 // Previous tracer event. |
517 Event previous_; | 533 Event previous_; |
518 | 534 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 | 612 |
597 // Counts how many tracers were started without stopping. | 613 // Counts how many tracers were started without stopping. |
598 int start_counter_; | 614 int start_counter_; |
599 | 615 |
600 DISALLOW_COPY_AND_ASSIGN(GCTracer); | 616 DISALLOW_COPY_AND_ASSIGN(GCTracer); |
601 }; | 617 }; |
602 } // namespace internal | 618 } // namespace internal |
603 } // namespace v8 | 619 } // namespace v8 |
604 | 620 |
605 #endif // V8_HEAP_GC_TRACER_H_ | 621 #endif // V8_HEAP_GC_TRACER_H_ |
OLD | NEW |