Class: RubyProf::Allocation
- Inherits:
-
Data
- Object
- Data
- RubyProf::Allocation
- Defined in:
- ext/ruby_prof/rp_allocation.c
Instance Method Summary collapse
-
#_dump_data ⇒ Object
:nodoc:.
-
#_load_data(data) ⇒ Object
:nodoc:.
-
#count ⇒ Numeric
Returns the number of times this class has been allocated.
-
#klass_flags ⇒ Integer
Returns the klass flags.
-
#klass ⇒ Class
Returns the type of Class being allocated.
-
#line ⇒ Numeric
Returns the the line number where objects were allocated.
-
#memory ⇒ Numeric
Returns the amount of memory allocated.
-
#source_file ⇒ String
Returns the the line number where objects were allocated.
Instance Method Details
#_dump_data ⇒ Object
:nodoc:
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'ext/ruby_prof/rp_allocation.c', line 242
static VALUE
prof_allocation_dump(VALUE self)
{
prof_allocation_t* allocation = DATA_PTR(self);
VALUE result = rb_hash_new();
rb_hash_aset(result, ID2SYM(rb_intern("key")), INT2FIX(allocation->key));
rb_hash_aset(result, ID2SYM(rb_intern("klass_name")), prof_allocation_klass_name(self));
rb_hash_aset(result, ID2SYM(rb_intern("klass_flags")), INT2FIX(allocation->klass_flags));
rb_hash_aset(result, ID2SYM(rb_intern("source_file")), allocation->source_file);
rb_hash_aset(result, ID2SYM(rb_intern("source_line")), INT2FIX(allocation->source_line));
rb_hash_aset(result, ID2SYM(rb_intern("count")), INT2FIX(allocation->count));
rb_hash_aset(result, ID2SYM(rb_intern("memory")), LONG2FIX(allocation->memory));
return result;
}
|
#_load_data(data) ⇒ Object
:nodoc:
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'ext/ruby_prof/rp_allocation.c', line 261
static VALUE
prof_allocation_load(VALUE self, VALUE data)
{
prof_allocation_t* allocation = DATA_PTR(self);
allocation->object = self;
allocation->key = FIX2LONG(rb_hash_aref(data, ID2SYM(rb_intern("key"))));
allocation->klass_name = rb_hash_aref(data, ID2SYM(rb_intern("klass_name")));
allocation->klass_flags = FIX2INT(rb_hash_aref(data, ID2SYM(rb_intern("klass_flags"))));
allocation->source_file = rb_hash_aref(data, ID2SYM(rb_intern("source_file")));
allocation->source_line = FIX2INT(rb_hash_aref(data, ID2SYM(rb_intern("source_line"))));
allocation->count = FIX2INT(rb_hash_aref(data, ID2SYM(rb_intern("count"))));
allocation->memory = FIX2LONG(rb_hash_aref(data, ID2SYM(rb_intern("memory"))));
return data;
}
|
#count ⇒ Numeric
Returns the number of times this class has been allocated.
223 224 225 226 227 228 |
# File 'ext/ruby_prof/rp_allocation.c', line 223
static VALUE
prof_allocation_count(VALUE self)
{
prof_allocation_t* allocation = prof_allocation_get(self);
return INT2FIX(allocation->count);
}
|
#klass_flags ⇒ Integer
Returns the klass flags
190 191 192 193 194 195 |
# File 'ext/ruby_prof/rp_allocation.c', line 190
static VALUE
prof_allocation_klass_flags(VALUE self)
{
prof_allocation_t* allocation = prof_allocation_get(self);
return INT2FIX(allocation->klass_flags);
}
|
#klass ⇒ Class
Returns the type of Class being allocated.
174 175 176 177 178 179 180 181 182 183 |
# File 'ext/ruby_prof/rp_allocation.c', line 174
static VALUE
prof_allocation_klass_name(VALUE self)
{
prof_allocation_t* allocation = prof_allocation_get(self);
if (allocation->klass_name == Qnil)
allocation->klass_name = resolve_klass_name(allocation->klass, &allocation->klass_flags);
return allocation->klass_name;
}
|
#line ⇒ Numeric
Returns the the line number where objects were allocated.
212 213 214 215 216 217 |
# File 'ext/ruby_prof/rp_allocation.c', line 212
static VALUE
prof_allocation_source_line(VALUE self)
{
prof_allocation_t* allocation = prof_allocation_get(self);
return INT2FIX(allocation->source_line);
}
|
#memory ⇒ Numeric
Returns the amount of memory allocated.
234 235 236 237 238 239 |
# File 'ext/ruby_prof/rp_allocation.c', line 234
static VALUE
prof_allocation_memory(VALUE self)
{
prof_allocation_t* allocation = prof_allocation_get(self);
return ULL2NUM(allocation->memory);
}
|
#source_file ⇒ String
Returns the the line number where objects were allocated.
201 202 203 204 205 206 |
# File 'ext/ruby_prof/rp_allocation.c', line 201
static VALUE
prof_allocation_source_file(VALUE self)
{
prof_allocation_t* allocation = prof_allocation_get(self);
return allocation->source_file;
}
|