ruby-prof 1.6.3 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +11 -0
- data/ext/ruby_prof/rp_allocation.c +342 -342
- data/ext/ruby_prof/rp_call_tree.c +1 -1
- data/ext/ruby_prof/rp_call_tree.h +1 -1
- data/ext/ruby_prof/rp_call_trees.c +2 -2
- data/ext/ruby_prof/rp_call_trees.h +2 -2
- data/ext/ruby_prof/rp_measure_allocations.c +1 -1
- data/ext/ruby_prof/rp_measure_memory.c +46 -46
- data/ext/ruby_prof/rp_measure_process_time.c +1 -1
- data/ext/ruby_prof/rp_measure_wall_time.c +1 -1
- data/ext/ruby_prof/rp_measurement.c +364 -364
- data/ext/ruby_prof/rp_method.c +26 -25
- data/ext/ruby_prof/rp_method.h +5 -2
- data/ext/ruby_prof/rp_profile.c +2 -2
- data/ext/ruby_prof/rp_profile.h +36 -36
- data/ext/ruby_prof/rp_stack.c +1 -1
- data/ext/ruby_prof/rp_thread.c +1 -1
- data/ext/ruby_prof/ruby_prof.c +1 -1
- data/ext/ruby_prof/ruby_prof.h +34 -34
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +5 -7
- data/lib/ruby-prof/compatibility.rb +10 -10
- data/lib/ruby-prof/exclude_common_methods.rb +9 -3
- data/lib/ruby-prof/method_info.rb +87 -85
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +2 -1
- data/test/crash2.rb +144 -0
- data/test/enumerable_test.rb +5 -5
- data/test/exclude_methods_test.rb +197 -86
- data/test/line_number_test.rb +254 -99
- data/test/measure_allocations_test.rb +422 -1
- data/test/measure_memory_test.rb +433 -1
- data/test/measure_process_time_test.rb +882 -15
- data/test/measure_wall_time_test.rb +195 -47
- data/test/method_info_test.rb +1 -1
- data/test/recursive_test.rb +198 -1
- data/test/thread_test.rb +0 -4
- metadata +20 -5
@@ -42,6 +42,6 @@ prof_call_tree_t* prof_get_call_tree(VALUE self);
|
|
42
42
|
VALUE prof_call_tree_wrap(prof_call_tree_t* call_tree);
|
43
43
|
void prof_call_tree_free(prof_call_tree_t* call_tree);
|
44
44
|
|
45
|
-
void rp_init_call_tree();
|
45
|
+
void rp_init_call_tree(void);
|
46
46
|
|
47
47
|
#endif //__RP_CALL_TREE_H__
|
@@ -21,7 +21,7 @@ prof_call_trees_t* prof_get_call_trees(VALUE self)
|
|
21
21
|
return result;
|
22
22
|
}
|
23
23
|
|
24
|
-
prof_call_trees_t* prof_call_trees_create()
|
24
|
+
prof_call_trees_t* prof_call_trees_create(void)
|
25
25
|
{
|
26
26
|
prof_call_trees_t* result = ALLOC(prof_call_trees_t);
|
27
27
|
result->start = ALLOC_N(prof_call_tree_t*, INITIAL_CALL_TREES_SIZE);
|
@@ -279,7 +279,7 @@ VALUE prof_call_trees_load(VALUE self, VALUE data)
|
|
279
279
|
return data;
|
280
280
|
}
|
281
281
|
|
282
|
-
void rp_init_call_trees()
|
282
|
+
void rp_init_call_trees(void)
|
283
283
|
{
|
284
284
|
cRpCallTrees = rb_define_class_under(mProf, "CallTrees", rb_cObject);
|
285
285
|
rb_undef_method(CLASS_OF(cRpCallTrees), "new");
|
@@ -18,8 +18,8 @@ typedef struct prof_call_trees_t
|
|
18
18
|
} prof_call_trees_t;
|
19
19
|
|
20
20
|
|
21
|
-
void rp_init_call_trees();
|
22
|
-
prof_call_trees_t* prof_call_trees_create();
|
21
|
+
void rp_init_call_trees(void);
|
22
|
+
prof_call_trees_t* prof_call_trees_create(void);
|
23
23
|
void prof_call_trees_free(prof_call_trees_t* call_trees);
|
24
24
|
prof_call_trees_t* prof_get_call_trees(VALUE self);
|
25
25
|
void prof_add_call_tree(prof_call_trees_t* call_trees, prof_call_tree_t* call_tree);
|
@@ -38,7 +38,7 @@ prof_measurer_t* prof_measurer_allocations(bool track_allocations)
|
|
38
38
|
return measure;
|
39
39
|
}
|
40
40
|
|
41
|
-
void rp_init_measure_allocations()
|
41
|
+
void rp_init_measure_allocations(void)
|
42
42
|
{
|
43
43
|
total_allocated_objects_key = ID2SYM(rb_intern("total_allocated_objects"));
|
44
44
|
rb_define_const(mProf, "ALLOCATIONS", INT2NUM(MEASURE_ALLOCATIONS));
|
@@ -1,46 +1,46 @@
|
|
1
|
-
/* Copyright (C) 2005-2013 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com>
|
2
|
-
Please see the LICENSE file for copyright and distribution information */
|
3
|
-
|
4
|
-
/* :nodoc: */
|
5
|
-
|
6
|
-
#include "rp_measurement.h"
|
7
|
-
|
8
|
-
static VALUE cMeasureMemory;
|
9
|
-
|
10
|
-
static double measure_memory(rb_trace_arg_t* trace_arg)
|
11
|
-
{
|
12
|
-
static double result = 0;
|
13
|
-
|
14
|
-
if (trace_arg)
|
15
|
-
{
|
16
|
-
// Only process creation of new objects
|
17
|
-
rb_event_flag_t event = rb_tracearg_event_flag(trace_arg);
|
18
|
-
if (event == RUBY_INTERNAL_EVENT_NEWOBJ)
|
19
|
-
{
|
20
|
-
// Don't count allocations of internal IMemo objects
|
21
|
-
VALUE object = rb_tracearg_object(trace_arg);
|
22
|
-
if (BUILTIN_TYPE(object) != T_IMEMO)
|
23
|
-
result += rb_obj_memsize_of(object);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
return result;
|
28
|
-
}
|
29
|
-
|
30
|
-
prof_measurer_t* prof_measurer_memory(bool track_allocations)
|
31
|
-
{
|
32
|
-
prof_measurer_t* measure = ALLOC(prof_measurer_t);
|
33
|
-
measure->mode = MEASURE_MEMORY;
|
34
|
-
measure->measure = measure_memory;
|
35
|
-
measure->multiplier = 1;
|
36
|
-
// Need to track allocations to get RUBY_INTERNAL_EVENT_NEWOBJ event
|
37
|
-
measure->track_allocations = true;
|
38
|
-
return measure;
|
39
|
-
}
|
40
|
-
|
41
|
-
void rp_init_measure_memory()
|
42
|
-
{
|
43
|
-
rb_define_const(mProf, "MEMORY", INT2NUM(MEASURE_MEMORY));
|
44
|
-
|
45
|
-
cMeasureMemory = rb_define_class_under(mMeasure, "Allocations", rb_cObject);
|
46
|
-
}
|
1
|
+
/* Copyright (C) 2005-2013 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com>
|
2
|
+
Please see the LICENSE file for copyright and distribution information */
|
3
|
+
|
4
|
+
/* :nodoc: */
|
5
|
+
|
6
|
+
#include "rp_measurement.h"
|
7
|
+
|
8
|
+
static VALUE cMeasureMemory;
|
9
|
+
|
10
|
+
static double measure_memory(rb_trace_arg_t* trace_arg)
|
11
|
+
{
|
12
|
+
static double result = 0;
|
13
|
+
|
14
|
+
if (trace_arg)
|
15
|
+
{
|
16
|
+
// Only process creation of new objects
|
17
|
+
rb_event_flag_t event = rb_tracearg_event_flag(trace_arg);
|
18
|
+
if (event == RUBY_INTERNAL_EVENT_NEWOBJ)
|
19
|
+
{
|
20
|
+
// Don't count allocations of internal IMemo objects
|
21
|
+
VALUE object = rb_tracearg_object(trace_arg);
|
22
|
+
if (BUILTIN_TYPE(object) != T_IMEMO)
|
23
|
+
result += rb_obj_memsize_of(object);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
return result;
|
28
|
+
}
|
29
|
+
|
30
|
+
prof_measurer_t* prof_measurer_memory(bool track_allocations)
|
31
|
+
{
|
32
|
+
prof_measurer_t* measure = ALLOC(prof_measurer_t);
|
33
|
+
measure->mode = MEASURE_MEMORY;
|
34
|
+
measure->measure = measure_memory;
|
35
|
+
measure->multiplier = 1;
|
36
|
+
// Need to track allocations to get RUBY_INTERNAL_EVENT_NEWOBJ event
|
37
|
+
measure->track_allocations = true;
|
38
|
+
return measure;
|
39
|
+
}
|
40
|
+
|
41
|
+
void rp_init_measure_memory(void)
|
42
|
+
{
|
43
|
+
rb_define_const(mProf, "MEMORY", INT2NUM(MEASURE_MEMORY));
|
44
|
+
|
45
|
+
cMeasureMemory = rb_define_class_under(mMeasure, "Allocations", rb_cObject);
|
46
|
+
}
|
@@ -57,7 +57,7 @@ prof_measurer_t* prof_measurer_process_time(bool track_allocations)
|
|
57
57
|
return measure;
|
58
58
|
}
|
59
59
|
|
60
|
-
void rp_init_measure_process_time()
|
60
|
+
void rp_init_measure_process_time(void)
|
61
61
|
{
|
62
62
|
rb_define_const(mProf, "CLOCKS_PER_SEC", INT2NUM(CLOCKS_PER_SEC));
|
63
63
|
rb_define_const(mProf, "PROCESS_TIME", INT2NUM(MEASURE_PROCESS_TIME));
|