module DeltaTest::Profiler

Public Class Methods

clean!() click to toggle source

.clean! -> self

Uninstalls event hook

static VALUE
dt_profiler_clean(VALUE self)
{
    st_clear(profile->file_table);

    profile->running = Qfalse;
    dt_profiler_uninstall_hook();

    return self;
}
last_result() click to toggle source
static VALUE
dt_profiler_last_result(VALUE self)
{
    if (profile->running) {
        return Qnil;
    }

    VALUE result = rb_ary_new();
    st_foreach(profile->file_table, dt_profiler_last_result_collect, result);
    rb_gc_mark(result);

    return result;
}
running?() click to toggle source

.running? -> Boolean

Returns whether a profile is currently running

static VALUE
dt_profiler_running(VALUE self)
{
    return profile->running;
}
start!() click to toggle source

.start! -> self

Starts recording profile data

static VALUE
dt_profiler_start(VALUE self)
{
    st_clear(profile->file_table);

    if (profile->running == Qfalse) {
        profile->running = Qtrue;
        dt_profiler_install_hook(self);
    }

    return self;
}
stop!() click to toggle source

.stop! -> self

Stops collecting profile data

static VALUE
dt_profiler_stop(VALUE self)
{
    if (profile->running == Qtrue) {
        dt_profiler_uninstall_hook();
        profile->running = Qfalse;
    }

    return self;
}