Class: Mwrap::HeapPageBody
- Inherits:
-
Object
- Object
- Mwrap::HeapPageBody
- Defined in:
- ext/mwrap/mwrap.c
Class Method Summary collapse
-
.Mwrap::HeapPageBody.each {|gen, addr| ... } ⇒ Integer
Yields the generation (GC.count) the heap page body was created and address of the heap page body as an Integer.
-
.stat(*args) ⇒ Object
Mwrap::HeapPageBody.stat -> Hash Mwrap::HeapPageBody.stat(hash) -> hash.
Class Method Details
.Mwrap::HeapPageBody.each {|gen, addr| ... } ⇒ Integer
Yields the generation (GC.count) the heap page body was created and address of the heap page body as an Integer. Returns the number of allocated pages as an Integer. This return value should match the result of GC.stat(:heap_allocated_pages)
1267 1268 1269 1270 1271 |
# File 'ext/mwrap/mwrap.c', line 1267
static VALUE hpb_each(VALUE mod)
{
++locating;
return rb_ensure(hpb_each_yield, Qfalse, reset_locating, 0);
}
|
.stat(*args) ⇒ Object
Mwrap::HeapPageBody.stat -> Hash Mwrap::HeapPageBody.stat(hash) -> hash
The maximum lifespan of a heap page body in the Ruby VM. This may be Infinity if no heap page bodies were ever freed.
1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 |
# File 'ext/mwrap/mwrap.c', line 1282
static VALUE hpb_stat(int argc, VALUE *argv, VALUE hpb)
{
VALUE h;
rb_scan_args(argc, argv, "01", &h);
if (NIL_P(h))
h = rb_hash_new();
else if (!RB_TYPE_P(h, T_HASH))
rb_raise(rb_eTypeError, "not a hash %+"PRIsVALUE, h);
++locating;
#define S(x) ID2SYM(rb_intern(#x))
rb_hash_aset(h, S(lifespan_max), acc_max(&hpb_stats.alive));
rb_hash_aset(h, S(lifespan_min), acc_min(&hpb_stats.alive));
rb_hash_aset(h, S(lifespan_mean), acc_mean(&hpb_stats.alive));
rb_hash_aset(h, S(lifespan_stddev), acc_stddev(&hpb_stats.alive));
rb_hash_aset(h, S(deathspan_max), acc_max(&hpb_stats.reborn));
rb_hash_aset(h, S(deathspan_min), acc_min(&hpb_stats.reborn));
rb_hash_aset(h, S(deathspan_mean), acc_mean(&hpb_stats.reborn));
rb_hash_aset(h, S(deathspan_stddev), acc_stddev(&hpb_stats.reborn));
rb_hash_aset(h, S(resurrects), SIZET2NUM(hpb_stats.reborn.nr));
#undef S
--locating;
return h;
}
|