ruby-prof 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +10 -1
- data/ext/extconf.rb +6 -0
- data/ext/ruby_prof.c +37 -10
- data/ext/version.h +2 -2
- data/lib/ruby-prof/graph_html_printer.rb +2 -2
- data/lib/ruby-prof/graph_printer.rb +2 -2
- metadata +14 -10
data/README
CHANGED
@@ -37,6 +37,12 @@ includes a pre-built binary. Due to a bug in ruby-gems, you cannot
|
|
37
37
|
install the gem to a path that contains spaces
|
38
38
|
(see http://rubyforge.org/tracker/?func=detail&aid=23003&group_id=126&atid=577).
|
39
39
|
|
40
|
+
If you on windows mswin [not mingw] (check via ruby -v)
|
41
|
+
please install v0.7.3 which has a prebuilt binary
|
42
|
+
C:> gem install ruby-prof -v0.7.3
|
43
|
+
|
44
|
+
If you're on mingw, please install the devkit first.
|
45
|
+
|
40
46
|
ruby-prof is also available as a tarred gzip archive and zip archive.
|
41
47
|
|
42
48
|
== Usage
|
@@ -430,7 +436,10 @@ repository also includes a Microsoft VC++ 2005 solution. If you wish to run
|
|
430
436
|
a debug version of ruby-prof on Windows, then it is highly recommended
|
431
437
|
you use VC++.
|
432
438
|
|
433
|
-
|
434
439
|
== License
|
435
440
|
|
436
441
|
See LICENSE for license information.
|
442
|
+
|
443
|
+
== Development
|
444
|
+
|
445
|
+
Code is located at http://github.com/rdp/ruby-prof
|
data/ext/extconf.rb
CHANGED
@@ -31,4 +31,10 @@ have_func("rb_gc_heap_info")
|
|
31
31
|
have_func("rb_gc_malloc_allocations")
|
32
32
|
have_func("rb_gc_malloc_allocated_size")
|
33
33
|
|
34
|
+
def add_define(name)
|
35
|
+
$defs.push("-D#{name}")
|
36
|
+
end
|
37
|
+
|
38
|
+
add_define 'RUBY_VM' if RUBY_VERSION >= '1.9'
|
39
|
+
|
34
40
|
create_makefile("ruby_prof")
|
data/ext/ruby_prof.c
CHANGED
@@ -307,13 +307,28 @@ prof_call_info_create(prof_method_t* method, prof_call_info_t* parent)
|
|
307
307
|
return result;
|
308
308
|
}
|
309
309
|
|
310
|
+
static void prof_method_mark(prof_method_t *method);
|
311
|
+
|
310
312
|
static void
|
311
313
|
prof_call_info_mark(prof_call_info_t *call_info)
|
312
314
|
{
|
313
|
-
|
315
|
+
{
|
316
|
+
VALUE target = call_info->target->object;
|
317
|
+
if (NIL_P(target))
|
318
|
+
prof_method_mark(call_info->target);
|
319
|
+
else
|
320
|
+
rb_gc_mark(target);
|
321
|
+
}
|
314
322
|
rb_gc_mark(call_info->children);
|
315
|
-
if (call_info->parent)
|
316
|
-
|
323
|
+
if (call_info->parent) {
|
324
|
+
VALUE parent = call_info->parent->object;
|
325
|
+
if (NIL_P(parent)) {
|
326
|
+
prof_call_info_mark(call_info->parent);
|
327
|
+
}
|
328
|
+
else {
|
329
|
+
rb_gc_mark(parent);
|
330
|
+
}
|
331
|
+
}
|
317
332
|
}
|
318
333
|
|
319
334
|
static void
|
@@ -863,8 +878,15 @@ get_event_name(rb_event_flag_t event)
|
|
863
878
|
}
|
864
879
|
#endif
|
865
880
|
|
881
|
+
|
882
|
+
// these differ 1.9/1.8
|
883
|
+
|
866
884
|
static prof_method_t*
|
867
|
-
|
885
|
+
#ifdef RUBY_VM
|
886
|
+
get_method(rb_event_flag_t event, VALUE klass, ID mid, int depth, st_table* method_table)
|
887
|
+
# else
|
888
|
+
get_method(rb_event_flag_t event, NODE *node, VALUE klass, ID mid, int depth, st_table* method_table)
|
889
|
+
#endif
|
868
890
|
{
|
869
891
|
prof_method_key_t key;
|
870
892
|
prof_method_t *method = NULL;
|
@@ -1111,19 +1133,24 @@ prof_event_hook(rb_event_flag_t event, NODE *node, VALUE self, ID mid, VALUE kla
|
|
1111
1133
|
klass = (BUILTIN_TYPE(klass) == T_ICLASS ? RBASIC(klass)->klass : klass);
|
1112
1134
|
|
1113
1135
|
/* Assume this is the first time we have called this method. */
|
1136
|
+
#ifdef RUBY_VM
|
1137
|
+
method = get_method(event, klass, mid, 0, thread_data->method_table);
|
1138
|
+
#else
|
1114
1139
|
method = get_method(event, node, klass, mid, 0, thread_data->method_table);
|
1140
|
+
#endif
|
1115
1141
|
|
1116
1142
|
/* Check for a recursive call */
|
1117
|
-
|
1143
|
+
while (method->active)
|
1118
1144
|
{
|
1119
1145
|
/* Yes, this method is already active */
|
1146
|
+
#ifdef RUBY_VM
|
1147
|
+
method = get_method(event, klass, mid, method->key->depth + 1, thread_data->method_table);
|
1148
|
+
#else
|
1120
1149
|
method = get_method(event, node, klass, mid, method->key->depth + 1, thread_data->method_table);
|
1150
|
+
#endif
|
1121
1151
|
}
|
1122
|
-
|
1123
|
-
|
1124
|
-
/* No, so make it active */
|
1125
|
-
method->active = 1;
|
1126
|
-
}
|
1152
|
+
method->active = 1;
|
1153
|
+
|
1127
1154
|
|
1128
1155
|
if (!frame)
|
1129
1156
|
{
|
data/ext/version.h
CHANGED
@@ -198,7 +198,7 @@ module RubyProf
|
|
198
198
|
self_percentage = (method.self_time/total_time) * 100 %>
|
199
199
|
|
200
200
|
<!-- Parents -->
|
201
|
-
<% for caller in method.aggregate_parents
|
201
|
+
<% for caller in method.aggregate_parents.sort_by(&:total_time)
|
202
202
|
next unless caller.parent
|
203
203
|
next if min_time && caller.total_time < min_time %>
|
204
204
|
<tr>
|
@@ -228,7 +228,7 @@ module RubyProf
|
|
228
228
|
</tr>
|
229
229
|
|
230
230
|
<!-- Children -->
|
231
|
-
<% for callee in method.aggregate_children %>
|
231
|
+
<% for callee in method.aggregate_children.sort_by(&:total_time).reverse %>
|
232
232
|
<% next if min_time && callee.total_time < min_time %>
|
233
233
|
<tr>
|
234
234
|
<td> </td>
|
@@ -127,7 +127,7 @@ module RubyProf
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def print_parents(thread_id, method)
|
130
|
-
method.aggregate_parents.each do |caller|
|
130
|
+
method.aggregate_parents.sort_by(&:total_time).each do |caller|
|
131
131
|
next unless caller.parent
|
132
132
|
@output << " " * 2 * PERCENTAGE_WIDTH
|
133
133
|
@output << sprintf("%#{TIME_WIDTH}.2f", caller.total_time)
|
@@ -143,7 +143,7 @@ module RubyProf
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def print_children(method)
|
146
|
-
method.aggregate_children.each do |child|
|
146
|
+
method.aggregate_children.sort_by(&:total_time).reverse.each do |child|
|
147
147
|
# Get children method
|
148
148
|
|
149
149
|
@output << " " * 2 * PERCENTAGE_WIDTH
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shugo Maeda and Charlie Savage
|
@@ -9,11 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-12-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: |
|
17
|
+
ruby-prof is a fast code profiler for Ruby. It is a C extension and
|
18
|
+
therefore is many times faster than the standard Ruby profiler. It
|
19
|
+
supports both flat and graph profiles. For each method, graph profiles
|
20
|
+
show how long the method ran, which methods called it and which
|
21
|
+
methods it called. RubyProf generate both text and html and can output
|
22
|
+
it to standard out or to a file.
|
23
|
+
|
17
24
|
email: shugo@ruby-lang.org and cfis@savagexi.com
|
18
25
|
executables:
|
19
26
|
- ruby-prof
|
@@ -38,16 +45,13 @@ files:
|
|
38
45
|
- ext/measure_memory.h
|
39
46
|
- ext/measure_process_time.h
|
40
47
|
- ext/measure_wall_time.h
|
41
|
-
- ext/mingw
|
42
48
|
- ext/ruby_prof.c
|
43
49
|
- ext/ruby_prof.h
|
44
|
-
- ext/vc
|
45
50
|
- ext/version.h
|
46
51
|
- ext/mingw/Rakefile
|
47
52
|
- ext/mingw/build.rake
|
48
53
|
- ext/vc/ruby_prof.sln
|
49
54
|
- ext/vc/ruby_prof.vcproj
|
50
|
-
- lib/ruby-prof
|
51
55
|
- lib/ruby-prof/abstract_printer.rb
|
52
56
|
- lib/ruby-prof/aggregate_call_info.rb
|
53
57
|
- lib/ruby-prof/call_info.rb
|
@@ -60,9 +64,7 @@ files:
|
|
60
64
|
- lib/ruby-prof/test.rb
|
61
65
|
- lib/ruby-prof.rb
|
62
66
|
- lib/unprof.rb
|
63
|
-
- rails/environment
|
64
67
|
- rails/environment/profile.rb
|
65
|
-
- rails/example
|
66
68
|
- rails/example/example_test.rb
|
67
69
|
- rails/profile_test_helper.rb
|
68
70
|
- test/aggregate_test.rb
|
@@ -86,6 +88,8 @@ files:
|
|
86
88
|
- test/unique_call_path_test.rb
|
87
89
|
has_rdoc: true
|
88
90
|
homepage: http://rubyforge.org/projects/ruby-prof/
|
91
|
+
licenses: []
|
92
|
+
|
89
93
|
post_install_message:
|
90
94
|
rdoc_options: []
|
91
95
|
|
@@ -106,9 +110,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
110
|
requirements: []
|
107
111
|
|
108
112
|
rubyforge_project: ruby-prof
|
109
|
-
rubygems_version: 1.3.
|
113
|
+
rubygems_version: 1.3.5
|
110
114
|
signing_key:
|
111
|
-
specification_version:
|
115
|
+
specification_version: 3
|
112
116
|
summary: Fast Ruby profiler
|
113
117
|
test_files:
|
114
118
|
- test/test_suite.rb
|