puppet-profiler 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ data.tar.gz: b32e634a9b11eab7234f7ade555fc8beabbc1c0b
4
+ metadata.gz: 2a3757033639b599aa67602963c4c5a354c0d35e
5
+ SHA512:
6
+ data.tar.gz: 4fd5fdf310182ec16e00bea6226399c906a783bbe1b179f8f3a2ba52ac61642a41a33a6c0854ea5dcf530699adbe70caac363f7105acc2138121164517abe4bb
7
+ metadata.gz: b6511d82f58df2f4c5f0888d6081f5c661e40bbb88d4de82f5b6fee2d2793826fb790dbe1fb663c24ee59adafc0402196d6fec7ea3dbcbff04a6693b2bea537d
@@ -17,13 +17,17 @@ Basic Command Line Usage:
17
17
  Options:
18
18
  HELP
19
19
 
20
- options = {:number => 10}
20
+ options = {:number => 10, :command => "puppet agent --test"}
21
21
  opts = OptionParser.new do |opts|
22
22
  opts.banner = help
23
23
 
24
- opts.on('-n' '--number NUMBER', 'Number of results to return') do |v|
24
+ opts.on('-n', '--number NUMBER', "Number of results to return (default #{options[:number]})") do |v|
25
25
  options[:number] = v.to_i
26
26
  end
27
+
28
+ opts.on('-c', '--command COMMAND', "Command to execute (default #{options[:command]})") do |v|
29
+ options[:command] = v.to_s
30
+ end
27
31
  end
28
32
 
29
33
  begin
@@ -34,4 +38,4 @@ rescue OptionParser::InvalidOption
34
38
  exit 1
35
39
  end
36
40
 
37
- PuppetProfiler.run(options[:number])
41
+ PuppetProfiler.run(options[:number], options[:command])
@@ -1,21 +1,16 @@
1
1
  class PuppetProfiler
2
- def self.run(num_res)
3
- output = `puppet agent --test --evaltrace --color=false`.split("\n")
2
+ def self.run(num_res, cmd)
3
+ cmd = cmd + " --verbose --evaltrace --color=false"
4
+ output = `#{cmd}`.split("\n")
4
5
 
5
6
  times = []
6
- resources = output.select { |line|
7
- line =~ /.+: E?valuated in [\d\.]+ seconds$/
8
- }.each { |line|
9
- res_line, junk, eval_line = line.rpartition(':')
10
- if eval_line =~ / E?valuated in ([\d\.]+) seconds$/
11
- time = $1.to_f
12
- end
13
- junk, junk, res_line = res_line.partition(':')
14
- if res_line =~ /.*([A-Z][^\[]+)\[(.+?)\]$/
7
+ output.each { |line|
8
+ if line =~ /info: .*([A-Z][^\[]+)\[(.+?)\]: Evaluated in ([\d\.]+) seconds$/
15
9
  type = $1
16
10
  title = $2
11
+ time = $3.to_f
12
+ times << [type, title, time]
17
13
  end
18
- times << [type, title, time]
19
14
  }
20
15
 
21
16
  puts "Top #{num_res} Puppet resources by runtime"
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'puppet-profiler'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
  s.homepage = 'https://github.com/rodjek/puppet-profiler/'
5
5
  s.summary = 'Find the slow resources in your Puppet manifests'
6
6
  s.description = 'Analyses your Puppet runs on a host and returns a list of
metadata CHANGED
@@ -1,13 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-profiler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 2
10
- version: 0.0.2
4
+ version: 0.0.3
11
5
  platform: ruby
12
6
  authors:
13
7
  - Tim Sharpe
@@ -15,7 +9,7 @@ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
11
 
18
- date: 2011-12-29 00:00:00 Z
12
+ date: 2014-07-31 00:00:00 Z
19
13
  dependencies: []
20
14
 
21
15
  description: |-
@@ -37,35 +31,28 @@ files:
37
31
  homepage: https://github.com/rodjek/puppet-profiler/
38
32
  licenses: []
39
33
 
34
+ metadata: {}
35
+
40
36
  post_install_message:
41
37
  rdoc_options: []
42
38
 
43
39
  require_paths:
44
40
  - lib
45
41
  required_ruby_version: !ruby/object:Gem::Requirement
46
- none: false
47
42
  requirements:
48
- - - ">="
43
+ - &id001
44
+ - ">="
49
45
  - !ruby/object:Gem::Version
50
- hash: 3
51
- segments:
52
- - 0
53
46
  version: "0"
54
47
  required_rubygems_version: !ruby/object:Gem::Requirement
55
- none: false
56
48
  requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
49
+ - *id001
63
50
  requirements: []
64
51
 
65
52
  rubyforge_project:
66
- rubygems_version: 1.8.6
53
+ rubygems_version: 2.1.11
67
54
  signing_key:
68
- specification_version: 3
55
+ specification_version: 4
69
56
  summary: Find the slow resources in your Puppet manifests
70
57
  test_files: []
71
58