Class: Vernier::StackTable

Inherits:
Object
  • Object
show all
Includes:
StackTableHelpers
Defined in:
lib/vernier/stack_table.rb,
ext/vernier/stack_table.cc

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StackTableHelpers

#backtrace, #full_stack, #inspect, #stack, #to_h

Class Method Details

.newObject



267
268
269
# File 'ext/vernier/stack_table.cc', line 267

VALUE stack_table_new(VALUE self) {
    return StackTable::stack_table_new();
}

Instance Method Details

#current_stack(*args) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'ext/vernier/stack_table.cc', line 40

static VALUE
stack_table_current_stack(int argc, VALUE *argv, VALUE self) {
    int offset;
    VALUE offset_v;

    rb_scan_args(argc, argv, "01", &offset_v);
    if (argc > 0) {
        offset = NUM2INT(offset_v) + 1;
    } else {
        offset = 1;
    }

    StackTable *stack_table = get_stack_table(self);
    RawSample stack;
    stack.sample(offset);
    int stack_index = stack_table->stack_index(stack);
    return INT2NUM(stack_index);
}

#finalizeObject



133
134
135
136
137
138
# File 'ext/vernier/stack_table.cc', line 133

static VALUE
stack_table_finalize(VALUE self) {
    StackTable *stack_table = get_stack_table(self);
    stack_table->finalize();
    return self;
}

#stack_frame_idx(idxval) ⇒ Object



71
72
73
74
75
76
77
78
# File 'ext/vernier/stack_table.cc', line 71

static VALUE
stack_table_stack_frame_idx(VALUE self, VALUE idxval) {
    StackTable *stack_table = get_stack_table(self);
    //stack_table->finalize();
    int idx = NUM2INT(idxval);
    int frame_idx = stack_table->stack_frame(idx);
    return frame_idx < 0 ? Qnil : INT2NUM(frame_idx);
}

#stack_parent_idx(idxval) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'ext/vernier/stack_table.cc', line 59

static VALUE
stack_table_stack_parent_idx(VALUE self, VALUE idxval) {
    StackTable *stack_table = get_stack_table(self);
    int idx = NUM2INT(idxval);
    int parent_idx = stack_table->stack_parent(idx);
    if (parent_idx < 0) {
        return Qnil;
    } else {
        return INT2NUM(parent_idx);
    }
}