ruby-prof 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +5 -0
- data/lib/ruby-prof/printers/abstract_printer.rb +11 -1
- data/lib/ruby-prof/printers/flat_printer.rb +3 -2
- data/lib/ruby-prof/version.rb +1 -1
- data/test/printer_flat_test.rb +27 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de991aaaa9b3bae6b7d38da2adac6112e7f254d2927ec3e6cb6e7d1d07fb4c7b
|
4
|
+
data.tar.gz: 1f246cf6795b6cb955188349c5f4da06e95a3fd94241fbd29aab8dcdcd19d312
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc39dad6f9d5795ba4f48fa674097798de0be279ea9ccae63c2a7c683f22031bbf6bda85b81b46bccd8b4112d30e65b40d5a5dac9311ced4d033f3ccb32fd2de
|
7
|
+
data.tar.gz: bf04b46a607a9ff896fc6d8eb169447920136ce5a713132993d2f1e830b215c4fa97f9c43253024ddebb289bc5b3f1ceba0200579796f28a9e31c6faffedb698
|
data/CHANGES
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
1.3.1 (2020-03-11)
|
2
|
+
=====================
|
3
|
+
* Add max_percent and filter_by options to flat printer (Sean McGivern)
|
4
|
+
* Include binary in mingw64 build (Charlie Savage)
|
5
|
+
|
1
6
|
1.3.0 (2020-02-22)
|
2
7
|
=====================
|
3
8
|
* Update C code to use newer RTypedData API versus older RData API.
|
@@ -17,11 +17,21 @@ module RubyProf
|
|
17
17
|
@output = nil
|
18
18
|
end
|
19
19
|
|
20
|
-
# Returns the min_percent of
|
20
|
+
# Returns the min_percent of time a method must take to be included in a profiling report
|
21
21
|
def min_percent
|
22
22
|
@options[:min_percent] || 0
|
23
23
|
end
|
24
24
|
|
25
|
+
# Returns the max_percent of time a method can take to be included in a profiling report
|
26
|
+
def max_percent
|
27
|
+
@options[:max_percent] || 100
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns the method to filter methods by (when using min_percent and max_percent)
|
31
|
+
def filter_by
|
32
|
+
@options[:filter_by] || :self_time
|
33
|
+
end
|
34
|
+
|
25
35
|
# Returns the time format used to show when a profile was run
|
26
36
|
def time_format
|
27
37
|
'%A, %B %-d at %l:%M:%S %p (%Z)'
|
@@ -29,8 +29,9 @@ module RubyProf
|
|
29
29
|
|
30
30
|
sum = 0
|
31
31
|
methods.each do |method|
|
32
|
-
|
33
|
-
next if
|
32
|
+
percent = (method.send(filter_by) / total_time) * 100
|
33
|
+
next if percent < min_percent
|
34
|
+
next if percent > max_percent
|
34
35
|
|
35
36
|
sum += method.self_time
|
36
37
|
#self_time_called = method.called > 0 ? method.self_time/method.called : 0
|
data/lib/ruby-prof/version.rb
CHANGED
data/test/printer_flat_test.rb
CHANGED
@@ -65,4 +65,31 @@ class PrinterFlatTest < TestCase
|
|
65
65
|
assert_sorted times
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
69
|
+
def test_flat_result_max_percent
|
70
|
+
printer = RubyProf::FlatPrinter.new(@result)
|
71
|
+
|
72
|
+
printer.print(output = '', max_percent: 1)
|
73
|
+
self_percents = flat_output_nth_column_values(output, 1).map(&:to_f)
|
74
|
+
|
75
|
+
assert self_percents.max < 1
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_flat_result_filter_by_total_time
|
79
|
+
printer = RubyProf::FlatPrinter.new(@result)
|
80
|
+
|
81
|
+
printer.print(output = '', filter_by: :total_time, min_percent: 50)
|
82
|
+
total_times = flat_output_nth_column_values(output, 2).map(&:to_f)
|
83
|
+
|
84
|
+
assert (total_times.min / total_times.max) >= 0.5
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_flat_result_filter_by_self_time
|
88
|
+
printer = RubyProf::FlatPrinter.new(@result)
|
89
|
+
|
90
|
+
printer.print(output = '', filter_by: :self_time, min_percent: 0.1)
|
91
|
+
self_percents = flat_output_nth_column_values(output, 1).map(&:to_f)
|
92
|
+
|
93
|
+
assert self_percents.min >= 0.1
|
94
|
+
end
|
68
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -177,7 +177,7 @@ metadata:
|
|
177
177
|
bug_tracker_uri: https://github.com/ruby-prof/ruby-prof/issues
|
178
178
|
changelog_uri: https://github.com/ruby-prof/ruby-prof/blob/master/CHANGES
|
179
179
|
documentation_uri: https://ruby-prof.github.io/
|
180
|
-
source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v1.3.
|
180
|
+
source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v1.3.1
|
181
181
|
post_install_message:
|
182
182
|
rdoc_options: []
|
183
183
|
require_paths:
|