xcprofiler 0.4.0 → 0.5.0
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 619014224d306a694c7da11d1ed1306b9b2e3fac
|
4
|
+
data.tar.gz: c0b91191a1208dff867f74cde952515736439118
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3239189c1c076857ca30a1d68a1682452118e963d2491750c08b4ddacf0a1a9dc61c5027e0c35910469e38b7a4ec4ce268b08ea05f3429bdfd80614b542b09ed
|
7
|
+
data.tar.gz: ca139ec88be8f4d7f8429018b04df948e1eb961259c89733f16895cd6698fea69591c09f10aab7b64e8962812a51eba292bcbf8213f308443d97c22aa0172ee1
|
data/README.md
CHANGED
@@ -75,6 +75,7 @@ Sample output is here
|
|
75
75
|
|--show-invalids||Show invalid location results|
|
76
76
|
|--order|-o|Sort order (default,time,file)|
|
77
77
|
|--derived-data-path||Root path of DerivedData directory|
|
78
|
+
|--truncate-at|-t|Truncate the method name with specified length|
|
78
79
|
|
79
80
|
## Use custom reporters
|
80
81
|
|
data/lib/xcprofiler/profiler.rb
CHANGED
@@ -34,7 +34,11 @@ module Xcprofiler
|
|
34
34
|
private
|
35
35
|
|
36
36
|
def reporters
|
37
|
-
@reporters ||= [StandardOutputReporter.new(limit: options[:limit],
|
37
|
+
@reporters ||= [StandardOutputReporter.new(limit: options[:limit],
|
38
|
+
threshold: options[:threshold],
|
39
|
+
order: options[:order],
|
40
|
+
truncate_at: options[:truncate_at])
|
41
|
+
]
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
@@ -2,6 +2,8 @@ module Xcprofiler
|
|
2
2
|
class AbstractReporter
|
3
3
|
attr_reader :options
|
4
4
|
|
5
|
+
DEFAULT_TRUNCATE_AT = 150
|
6
|
+
|
5
7
|
def initialize(options = {})
|
6
8
|
@options = options
|
7
9
|
end
|
@@ -46,5 +48,9 @@ module Xcprofiler
|
|
46
48
|
def order
|
47
49
|
options[:order] || :time
|
48
50
|
end
|
51
|
+
|
52
|
+
def truncate_at
|
53
|
+
options[:truncate_at] ||= DEFAULT_TRUNCATE_AT
|
54
|
+
end
|
49
55
|
end
|
50
56
|
end
|
@@ -13,9 +13,17 @@ module Xcprofiler
|
|
13
13
|
t << ['File', 'Line', 'Method name', 'Time(ms)']
|
14
14
|
t << :separator
|
15
15
|
executions.each do |execution|
|
16
|
-
t << [execution.filename, execution.line, execution.method_name, execution.time]
|
16
|
+
t << [execution.filename, execution.line, truncate(execution.method_name, truncate_at), execution.time]
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
def truncate(text, truncate_at)
|
22
|
+
omission = '...'
|
23
|
+
return text unless text.length >= truncate_at
|
24
|
+
return text unless truncate_at >= omission.length
|
25
|
+
length_with_room_for_omission = truncate_at - omission.length
|
26
|
+
"#{text[0...length_with_room_for_omission]}#{omission}"
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
data/lib/xcprofiler/version.rb
CHANGED
data/lib/xcprofiler.rb
CHANGED
@@ -25,6 +25,7 @@ module Xcprofiler
|
|
25
25
|
opts.on("-l", "--limit [LIMIT]", Integer, "Limit for display") { |v| options.limit = v }
|
26
26
|
opts.on("--threshold [THRESHOLD]", Integer, "Threshold of time to display(ms)") { |v| options.threshold = v }
|
27
27
|
opts.on("--derived-data-path", String, "Root path of DerivedData") { |v| options.derived_data_path = v }
|
28
|
+
opts.on("-t", "--truncate-at [TRUNCATE_AT]", Integer, "Truncate the method name with specified length") { |v| options.truncate_at = v }
|
28
29
|
opts.on_tail("-h", "--help", "Show this message") do
|
29
30
|
puts opts
|
30
31
|
exit
|
@@ -51,7 +52,8 @@ module Xcprofiler
|
|
51
52
|
StandardOutputReporter.new(limit: options[:limit],
|
52
53
|
threshold: options[:threshold],
|
53
54
|
order: order,
|
54
|
-
show_invalid_locations: options[:show_invalid_locations]
|
55
|
+
show_invalid_locations: options[:show_invalid_locations],
|
56
|
+
truncate_at: options[:truncate_at])
|
55
57
|
]
|
56
58
|
profiler.report!
|
57
59
|
rescue Exception => e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcprofiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- giginet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|