VM: add marking as a timed gc phase

I think that makes sense because most time when doing a full gc is spent
marking.
char-rename
Björn Lindqvist 2016-10-20 07:46:21 +02:00
parent 752c895d23
commit f070a47ec0
4 changed files with 12 additions and 3 deletions

View File

@ -197,6 +197,7 @@ SYMBOL: gc-events
{ "Total time:" [ [ total-time>> ] map-sum nanos>string ] } { "Total time:" [ [ total-time>> ] map-sum nanos>string ] }
{ "Card scan time:" [ PHASE-CARD-SCAN sum-phase-times ] } { "Card scan time:" [ PHASE-CARD-SCAN sum-phase-times ] }
{ "Code block scan time:" [ PHASE-CODE-SCAN sum-phase-times ] } { "Code block scan time:" [ PHASE-CODE-SCAN sum-phase-times ] }
{ "Marking time:" [ PHASE-MARKING sum-phase-times ] }
{ "Data heap sweep time:" [ PHASE-DATA-SWEEP sum-phase-times ] } { "Data heap sweep time:" [ PHASE-DATA-SWEEP sum-phase-times ] }
{ "Code heap sweep time:" [ PHASE-CODE-SWEEP sum-phase-times ] } { "Code heap sweep time:" [ PHASE-CODE-SWEEP sum-phase-times ] }
{ "Data compaction time:" [ PHASE-DATA-COMPACTION sum-phase-times ] } { "Data compaction time:" [ PHASE-DATA-COMPACTION sum-phase-times ] }

View File

@ -86,6 +86,7 @@ CONSTANT: PHASE-CODE-SCAN 1
CONSTANT: PHASE-DATA-SWEEP 2 CONSTANT: PHASE-DATA-SWEEP 2
CONSTANT: PHASE-CODE-SWEEP 3 CONSTANT: PHASE-CODE-SWEEP 3
CONSTANT: PHASE-DATA-COMPACTION 4 CONSTANT: PHASE-DATA-COMPACTION 4
CONSTANT: PHASE-MARKING 5
! gc-event should be kept in sync with: ! gc-event should be kept in sync with:
! vm/gc.hpp ! vm/gc.hpp
@ -100,7 +101,7 @@ STRUCT: gc-event
{ code-blocks-scanned cell_t } { code-blocks-scanned cell_t }
{ start-time ulonglong } { start-time ulonglong }
{ total-time cell_t } { total-time cell_t }
{ times cell_t[5] } { times cell_t[6] }
{ temp-time ulonglong } ; { temp-time ulonglong } ;
! gc-info should be kept in sync with: ! gc-info should be kept in sync with:

View File

@ -57,6 +57,10 @@ struct full_collection_copier : no_fixup {
}; };
void factor_vm::collect_mark_impl() { void factor_vm::collect_mark_impl() {
gc_event* event = current_gc->event;
if (event)
event->reset_timer();
slot_visitor<full_collection_copier> slot_visitor<full_collection_copier>
visitor(this, full_collection_copier(data->tenured, code, &mark_stack)); visitor(this, full_collection_copier(data->tenured, code, &mark_stack));
@ -75,11 +79,13 @@ void factor_vm::collect_mark_impl() {
data->reset_aging(); data->reset_aging();
data->reset_nursery(); data->reset_nursery();
code->clear_remembered_set(); code->clear_remembered_set();
if (event)
event->ended_phase(PHASE_MARKING);
} }
void factor_vm::collect_sweep_impl() { void factor_vm::collect_sweep_impl() {
gc_event* event = current_gc->event; gc_event* event = current_gc->event;
if (event) if (event)
event->reset_timer(); event->reset_timer();
data->tenured->sweep(); data->tenured->sweep();

View File

@ -19,6 +19,7 @@ enum gc_phase {
PHASE_DATA_SWEEP, PHASE_DATA_SWEEP,
PHASE_CODE_SWEEP, PHASE_CODE_SWEEP,
PHASE_DATA_COMPACTION, PHASE_DATA_COMPACTION,
PHASE_MARKING
}; };
struct gc_event { struct gc_event {
@ -32,7 +33,7 @@ struct gc_event {
cell code_blocks_scanned; cell code_blocks_scanned;
uint64_t start_time; uint64_t start_time;
cell total_time; cell total_time;
cell times[5]; cell times[6];
uint64_t temp_time; uint64_t temp_time;
gc_event(gc_op op, factor_vm* parent); gc_event(gc_op op, factor_vm* parent);