Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
GC::Profiler.total_time
() -> ::Float
GC::Profiler.total_time → float
gc/default/default.c
View on GitHub ↗
static VALUE
gc_profile_total_time(VALUE self)
{
double time = 0;
rb_objspace_t *objspace = rb_gc_get_objspace();
if (objspace->profile.run && gc_profile_record_count(objspace) > 0) {
size_t i;
size_t count = gc_profile_record_count(objspace);
for (i = 0; i < count; i++) {
time += objspace->profile.records[gc_profile_record_index(objspace, i)].gc_time;
}
}
return DBL2NUM(time);
}
The total time used for garbage collection in seconds