Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
VM: add marking as a timed gc phase
I think that makes sense because most time when doing a full gc is spent
marking.
  • Loading branch information
bjourne committed Oct 20, 2016
1 parent 752c895 commit f070a47
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions basis/tools/memory/memory.factor
Expand Up @@ -197,6 +197,7 @@ SYMBOL: gc-events
{ "Total time:" [ [ total-time>> ] map-sum nanos>string ] }
{ "Card scan time:" [ PHASE-CARD-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 ] }
{ "Code heap sweep time:" [ PHASE-CODE-SWEEP sum-phase-times ] }
{ "Data compaction time:" [ PHASE-DATA-COMPACTION sum-phase-times ] }
Expand Down
3 changes: 2 additions & 1 deletion basis/vm/vm.factor
Expand Up @@ -86,6 +86,7 @@ CONSTANT: PHASE-CODE-SCAN 1
CONSTANT: PHASE-DATA-SWEEP 2
CONSTANT: PHASE-CODE-SWEEP 3
CONSTANT: PHASE-DATA-COMPACTION 4
CONSTANT: PHASE-MARKING 5

! gc-event should be kept in sync with:
! vm/gc.hpp
Expand All @@ -100,7 +101,7 @@ STRUCT: gc-event
{ code-blocks-scanned cell_t }
{ start-time ulonglong }
{ total-time cell_t }
{ times cell_t[5] }
{ times cell_t[6] }
{ temp-time ulonglong } ;

! gc-info should be kept in sync with:
Expand Down
8 changes: 7 additions & 1 deletion vm/full_collector.cpp
Expand Up @@ -57,6 +57,10 @@ struct full_collection_copier : no_fixup {
};

void factor_vm::collect_mark_impl() {
gc_event* event = current_gc->event;
if (event)
event->reset_timer();

slot_visitor<full_collection_copier>
visitor(this, full_collection_copier(data->tenured, code, &mark_stack));

Expand All @@ -75,11 +79,13 @@ void factor_vm::collect_mark_impl() {
data->reset_aging();
data->reset_nursery();
code->clear_remembered_set();

if (event)
event->ended_phase(PHASE_MARKING);
}

void factor_vm::collect_sweep_impl() {
gc_event* event = current_gc->event;

if (event)
event->reset_timer();
data->tenured->sweep();
Expand Down
3 changes: 2 additions & 1 deletion vm/gc.hpp
Expand Up @@ -19,6 +19,7 @@ enum gc_phase {
PHASE_DATA_SWEEP,
PHASE_CODE_SWEEP,
PHASE_DATA_COMPACTION,
PHASE_MARKING
};

struct gc_event {
Expand All @@ -32,7 +33,7 @@ struct gc_event {
cell code_blocks_scanned;
uint64_t start_time;
cell total_time;
cell times[5];
cell times[6];
uint64_t temp_time;

gc_event(gc_op op, factor_vm* parent);
Expand Down

0 comments on commit f070a47

Please sign in to comment.