| Class | RubyProf::CallInfo |
| In: |
ext/ruby_prof.c
|
| Parent: | Object |
RubyProf::CallInfo is a helper class used by RubyProf::MethodInfo to keep track of which child methods were called and how long they took to execute.
Returns the total amount of time this method was called.
/* call-seq:
called -> int
Returns the total amount of time this method was called. */
static VALUE
call_info_called(VALUE self)
{
prof_call_info_t *result = get_call_info_result(self);
return INT2NUM(result->called);
}
Returns the total amount of time spent in this method’s children.
/* call-seq:
children_time -> float
Returns the total amount of time spent in this method's children. */
static VALUE
call_info_children_time(VALUE self)
{
prof_call_info_t *result = get_call_info_result(self);
prof_measure_t children_time = result->total_time - result->self_time - result->wait_time;
return rb_float_new(convert_measurement(children_time));
}
returns the line number of the method
/* call-seq:
line_no -> int
returns the line number of the method */
static VALUE
call_info_line(VALUE self)
{
return rb_int_new(get_call_info_result(self)->line);
}
Returns the total amount of time spent in this method.
/* call-seq:
self_time -> float
Returns the total amount of time spent in this method. */
static VALUE
call_info_self_time(VALUE self)
{
prof_call_info_t *result = get_call_info_result(self);
return rb_float_new(convert_measurement(result->self_time));
}
Returns the target method.
/* call-seq:
called -> MethodInfo
Returns the target method. */
static VALUE
call_info_target(VALUE self)
{
/* Target is a pointer to a method_info - so we have to be careful
about the GC. We will wrap the method_info but provide no
free method so the underlying object is not freed twice! */
prof_call_info_t *result = get_call_info_result(self);
return Data_Wrap_Struct(cMethodInfo, NULL, NULL, result->target);
}
Returns the total amount of time spent in this method and its children.
/* call-seq:
total_time -> float
Returns the total amount of time spent in this method and its children. */
static VALUE
call_info_total_time(VALUE self)
{
prof_call_info_t *result = get_call_info_result(self);
return rb_float_new(convert_measurement(result->total_time));
}
Returns the total amount of time this method waited for other threads.
/* call-seq:
wait_time -> float
Returns the total amount of time this method waited for other threads. */
static VALUE
call_info_wait_time(VALUE self)
{
prof_call_info_t *result = get_call_info_result(self);
return rb_float_new(convert_measurement(result->wait_time));
}