diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-03 23:13:57 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-03 23:13:57 +0000 |
commit | 4cdcfbe2ba2a9b529c189dc5e17b386d425e1920 (patch) | |
tree | 25bc39a12ae82aa0c2b5381453266287a55d0d6c /gc.c | |
parent | 19c4d26c5138830c4a7d2435ce1af7d7184913c3 (diff) |
* gc.c (count_objects): count TOTAL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -2155,7 +2155,8 @@ rb_obj_id(VALUE obj) * * Counts objects for each type. * - * It returns a hash as: {:FREE=>3012, :T_OBJECT=>6, :T_CLASS=>404, ...} + * It returns a hash as: + * {:TOTAL=>10000, :FREE=>3011, :T_OBJECT=>6, :T_CLASS=>404, ...} * * If the optional argument, result_hash, is given, * it is overwritten and returned. @@ -2173,6 +2174,7 @@ count_objects(int argc, VALUE *argv, VALUE os) { long counts[T_MASK+1]; long freed = 0; + long total = 0; int i; VALUE hash; @@ -2197,10 +2199,12 @@ count_objects(int argc, VALUE *argv, VALUE os) freed++; } } + total += heaps[i].limit; } if (hash == Qnil) hash = rb_hash_new(); + rb_hash_aset(hash, ID2SYM(rb_intern("TOTAL")), LONG2NUM(total)); rb_hash_aset(hash, ID2SYM(rb_intern("FREE")), LONG2NUM(freed)); for (i = 0; i <= T_MASK; i++) { VALUE type; |