Class: RubyProf::CallInfo

Inherits:
Object
  • Object
show all
Defined in:
ext/ruby_prof.c,
ext/ruby_prof.c

Overview

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.

Instance Method Summary collapse

Instance Method Details

#calledInteger

Returns the total amount of time this method was called.

Returns:

  • (Integer)


499
500
501
502
503
504
505
# File 'ext/ruby_prof.c', line 499

static VALUE
call_info_called(VALUE self)
{
    prof_call_info_t *result = get_call_info_result(self);

    return INT2NUM(result->called);
}

#children_timeFloat

Returns the total amount of time spent in this method’s children.

Returns:

  • (Float)


557
558
559
560
561
562
563
# File 'ext/ruby_prof.c', line 557

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));
}

#line_noInteger

returns the line number of the method

Returns:

  • (Integer)


511
512
513
514
515
# File 'ext/ruby_prof.c', line 511

static VALUE
call_info_line(VALUE self)
{
    return rb_int_new(get_call_info_result(self)->line);
}

#self_timeFloat

Returns the total amount of time spent in this method.

Returns:

  • (Float)


533
534
535
536
537
538
539
# File 'ext/ruby_prof.c', line 533

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));
}

#calledMethodInfo

Returns the target method.

Returns:



484
485
486
487
488
489
490
491
492
493
# File 'ext/ruby_prof.c', line 484

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);
}

#total_timeFloat

Returns the total amount of time spent in this method and its children.

Returns:

  • (Float)


521
522
523
524
525
526
527
# File 'ext/ruby_prof.c', line 521

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));
}

#wait_timeFloat

Returns the total amount of time this method waited for other threads.

Returns:

  • (Float)


545
546
547
548
549
550
551
# File 'ext/ruby_prof.c', line 545

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));
}