rubyperf 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/{LICENSE.txt → MIT-LICENSE.txt} +4 -7
- data/README.rdoc +8 -7
- data/VERSION +1 -1
- data/lib/perf/meter.rb +0 -5
- data/lib/perf/meter_factory.rb +0 -5
- data/lib/perf/no_op_meter.rb +0 -5
- data/lib/perf/report_format.rb +0 -5
- data/lib/perf/report_format_html.rb +0 -5
- data/lib/perf/report_format_list_of_measures.rb +0 -6
- data/lib/perf/report_format_simple.rb +0 -5
- data/lib/rubyperf.rb +1 -145
- data/rubyperf.gemspec +3 -4
- data/test/helper.rb +0 -5
- data/test/perf_test_example.rb +0 -5
- data/test/rubyperf_test_helpers.rb +0 -5
- data/test/test_meter_factory.rb +0 -5
- data/test/test_no_op_meter.rb +0 -5
- data/test/test_perf_meter.rb +0 -5
- metadata +4 -5
@@ -1,13 +1,10 @@
|
|
1
|
-
Copyright (c) 2012 Lorenzo Pasqualis - DreamBox Learning, Inc
|
2
1
|
|
3
|
-
|
4
|
-
|
2
|
+
Copyright (c) 2012 DreamBox Learning, Inc
|
3
|
+
http://www.dreambox.com
|
5
4
|
|
6
|
-
Author
|
7
|
-
lpasqualis@gmail.com
|
5
|
+
Author: Lorenzo Pasqualis
|
8
6
|
|
9
|
-
|
10
|
-
http://www.lorenzopasqualis.com
|
7
|
+
https://github.com/lpasqualis/rubyperf
|
11
8
|
|
12
9
|
LICENSE:
|
13
10
|
|
data/README.rdoc
CHANGED
@@ -4,7 +4,7 @@ A gem to measure execution time of blocks of code, methods and expressions.
|
|
4
4
|
It generates detailed reports in various formats showing the nested structure
|
5
5
|
of the measures.
|
6
6
|
|
7
|
-
|
7
|
+
Designed as a tool to drill in the performance of hot code and
|
8
8
|
identify bottlenecks.
|
9
9
|
|
10
10
|
Currently available output formats for the report: text, html.
|
@@ -19,17 +19,18 @@ Currently available output formats for the report: text, html.
|
|
19
19
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
20
20
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
21
21
|
|
22
|
-
==
|
22
|
+
== License
|
23
23
|
|
24
|
-
|
24
|
+
See MIT-LICENSE.txt
|
25
|
+
|
26
|
+
== Links
|
27
|
+
|
28
|
+
DreamBox Learning:
|
29
|
+
http://wwww.dreambox.com
|
25
30
|
|
26
31
|
Project home-page git repository:
|
27
32
|
https://github.com/lpasqualis/rubyperf
|
28
33
|
|
29
|
-
Author can be contacted at:
|
30
|
-
lpasqualis@gmail.com
|
31
|
-
|
32
34
|
Author's Blog:
|
33
35
|
http://www.lorenzopasqualis.com
|
34
|
-
See LICENSE.txt for further details.
|
35
36
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.7
|
data/lib/perf/meter.rb
CHANGED
data/lib/perf/meter_factory.rb
CHANGED
data/lib/perf/no_op_meter.rb
CHANGED
data/lib/perf/report_format.rb
CHANGED
data/lib/rubyperf.rb
CHANGED
@@ -1,149 +1,5 @@
|
|
1
1
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#Project home-page git repository:
|
5
|
-
# https://github.com/lpasqualis/rubyperf
|
6
|
-
#
|
7
|
-
#Author can be contacted at:
|
8
|
-
# lpasqualis@gmail.com
|
9
|
-
#
|
10
|
-
#Author's Blog:
|
11
|
-
# http://www.lorenzopasqualis.com
|
12
|
-
#
|
13
|
-
#License:
|
14
|
-
#
|
15
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
16
|
-
# a copy of this software and associated documentation files (the
|
17
|
-
# "Software"), to deal in the Software without restriction, including
|
18
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
19
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
20
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
21
|
-
# the following conditions:
|
22
|
-
#
|
23
|
-
# The above copyright notice and this permission notice shall be
|
24
|
-
# included in all copies or substantial portions of the Software.
|
25
|
-
#
|
26
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
27
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
28
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
29
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
30
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
31
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
32
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
33
|
-
#
|
34
|
-
#############################################################################
|
35
|
-
#
|
36
|
-
#This gem measures the execution time of blocks of code, methods and expressions.
|
37
|
-
#It generates detailed reports in various formats showing the nested structure
|
38
|
-
#of the measures.
|
39
|
-
#
|
40
|
-
#Designed to give tools to drill in the performance of hot code and identify
|
41
|
-
#bottlenecks.
|
42
|
-
#
|
43
|
-
#Currently available output formats for the report: text, html.
|
44
|
-
#
|
45
|
-
#Example of use:
|
46
|
-
#
|
47
|
-
# require 'rubyperf'
|
48
|
-
#
|
49
|
-
# def example
|
50
|
-
# m=Perf::Meter.new
|
51
|
-
# m.measure(:string_operations) do
|
52
|
-
# m.measure(:ciao) do
|
53
|
-
# 1000.times do; "CIAO"*100; end
|
54
|
-
# end
|
55
|
-
# end
|
56
|
-
# m.measure(:string_operations) do
|
57
|
-
# m.measure(:help) do
|
58
|
-
# 1000.times do; "HELP"*100; end
|
59
|
-
# end
|
60
|
-
# end
|
61
|
-
# m.measure(:emtpy_loop) do
|
62
|
-
# 50000.times do; end;
|
63
|
-
# end
|
64
|
-
# m.measure(:rough_overhead_x10000) do
|
65
|
-
# 1000.times do
|
66
|
-
# m.measure(:block_1) do
|
67
|
-
# m.measure(:block_1_1) do
|
68
|
-
# end
|
69
|
-
# m.measure(:block_1_2) do
|
70
|
-
# m.measure(:block_1_2_1) do
|
71
|
-
# end
|
72
|
-
# m.measure(:block_1_2_2) do
|
73
|
-
# end
|
74
|
-
# m.measure(:block_1_2_3) do
|
75
|
-
# m.measure_result(:bool_exp_1_2_3) { false }
|
76
|
-
# m.measure_result(:bool_exp_1_2_3) { true }
|
77
|
-
# end
|
78
|
-
# end
|
79
|
-
# end
|
80
|
-
# end
|
81
|
-
# end
|
82
|
-
#
|
83
|
-
# m.measure(:sleep1) do
|
84
|
-
# m.measure(:sleep1_1) do
|
85
|
-
# sleep(0.01)
|
86
|
-
# end
|
87
|
-
# m.measure(:sleep_1_2) do
|
88
|
-
# sleep(0.02)
|
89
|
-
# end
|
90
|
-
# m.measure(:sleep_1_3) do
|
91
|
-
# sleep(0.03)
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
# m.measure(:empty) do
|
95
|
-
# end
|
96
|
-
# m.measure_result("test") { sleep(1) }
|
97
|
-
# m.measure_result("test") { false }
|
98
|
-
# m.measure_result("test") { false }
|
99
|
-
#
|
100
|
-
# m.method_meters(Array,[:sort,:reverse],[:new]) do
|
101
|
-
# Array.new(1000000,"abc").reverse.sort
|
102
|
-
# end
|
103
|
-
#
|
104
|
-
# puts m.report_simple
|
105
|
-
# end
|
106
|
-
#
|
107
|
-
# This sample outputs the following report (see notes)).
|
108
|
-
#
|
109
|
-
# measure path : percent% count user system total real
|
110
|
-
#
|
111
|
-
# \blocks : 100.000% 8014 1.040000 0.060000 1.100000 ( 2.167488)
|
112
|
-
# \empty : 0.000% 1 0.000000 0.000000 0.000000 ( 0.000005)
|
113
|
-
# \emtpy_loop : 0.130% 1 0.010000 0.000000 0.010000 ( 0.002825)
|
114
|
-
# \rough_overhead_x10000 : 49.354% 1 1.000000 0.060000 1.060000 ( 1.069733)
|
115
|
-
# \block_1 : 92.013% 1000 0.890000 0.050000 0.940000 ( 0.984297)
|
116
|
-
# \block_1_1 : 0.503% 1000 0.020000 0.000000 0.020000 ( 0.004951)
|
117
|
-
# \block_1_2 : 77.414% 1000 0.670000 0.040000 0.710000 ( 0.761979)
|
118
|
-
# \block_1_2_1 : 0.640% 1000 0.000000 0.010000 0.010000 ( 0.004880)
|
119
|
-
# \block_1_2_2 : 0.644% 1000 0.010000 0.000000 0.010000 ( 0.004904)
|
120
|
-
# \block_1_2_3 : 48.027% 1000 0.370000 0.020000 0.390000 ( 0.365958)
|
121
|
-
# \bool_exp_1_2_3 = "false" : 1.354% 1000 0.000000 0.000000 0.000000 ( 0.004956)
|
122
|
-
# \bool_exp_1_2_3 = "true" : 1.369% 1000 0.020000 0.000000 0.020000 ( 0.005012)
|
123
|
-
# \sleep1 : 2.868% 1 0.000000 0.000000 0.000000 ( 0.062157)
|
124
|
-
# \sleep1_1 : 17.808% 1 0.000000 0.000000 0.000000 ( 0.011069)
|
125
|
-
# \sleep_1_2 : 32.524% 1 0.000000 0.000000 0.000000 ( 0.020216)
|
126
|
-
# \sleep_1_3 : 49.090% 1 0.000000 0.000000 0.000000 ( 0.030513)
|
127
|
-
# \string_operations : 1.468% 2 0.030000 0.000000 0.030000 ( 0.031817)
|
128
|
-
# \ciao : 95.276% 1 0.030000 0.000000 0.030000 ( 0.030314)
|
129
|
-
# \help : 4.111% 1 0.000000 0.000000 0.000000 ( 0.001308)
|
130
|
-
# \test = "1" : 46.160% 1 0.000000 0.000000 0.000000 ( 1.000502)
|
131
|
-
# \test = "false" : 0.000% 2 0.000000 0.000000 0.000000 ( 0.000008)
|
132
|
-
# \methods : 100.000% 3 0.140000 0.010000 0.150000 ( 0.154880)
|
133
|
-
# \#<Class:Array> : 21.416% 1 0.030000 0.010000 0.040000 ( 0.033169)
|
134
|
-
# \new : 99.907% 1 0.030000 0.010000 0.040000 ( 0.033138)
|
135
|
-
# \Array : 78.489% 2 0.110000 0.000000 0.110000 ( 0.121563)
|
136
|
-
# \reverse : 38.671% 1 0.040000 0.000000 0.040000 ( 0.047010)
|
137
|
-
# \sort : 61.287% 1 0.070000 0.000000 0.070000 ( 0.074502)
|
138
|
-
#
|
139
|
-
#
|
140
|
-
# Note: the percentage in each line is calculated on the real time of the containing block. For example in the example
|
141
|
-
# -> block_1_1 takes 0.503% of the real time of block_1
|
142
|
-
# -> block_1_2 takes 77.414% of the real time of block
|
143
|
-
#
|
144
|
-
# TODO:
|
145
|
-
#
|
146
|
-
# * Eliminate the overhead of the perf meter operations from the computation of times.
|
2
|
+
# https://github.com/lpasqualis/rubyperf
|
147
3
|
#
|
148
4
|
|
149
5
|
require 'perf/measure'
|
data/rubyperf.gemspec
CHANGED
@@ -5,22 +5,21 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rubyperf}
|
8
|
-
s.version = "1.3.
|
8
|
+
s.version = "1.3.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["lpasqualis"]
|
12
|
-
s.date = %q{2012-01-
|
12
|
+
s.date = %q{2012-01-18}
|
13
13
|
s.description = %q{Used to easily measure the performance of blocks of Ruby code, expressions and methods; provides reporting in various formats}
|
14
14
|
s.email = %q{lpasqualis@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
16
|
"README.rdoc"
|
18
17
|
]
|
19
18
|
s.files = [
|
20
19
|
".document",
|
21
20
|
"Gemfile",
|
22
21
|
"Gemfile.lock",
|
23
|
-
"LICENSE.txt",
|
22
|
+
"MIT-LICENSE.txt",
|
24
23
|
"README.rdoc",
|
25
24
|
"Rakefile",
|
26
25
|
"VERSION",
|
data/test/helper.rb
CHANGED
data/test/perf_test_example.rb
CHANGED
data/test/test_meter_factory.rb
CHANGED
data/test/test_no_op_meter.rb
CHANGED
data/test/test_perf_meter.rb
CHANGED
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 3
|
8
|
-
-
|
8
|
+
- 7
|
9
9
|
segments_generated: true
|
10
|
-
version: 1.3.
|
10
|
+
version: 1.3.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- lpasqualis
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-18 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -81,13 +81,12 @@ executables: []
|
|
81
81
|
extensions: []
|
82
82
|
|
83
83
|
extra_rdoc_files:
|
84
|
-
- LICENSE.txt
|
85
84
|
- README.rdoc
|
86
85
|
files:
|
87
86
|
- .document
|
88
87
|
- Gemfile
|
89
88
|
- Gemfile.lock
|
90
|
-
- LICENSE.txt
|
89
|
+
- MIT-LICENSE.txt
|
91
90
|
- README.rdoc
|
92
91
|
- Rakefile
|
93
92
|
- VERSION
|