Class: Vernier::Collector::TimeCollector
- Inherits:
-
Vernier::Collector
- Object
- Vernier::Collector
- Vernier::Collector::TimeCollector
- Defined in:
- ext/vernier/vernier.cc
Instance Attribute Summary
Attributes inherited from Vernier::Collector
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Vernier::Collector
#add_marker, #current_time, #initialize, #record_interval, #stop
Constructor Details
This class inherits a constructor from Vernier::Collector
Class Method Details
.new(mode, options) ⇒ Object
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 |
# File 'ext/vernier/vernier.cc', line 1185
static VALUE collector_new(VALUE self, VALUE mode, VALUE options) {
BaseCollector *collector;
VALUE stack_table = StackTable::stack_table_new();
if (mode == sym("wall")) {
VALUE intervalv = rb_hash_aref(options, sym("interval"));
TimeStamp interval;
if (NIL_P(intervalv)) {
interval = TimeStamp::from_microseconds(500);
} else {
interval = TimeStamp::from_microseconds(NUM2UINT(intervalv));
}
VALUE allocation_intervalv = rb_hash_aref(options, sym("allocation_interval"));
if (NIL_P(allocation_intervalv))
allocation_intervalv = rb_hash_aref(options, sym("allocation_sample_rate"));
unsigned int allocation_interval;
if (NIL_P(allocation_intervalv)) {
allocation_interval = 0;
} else {
allocation_interval = NUM2UINT(allocation_intervalv);
}
collector = new TimeCollector(stack_table, interval, allocation_interval);
} else {
rb_raise(rb_eArgError, "invalid mode");
}
VALUE obj = TypedData_Wrap_Struct(self, &rb_collector_type, collector);
rb_ivar_set(obj, rb_intern("@stack_table"), stack_table);
rb_funcall(obj, rb_intern("initialize"), 2, mode, options);
return obj;
}
|
Instance Method Details
#start ⇒ Object
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 |
# File 'ext/vernier/vernier.cc', line 1166
static VALUE
collector_start(VALUE self) {
auto *collector = get_collector(self);
if (!collector->start()) {
rb_raise(rb_eRuntimeError, "collector already running");
}
return Qtrue;
}
|