Skip to content

Commit

Permalink
[mycpp/runtime] Keep track of total GC time
Browse files Browse the repository at this point in the history
With #ifdef GC_TIMING
  • Loading branch information
Andy C committed Dec 16, 2022
1 parent fb3b504 commit 6dd3d1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mycpp/mark_sweep_heap.cc
Expand Up @@ -47,6 +47,7 @@ void MarkSweepHeap::Report() {
log(" objs capacity = %10d", live_objs_.capacity());
log("");
log(" max gc millis = %10.1f", max_gc_millis_);
log("total gc millis = %10.1f", total_gc_millis_);
}

#if defined(MALLOC_LEAK)
Expand Down Expand Up @@ -266,6 +267,7 @@ int MarkSweepHeap::Collect() {
#endif
#endif

total_gc_millis_ += gc_millis;
if (gc_millis > max_gc_millis_) {
max_gc_millis_ = gc_millis;
}
Expand Down
1 change: 1 addition & 0 deletions mycpp/mark_sweep_heap.h
Expand Up @@ -180,6 +180,7 @@ class MarkSweepHeap {
// int64_t bytes_live_ = 0;

double max_gc_millis_ = 0.0;
double total_gc_millis_ = 0.0;

// OLD rooting
std::vector<Obj**> roots_;
Expand Down

0 comments on commit 6dd3d1a

Please sign in to comment.