Class: RubyProf::Measurement
- Inherits:
-
Data
- Object
- Data
- RubyProf::Measurement
- Defined in:
- lib/ruby-prof/measurement.rb,
ext/ruby_prof/rp_measurement.c
Overview
The Measurement class is a helper class used by RubyProf::MethodInfo to store information about the method. You cannot create a CallInfo object directly, they are generated while running a profile.
Instance Method Summary collapse
-
#_dump_data ⇒ Object
:nodoc:.
-
#_load_data(data) ⇒ Object
:nodoc:.
-
#called ⇒ Integer
Returns the total amount of times this method was called.
-
#called= ⇒ Object
Sets the call count to n.
- #inspect ⇒ Object
-
#self_time ⇒ Float
Returns the total amount of time spent in this method.
-
#to_s ⇒ Object
:nodoc:.
-
#total_time ⇒ Float
Returns the total amount of time spent in this method and its children.
-
#wait_time ⇒ Float
Returns the total amount of time this method waited for other threads.
Instance Method Details
#_dump_data ⇒ Object
:nodoc:
187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'ext/ruby_prof/rp_measurement.c', line 187
static VALUE
prof_measurement_dump(VALUE self)
{
prof_measurement_t* measurement_data = prof_get_measurement(self);
VALUE result = rb_hash_new();
rb_hash_aset(result, ID2SYM(rb_intern("total_time")), rb_float_new(measurement_data->total_time));
rb_hash_aset(result, ID2SYM(rb_intern("self_time")), rb_float_new(measurement_data->self_time));
rb_hash_aset(result, ID2SYM(rb_intern("wait_time")), rb_float_new(measurement_data->wait_time));
rb_hash_aset(result, ID2SYM(rb_intern("called")), INT2FIX(measurement_data->called));
return result;
}
|
#_load_data(data) ⇒ Object
:nodoc:
202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'ext/ruby_prof/rp_measurement.c', line 202
static VALUE
prof_measurement_load(VALUE self, VALUE data)
{
prof_measurement_t* measurement = prof_get_measurement(self);
measurement->object = self;
measurement->total_time = rb_num2dbl(rb_hash_aref(data, ID2SYM(rb_intern("total_time"))));
measurement->self_time = rb_num2dbl(rb_hash_aref(data, ID2SYM(rb_intern("self_time"))));
measurement->wait_time = rb_num2dbl(rb_hash_aref(data, ID2SYM(rb_intern("wait_time"))));
measurement->called = FIX2INT(rb_hash_aref(data, ID2SYM(rb_intern("called"))));
return data;
}
|
#called ⇒ Integer
Returns the total amount of times this method was called.
167 168 169 170 171 172 |
# File 'ext/ruby_prof/rp_measurement.c', line 167
static VALUE
prof_measurement_called(VALUE self)
{
prof_measurement_t *result = prof_get_measurement(self);
return INT2NUM(result->called);
}
|
#called= ⇒ Object
Sets the call count to n.
178 179 180 181 182 183 184 |
# File 'ext/ruby_prof/rp_measurement.c', line 178
static VALUE
prof_measurement_set_called(VALUE self, VALUE called)
{
prof_measurement_t *result = prof_get_measurement(self);
result->called = NUM2INT(called);
return called;
}
|
#inspect ⇒ Object
10 11 12 |
# File 'lib/ruby-prof/measurement.rb', line 10 def inspect super + "(#{self.to_s})" end |
#self_time ⇒ Float
Returns the total amount of time spent in this method.
143 144 145 146 147 148 149 |
# File 'ext/ruby_prof/rp_measurement.c', line 143
static VALUE
prof_measurement_self_time(VALUE self)
{
prof_measurement_t* result = prof_get_measurement(self);
return rb_float_new(result->self_time);
}
|
#to_s ⇒ Object
:nodoc:
6 7 8 |
# File 'lib/ruby-prof/measurement.rb', line 6 def to_s "c: #{called}, tt: #{total_time}, st: #{self_time}" end |
#total_time ⇒ Float
Returns the total amount of time spent in this method and its children.
132 133 134 135 136 137 |
# File 'ext/ruby_prof/rp_measurement.c', line 132
static VALUE
prof_measurement_total_time(VALUE self)
{
prof_measurement_t* result = prof_get_measurement(self);
return rb_float_new(result->total_time);
}
|
#wait_time ⇒ Float
Returns the total amount of time this method waited for other threads.
155 156 157 158 159 160 161 |
# File 'ext/ruby_prof/rp_measurement.c', line 155
static VALUE
prof_measurement_wait_time(VALUE self)
{
prof_measurement_t* result = prof_get_measurement(self);
return rb_float_new(result->wait_time);
}
|