Module: DeltaTest::Profiler

Defined in:
lib/delta_test/profiler.rb,
ext/delta_test/delta_test_native.c

Class Method Summary collapse

Class Method Details

.clean!Object

.clean! -> self

Uninstalls event hook



56
57
58
59
60
61
62
63
64
65
# File 'ext/delta_test/delta_test_native.c', line 56

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

    profile->running = Qfalse;
    dt_profiler_uninstall_hook();

    return self;
}

.last_resultObject



125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'ext/delta_test/delta_test_native.c', line 125

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?Boolean

.running? -> Boolean

Returns whether a profile is currently running

Returns:

  • (Boolean)


106
107
108
109
110
# File 'ext/delta_test/delta_test_native.c', line 106

static VALUE
dt_profiler_running(VALUE self)
{
    return profile->running;
}

.start!Object

.start! -> self

Starts recording profile data



72
73
74
75
76
77
78
79
80
81
82
83
# File 'ext/delta_test/delta_test_native.c', line 72

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!Object

.stop! -> self

Stops collecting profile data



90
91
92
93
94
95
96
97
98
99
# File 'ext/delta_test/delta_test_native.c', line 90

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

    return self;
}