Permalink
Browse files

Add GC.stat (1.9.3) based on Agent GC/memory variables.

  • Loading branch information...
1 parent ae196d6 commit d7a7a0c624312f068359fcd2c1ebe40555da45cc @headius headius committed Jan 4, 2012
Showing with 39 additions and 0 deletions.
  1. +38 −0 kernel/common/gc19.rb
  2. +1 −0 kernel/common/load_order19.txt
View
@@ -0,0 +1,38 @@
+module GC
+ def self.stat
+ @agent ||= begin
+ require 'rubinius/agent'
+ Rubinius::Agent.loopback
+ end
+
+ stats = {
+ :gc => {
+ :young => {
+ :count => @agent.get('system.gc.young.count')[1],
+ :total_wallclock => @agent.get('system.gc.young.total_wallclock')[1]
+ },
+ :full => {
+ :count => @agent.get('system.gc.full.count')[1],
+ :total_wallclock => @agent.get('system.gc.full.total_wallclock')[1]
+ }
+ },
+ :memory => {
+ :counter => {
+ :young_objects => @agent.get("system.memory.counter.young_objects")[1],
+ :young_bytes => @agent.get("system.memory.counter.young_bytes")[1],
+ :promoted_bytes => @agent.get("system.memory.counter.promoted_objects")[1],
+ :promoted_bytes => @agent.get("system.memory.counter.promoted_bytes")[1],
+ :mature_objects => @agent.get("system.memory.counter.mature_objects")[1],
+ :mature_bytes => @agent.get("system.memory.counter.mature_bytes")[1],
+ },
+ :young => {:bytes => @agent.get("system.memory.young.bytes")[1]},
+ :mature => {:bytes => @agent.get("system.memory.mature.bytes")[1]},
+ :large => {:bytes => @agent.get("system.memory.large.bytes")[1]},
+ :code => {:bytes => @agent.get("system.memory.code.bytes")[1]},
+ :symbols => {:bytes => @agent.get("system.memory.symbols.bytes")[1]}
+ }
+ }
+
+ stats
+ end
+end
@@ -117,3 +117,4 @@ rational.rbc
rationalizer.rbc
complex.rbc
complexifier.rbc
+gc19.rbc

0 comments on commit d7a7a0c

Please sign in to comment.