ruby-prof 0.10.7 → 0.10.8
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/CHANGES +4 -0
- data/README.rdoc +7 -1
- data/bin/ruby-prof +1 -1
- data/examples/empty.png +0 -0
- data/examples/minus.png +0 -0
- data/examples/plus.png +0 -0
- data/ext/ruby_prof/extconf.rb +4 -1
- data/ext/ruby_prof/ruby_prof.c +9 -4
- data/ext/ruby_prof/version.h +2 -2
- data/lib/ruby-prof.rb +1 -1
- data/lib/ruby-prof/empty.png +0 -0
- data/lib/ruby-prof/minus.png +0 -0
- data/lib/ruby-prof/plus.png +0 -0
- data/lib/ruby-prof/task.rb +0 -0
- data/test/aggregate_test.rb +0 -0
- data/test/basic_test.rb +0 -0
- data/test/duplicate_names_test.rb +0 -0
- data/test/enumerable_test.rb +0 -0
- data/test/exceptions_test.rb +0 -0
- data/test/exclude_threads_test.rb +0 -0
- data/test/exec_test.rb +0 -0
- data/test/line_number_test.rb +0 -0
- data/test/measurement_test.rb +0 -0
- data/test/module_test.rb +0 -0
- data/test/multi_printer_test.rb +0 -0
- data/test/no_method_class_test.rb +0 -0
- data/test/printers_test.rb +0 -0
- data/test/recursive_test.rb +0 -0
- data/test/singleton_test.rb +0 -0
- data/test/stack_printer_test.rb +0 -0
- data/test/stack_test.rb +0 -0
- data/test/start_stop_test.rb +0 -0
- data/test/thread_test.rb +0 -0
- data/test/unique_call_path_test.rb +0 -0
- metadata +44 -64
- data/test/go.rb +0 -33
data/CHANGES
CHANGED
data/README.rdoc
CHANGED
@@ -10,6 +10,7 @@ ruby-prof is a fast code profiler for Ruby. Its features include:
|
|
10
10
|
- Flat Profiles - similar to the reports generated by the standard Ruby profiler
|
11
11
|
- Graph profiles - similar to GProf, these show how long a method runs, which methods call it and which methods it calls.
|
12
12
|
- Call tree profiles - outputs results in the calltree format suitable for the KCacheGrind profiling tool.
|
13
|
+
- Many more -- see reports section of this README.
|
13
14
|
* Threads - supports profiling multiple threads simultaneously
|
14
15
|
|
15
16
|
== Requirements
|
@@ -248,6 +249,8 @@ are a good of quickly identifying which methods take the most time.
|
|
248
249
|
An example of a flat profile and an explanation can be found in
|
249
250
|
{examples/flat.txt}[http://github.com/rdp/ruby-prof/tree/master/examples/flat.txt].
|
250
251
|
|
252
|
+
There are several varieties of these -- run $ ruby-prof --help
|
253
|
+
|
251
254
|
Graph profiles also show the overall time spent in each method. In
|
252
255
|
addition, they also show which methods call the current method and which
|
253
256
|
methods its calls. Thus they are good for understanding how methods
|
@@ -271,10 +274,13 @@ Call stack reports produce a HTML visualization of the time spent in
|
|
271
274
|
each execution path of the profiled code. An example can be found at
|
272
275
|
{examples/stack.html}[http://github.com/rdp/ruby-prof/tree/master/examples/call_stack.html].
|
273
276
|
|
277
|
+
Another good example: [http://twitpic.com/28z94a]
|
278
|
+
|
274
279
|
Finally, there's a so called MultiPrinter which can generate several
|
275
280
|
reports in one profiling run. See
|
276
281
|
{examples/multi.stack.html}[http://github.com/rdp/ruby-prof/tree/master/examples/multi.stack.html].
|
277
282
|
|
283
|
+
There is also a graphviz .dot visualiser.
|
278
284
|
|
279
285
|
== Printers
|
280
286
|
|
@@ -452,4 +458,4 @@ See LICENSE for license information.
|
|
452
458
|
|
453
459
|
Code is located at http://github.com/rdp/ruby-prof
|
454
460
|
|
455
|
-
Google group/mailing list: http://groups.google.com/group/ruby-
|
461
|
+
Google group/mailing list: http://groups.google.com/group/ruby-optimization
|
data/bin/ruby-prof
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
# Various options:
|
12
12
|
# run "$ ruby-prof --help" to see them
|
13
13
|
#
|
14
|
-
# See also
|
14
|
+
# See also the readme "reports" section for the various outputs
|
15
15
|
|
16
16
|
require 'ostruct'
|
17
17
|
require 'optparse'
|
data/examples/empty.png
CHANGED
File without changes
|
data/examples/minus.png
CHANGED
File without changes
|
data/examples/plus.png
CHANGED
File without changes
|
data/ext/ruby_prof/extconf.rb
CHANGED
@@ -23,6 +23,9 @@ have_func("rb_gc_allocated_size")
|
|
23
23
|
have_func("rb_gc_collections")
|
24
24
|
have_func("rb_gc_time")
|
25
25
|
|
26
|
+
# 1.9.3 superclass
|
27
|
+
have_func("rb_class_superclass")
|
28
|
+
|
26
29
|
# Lloyd Hilaiel's heap info patch
|
27
30
|
have_func("rb_heap_total_mem")
|
28
31
|
have_func("rb_gc_heap_info")
|
@@ -54,4 +57,4 @@ if RUBY_VERSION > "1.9"
|
|
54
57
|
add_define("THREADS_INHERIT_EVENT_FLAGS", (threads.size == 2) ? "1" : "0")
|
55
58
|
end
|
56
59
|
|
57
|
-
create_makefile("
|
60
|
+
create_makefile("ruby_prof_ext")
|
data/ext/ruby_prof/ruby_prof.c
CHANGED
@@ -83,10 +83,15 @@ figure_singleton_name(VALUE klass)
|
|
83
83
|
/* Make sure to get the super class so that we don't
|
84
84
|
mistakenly grab a T_ICLASS which would lead to
|
85
85
|
unknown method errors. */
|
86
|
-
#ifdef
|
87
|
-
|
86
|
+
#ifdef HAVE_RB_CLASS_SUPERCLASS
|
87
|
+
// 1.9.3
|
88
|
+
VALUE super = rb_class_superclass(klass);
|
88
89
|
#else
|
90
|
+
# ifdef RCLASS_SUPER
|
91
|
+
VALUE super = rb_class_real(RCLASS_SUPER(klass));
|
92
|
+
# else
|
89
93
|
VALUE super = rb_class_real(RCLASS(klass)->super);
|
94
|
+
# endif
|
90
95
|
#endif
|
91
96
|
result = rb_str_new2("<Object::");
|
92
97
|
rb_str_append(result, rb_inspect(super));
|
@@ -1733,14 +1738,14 @@ Returns the total number of garbage collections.*/
|
|
1733
1738
|
Returns the time spent doing garbage collections in microseconds.*/
|
1734
1739
|
|
1735
1740
|
|
1736
|
-
#if RUBY_VERSION == 191 // accomodate for this: http://redmine.ruby-lang.org/issues/show/3748
|
1741
|
+
#if RUBY_VERSION == 191 // accomodate for this 1.9.1 windows bug: http://redmine.ruby-lang.org/issues/show/3748
|
1737
1742
|
# if defined(_WIN32)
|
1738
1743
|
__declspec(dllexport)
|
1739
1744
|
# endif
|
1740
1745
|
#endif
|
1741
1746
|
void
|
1742
1747
|
|
1743
|
-
|
1748
|
+
Init_ruby_prof_ext()
|
1744
1749
|
{
|
1745
1750
|
mProf = rb_define_module("RubyProf");
|
1746
1751
|
rb_define_const(mProf, "VERSION", rb_str_new2(RUBY_PROF_VERSION));
|
data/ext/ruby_prof/version.h
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#define RUBY_PROF_VERSION "0.10.
|
1
|
+
#define RUBY_PROF_VERSION "0.10.8" // for easy parsing from rake files
|
2
2
|
#define RUBY_PROF_VERSION_MAJ 0
|
3
3
|
#define RUBY_PROF_VERSION_MIN 10
|
4
|
-
#define RUBY_PROF_VERSION_MIC
|
4
|
+
#define RUBY_PROF_VERSION_MIC
|
data/lib/ruby-prof.rb
CHANGED
data/lib/ruby-prof/empty.png
CHANGED
File without changes
|
data/lib/ruby-prof/minus.png
CHANGED
File without changes
|
data/lib/ruby-prof/plus.png
CHANGED
File without changes
|
data/lib/ruby-prof/task.rb
CHANGED
File without changes
|
data/test/aggregate_test.rb
CHANGED
File without changes
|
data/test/basic_test.rb
CHANGED
File without changes
|
File without changes
|
data/test/enumerable_test.rb
CHANGED
File without changes
|
data/test/exceptions_test.rb
CHANGED
File without changes
|
File without changes
|
data/test/exec_test.rb
CHANGED
File without changes
|
data/test/line_number_test.rb
CHANGED
File without changes
|
data/test/measurement_test.rb
CHANGED
File without changes
|
data/test/module_test.rb
CHANGED
File without changes
|
data/test/multi_printer_test.rb
CHANGED
File without changes
|
File without changes
|
data/test/printers_test.rb
CHANGED
File without changes
|
data/test/recursive_test.rb
CHANGED
File without changes
|
data/test/singleton_test.rb
CHANGED
File without changes
|
data/test/stack_printer_test.rb
CHANGED
File without changes
|
data/test/stack_test.rb
CHANGED
File without changes
|
data/test/start_stop_test.rb
CHANGED
File without changes
|
data/test/thread_test.rb
CHANGED
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,67 +1,59 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-prof
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.8
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 10
|
9
|
-
- 7
|
10
|
-
version: 0.10.7
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-05-09 00:00:00 -06:00
|
12
|
+
date: 2011-07-06 00:00:00.000000000 -06:00
|
19
13
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: os
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &20888076 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
33
23
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rake-compiler
|
37
24
|
prerelease: false
|
38
|
-
|
25
|
+
version_requirements: *20888076
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake-compiler
|
28
|
+
requirement: &20887728 !ruby/object:Gem::Requirement
|
39
29
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
47
34
|
type: :development
|
48
|
-
|
49
|
-
|
50
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *20887728
|
37
|
+
description: ! 'ruby-prof is a fast code profiler for Ruby. It is a C extension and
|
38
|
+
|
51
39
|
therefore is many times faster than the standard Ruby profiler. It
|
40
|
+
|
52
41
|
supports both flat and graph profiles. For each method, graph profiles
|
42
|
+
|
53
43
|
show how long the method ran, which methods called it and which
|
44
|
+
|
54
45
|
methods it called. RubyProf generate both text and html and can output
|
46
|
+
|
55
47
|
it to standard out or to a file.
|
56
48
|
|
49
|
+
'
|
57
50
|
email: shugo@ruby-lang.org, cfis@savagexi.com, rogerdpack@gmail.com, skaes@railsexpress.de
|
58
|
-
executables:
|
51
|
+
executables:
|
59
52
|
- ruby-prof
|
60
|
-
extensions:
|
53
|
+
extensions:
|
61
54
|
- ext/ruby_prof/extconf.rb
|
62
55
|
extra_rdoc_files: []
|
63
|
-
|
64
|
-
files:
|
56
|
+
files:
|
65
57
|
- Rakefile
|
66
58
|
- README.rdoc
|
67
59
|
- LICENSE
|
@@ -126,7 +118,6 @@ files:
|
|
126
118
|
- test/exceptions_test.rb
|
127
119
|
- test/exclude_threads_test.rb
|
128
120
|
- test/exec_test.rb
|
129
|
-
- test/go.rb
|
130
121
|
- test/line_number_test.rb
|
131
122
|
- test/measurement_test.rb
|
132
123
|
- test/method_elimination_test.rb
|
@@ -149,38 +140,27 @@ files:
|
|
149
140
|
has_rdoc: true
|
150
141
|
homepage: http://rubyforge.org/projects/ruby-prof/
|
151
142
|
licenses: []
|
152
|
-
|
153
143
|
post_install_message:
|
154
144
|
rdoc_options: []
|
155
|
-
|
156
|
-
require_paths:
|
145
|
+
require_paths:
|
157
146
|
- lib
|
158
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
159
148
|
none: false
|
160
|
-
requirements:
|
161
|
-
- -
|
162
|
-
- !ruby/object:Gem::Version
|
163
|
-
hash: 63
|
164
|
-
segments:
|
165
|
-
- 1
|
166
|
-
- 8
|
167
|
-
- 4
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
168
152
|
version: 1.8.4
|
169
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
154
|
none: false
|
171
|
-
requirements:
|
172
|
-
- -
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
|
175
|
-
segments:
|
176
|
-
- 0
|
177
|
-
version: "0"
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
178
159
|
requirements: []
|
179
|
-
|
180
160
|
rubyforge_project: ruby-prof
|
181
|
-
rubygems_version: 1.
|
161
|
+
rubygems_version: 1.5.2
|
182
162
|
signing_key:
|
183
163
|
specification_version: 3
|
184
164
|
summary: Fast Ruby profiler
|
185
|
-
test_files:
|
165
|
+
test_files:
|
186
166
|
- test/test_suite.rb
|
data/test/go.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'test/unit'
|
3
|
-
require 'ruby-prof'
|
4
|
-
|
5
|
-
class MeasurementTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
if RubyProf::MEMORY
|
8
|
-
def test_memory_mode
|
9
|
-
RubyProf::measure_mode = RubyProf::MEMORY
|
10
|
-
assert_equal(RubyProf::MEMORY, RubyProf::measure_mode)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_memory
|
14
|
-
t = RubyProf.measure_memory
|
15
|
-
assert_kind_of Integer, t
|
16
|
-
|
17
|
-
u = RubyProf.measure_memory
|
18
|
-
assert(u >= t, [t, u].inspect)
|
19
|
-
|
20
|
-
RubyProf::measure_mode = RubyProf::MEMORY
|
21
|
-
result = RubyProf.profile {Array.new}
|
22
|
-
require 'rubygems'
|
23
|
-
require 'ruby-debug'
|
24
|
-
#debugger
|
25
|
-
total = result.threads.values.first.inject(0) { |sum, m| sum + m.total_time }
|
26
|
-
|
27
|
-
|
28
|
-
assert(total > 0, 'Should measure more than zero kilobytes of memory usage')
|
29
|
-
p total
|
30
|
-
assert_not_equal(0, total % 1, 'Should not truncate fractional kilobyte measurements')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|