Sha256: 0b533c93be2841dccb5767482540918807bb0e1e61984155245116c1cb5672e0
Contents?: true
Size: 756 Bytes
Versions: 20
Compression:
Stored size: 756 Bytes
Contents
#include <ruby/ruby.h> #include <ruby/debug.h> static __thread uint64_t allocated_objects = 0; static VALUE rb_mPlainApm; static VALUE rb_mObjTracing; static VALUE total_thread_allocated_objects(VALUE self) { return ULL2NUM(allocated_objects); } static void track_thread_allocated_objects(VALUE tpval, void *data) { allocated_objects++; } void Init_object_tracing(void) { rb_mPlainApm = rb_define_module("PlainApm"); rb_mObjTracing = rb_define_module_under(rb_mPlainApm, "ObjectTracing"); rb_define_singleton_method(rb_mObjTracing, "total_thread_allocated_objects", total_thread_allocated_objects, 0); VALUE tpval = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ, track_thread_allocated_objects, NULL); rb_tracepoint_enable(tpval); }
Version data entries
20 entries across 20 versions & 1 rubygems