hotch 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0b46853925c0b06868a85c1f41b6464304d64c89
4
- data.tar.gz: 2a75ea05ef514b527dc058de2252808b5074811d
2
+ SHA256:
3
+ metadata.gz: 81c6b6c4a7de4bfbb45eb8d4c4bef3672231aa8c9677329f81bf47dc3cf06e3d
4
+ data.tar.gz: 9ca8707942ea5d222891429764cb090d653cbccbd02f68c6d54ce47716611c6d
5
5
  SHA512:
6
- metadata.gz: 6419725e1737e5d1c662ff5ea6b2741817b041033c95f6961376d5427f3331ce05c18e8502b62299ce43b2b71616c9e96153ccc0327383da7815a983dc82b8a8
7
- data.tar.gz: a2b344453ac3f59902b521dcb5066e5c98d40e0f1ead60c4d5a3c21534cf97f75be5eb6301483e87770444972ace8e3e68cbac45e72163f021117eb18d0836a0
6
+ metadata.gz: 70c13dc3481dbbf1fb7fe37e7828ae5f1a4c7913b8d15a0df0bbb20866eb3d71a464fcfad09e9eebb3ef66a456646961e91fba3ccfe34fd546e8f2c87eb85dff
7
+ data.tar.gz: 02506de0b9435c1bfca28ab740171d5118820965f7b7e40bfd504622defaaa7088e3f53f9da774e466d3d7fc13629092189c4f425db84d97365cc494898acc70
@@ -1,4 +1,5 @@
1
1
  Copyright (c) 2015 Peter Suschlik
2
+ Copyright (c) 2017 Peter Leitzen (Suschlik)
2
3
 
3
4
  MIT License
4
5
 
@@ -6,10 +6,10 @@ require 'hotch/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "hotch"
8
8
  spec.version = Hotch::VERSION
9
- spec.authors = ["Peter Suschlik"]
10
- spec.email = ["peter@suschlik.de"]
9
+ spec.authors = ["Peter Leitzen"]
10
+ spec.email = ["peter@leitzen.de"]
11
11
  spec.summary = %q{Profile helper}
12
- spec.description = %q{Stackprofs your program, generates/display call-stack profile as SVG}
12
+ spec.description = %q{Callstack and memory profiler}
13
13
  spec.homepage = "https://github.com/splattael/hotch"
14
14
  spec.license = "MIT"
15
15
 
@@ -1,6 +1,8 @@
1
1
  require 'stackprof'
2
2
  require 'tmpdir'
3
3
 
4
+ require 'hotch/version'
5
+
4
6
  class Hotch
5
7
  attr_reader :name, :viewer, :filter, :options
6
8
 
@@ -44,7 +46,13 @@ class Hotch
44
46
  dot = report_dot(report, dir, "profile.dot")
45
47
  svg = convert_svg(dir, dot, "profile.svg")
46
48
 
47
- yield svg
49
+ @reports.clear
50
+
51
+ if block_given?
52
+ yield report, svg
53
+ else
54
+ return report, svg
55
+ end
48
56
  end
49
57
 
50
58
  def report_at_exit
@@ -53,7 +61,7 @@ class Hotch
53
61
  at_exit do
54
62
  stop
55
63
 
56
- report do |svg|
64
+ report do |_, svg|
57
65
  if viewer
58
66
  puts "Profile SVG: #{svg}"
59
67
  Kernel.system viewer, svg
@@ -53,9 +53,14 @@ class Hotch
53
53
 
54
54
  def report
55
55
  # TODO make it persistent (as CSV)
56
- report = @reports.inject(:sum)
57
- yield report
56
+ report = @reports.inject(:+)
58
57
  @reports.clear
58
+
59
+ if block_given?
60
+ yield report
61
+ else
62
+ report
63
+ end
59
64
  end
60
65
 
61
66
  def report_at_exit
@@ -88,7 +93,7 @@ class Hotch
88
93
  end.compact
89
94
  end
90
95
 
91
- def sum(other)
96
+ def +(other)
92
97
  by_key = Hash[@lines.map { |line| [line.key, line] }]
93
98
  other.lines.each do |line|
94
99
  if existing = by_key[line.key]
@@ -144,7 +149,7 @@ class Hotch
144
149
  def self.from_result(result, ignore_paths)
145
150
  path, line, *args = result.flatten(1)
146
151
  return if ignore_paths.any? { |ip| ip == path || ip === path }
147
- filename = "#{strip_path(path)}:#{line}"
152
+ filename = "#{strip_path(path || "?")}:#{line}"
148
153
  new(filename, *args)
149
154
  end
150
155
 
@@ -1,3 +1,3 @@
1
1
  class Hotch
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
- - Peter Suschlik
7
+ - Peter Leitzen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-24 00:00:00.000000000 Z
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stackprof
@@ -66,9 +66,9 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.0'
69
- description: Stackprofs your program, generates/display call-stack profile as SVG
69
+ description: Callstack and memory profiler
70
70
  email:
71
- - peter@suschlik.de
71
+ - peter@leitzen.de
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.6.13
112
+ rubygems_version: 2.7.7
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Profile helper