static void rb_dl_init_callbacks(VALUE dl) { static const char cb[] = "dl/callback.so"; rb_autoload(dl, rb_intern_const("CdeclCallbackAddrs"), cb); rb_autoload(dl, rb_intern_const("CdeclCallbackProcs"), cb); #ifdef FUNC_STDCALL rb_autoload(dl, rb_intern_const("StdcallCallbackAddrs"), cb); rb_autoload(dl, rb_intern_const("StdcallCallbackProcs"), cb); #endif }
static VALUE rb_mod_autoload(VALUE mod, SEL sel, VALUE sym, VALUE file) { ID id = rb_to_id(sym); Check_SafeStr(file); rb_autoload(mod, id, RSTRING_PTR(file)); return Qnil; }
static VALUE rb_mod_autoload(VALUE mod, VALUE sym, VALUE file) { ID id = rb_to_id(sym); FilePathValue(file); rb_autoload(mod, id, RSTRING_PTR(file)); return Qnil; }
void Init_stackprof(void) { #define S(name) sym_##name = ID2SYM(rb_intern(#name)); S(object); S(custom); S(wall); S(cpu); S(name); S(file); S(line); S(total_samples); S(gc_samples); S(missed_samples); S(samples); S(edges); S(lines); S(version); S(mode); S(interval); S(raw); S(out); S(frames); S(aggregate); #undef S gc_hook = Data_Wrap_Struct(rb_cObject, stackprof_gc_mark, NULL, &_stackprof); rb_global_variable(&gc_hook); rb_mStackProf = rb_define_module("StackProf"); rb_define_singleton_method(rb_mStackProf, "running?", stackprof_running_p, 0); rb_define_singleton_method(rb_mStackProf, "run", stackprof_run, -1); rb_define_singleton_method(rb_mStackProf, "start", stackprof_start, -1); rb_define_singleton_method(rb_mStackProf, "stop", stackprof_stop, 0); rb_define_singleton_method(rb_mStackProf, "results", stackprof_results, -1); rb_define_singleton_method(rb_mStackProf, "sample", stackprof_sample, 0); rb_autoload(rb_mStackProf, rb_intern_const("Report"), "stackprof/report.rb"); rb_autoload(rb_mStackProf, rb_intern_const("Middleware"), "stackprof/middleware.rb"); pthread_atfork(stackprof_atfork_prepare, stackprof_atfork_parent, stackprof_atfork_child); }
void Init_stackprof(void) { sym_object = ID2SYM(rb_intern("object")); sym_custom = ID2SYM(rb_intern("custom")); sym_wall = ID2SYM(rb_intern("wall")); sym_cpu = ID2SYM(rb_intern("cpu")); sym_name = ID2SYM(rb_intern("name")); sym_file = ID2SYM(rb_intern("file")); sym_line = ID2SYM(rb_intern("line")); sym_total_samples = ID2SYM(rb_intern("total_samples")); sym_gc_samples = ID2SYM(rb_intern("gc_samples")); sym_missed_samples = ID2SYM(rb_intern("missed_samples")); sym_samples = ID2SYM(rb_intern("samples")); sym_edges = ID2SYM(rb_intern("edges")); sym_lines = ID2SYM(rb_intern("lines")); sym_version = ID2SYM(rb_intern("version")); sym_mode = ID2SYM(rb_intern("mode")); sym_interval = ID2SYM(rb_intern("interval")); sym_frames = ID2SYM(rb_intern("frames")); gc_hook = Data_Wrap_Struct(rb_cObject, stackprof_gc_mark, NULL, NULL); rb_global_variable(&gc_hook); rb_mStackProf = rb_define_module("StackProf"); rb_define_singleton_method(rb_mStackProf, "running?", stackprof_running_p, 0); rb_define_singleton_method(rb_mStackProf, "run", stackprof_run, -1); rb_define_singleton_method(rb_mStackProf, "start", stackprof_start, -1); rb_define_singleton_method(rb_mStackProf, "stop", stackprof_stop, 0); rb_define_singleton_method(rb_mStackProf, "results", stackprof_results, 0); rb_define_singleton_method(rb_mStackProf, "sample", stackprof_sample, 0); rb_autoload(rb_mStackProf, rb_intern_const("Report"), "stackprof/report.rb"); rb_autoload(rb_mStackProf, rb_intern_const("Middleware"), "stackprof/middleware.rb"); pthread_atfork(stackprof_atfork_prepare, stackprof_atfork_parent, stackprof_atfork_child); }
void Init_oobgc() { mOOB = rb_define_module_under(rb_mGC, "OOB"); rb_autoload(mOOB, rb_intern_const("UnicornMiddleware"), "gctools/oobgc/unicorn_middleware.rb"); rb_define_singleton_method(mOOB, "setup", install, 0); rb_define_singleton_method(mOOB, "run", oobgc_run, 0); rb_define_singleton_method(mOOB, "dry_run", oobgc_dry_run, 0); rb_define_singleton_method(mOOB, "stat", oobgc_stat, 1); rb_define_singleton_method(mOOB, "clear", oobgc_clear, 0); #define S(name) sym_##name = ID2SYM(rb_intern(#name)); S(total_allocated_object); S(heap_swept_slot); S(heap_tomb_page_length); S(heap_final_slot); S(old_object); S(old_object_limit); S(remembered_shady_object); S(remembered_shady_object_limit); S(major_by); S(count); S(major_count); S(minor_count); S(sweep_count); #undef S id_start = rb_intern("start"); _oobgc.heap_obj_limit = NUM2SIZET(rb_hash_aref(rb_const_get(rb_mGC, rb_intern("INTERNAL_CONSTANTS")), ID2SYM(rb_intern("HEAP_OBJ_LIMIT")))); minor_gc_args = rb_hash_new(); rb_hash_aset(minor_gc_args, ID2SYM(rb_intern("full_mark")), Qfalse); rb_ivar_set(mOOB, rb_intern("minor_gc_args"), minor_gc_args); }