aboutsummaryrefslogtreecommitdiffstats
path: root/gc.rb
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-02-14 15:55:25 -0500
committerPeter Zhu <peter@peterzhu.ca>2023-02-21 08:05:31 -0500
commit93ac7405b80cc61930d73da04441fa09af1851e1 (patch)
tree03b5a1f70186beee0b1dd01a44dfeda47f11d237 /gc.rb
parentd7c1ca48bf7754a23bfe1559422736029b4787a0 (diff)
downloadruby-93ac7405b80cc61930d73da04441fa09af1851e1.tar.gz
Add marking and sweeping time to GC.stat
There is a `time` key in GC.stat that gives us the total time spent in GC. However, we don't know what proportion of the time is spent between marking and sweeping. This makes it difficult to tune the GC as we're not sure where to focus our efforts on. This PR adds keys `marking_time` and `sweeping_time` to GC.stat for the time spent marking and sweeping, in milliseconds. [Feature #19437]
Diffstat (limited to 'gc.rb')
-rw-r--r--gc.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/gc.rb b/gc.rb
index 495f203487..dd4fb6c274 100644
--- a/gc.rb
+++ b/gc.rb
@@ -282,7 +282,7 @@ module GC
# Return measured \GC total time in nano seconds.
def self.total_time
Primitive.cexpr! %{
- ULL2NUM(rb_objspace.profile.total_time_ns)
+ ULL2NUM(rb_objspace.profile.marking_time_ns + rb_objspace.profile.sweeping_time_ns)
}
end
end