fiveruns-dash-ruby 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,11 @@ module Fiveruns
8
8
  RULES = []
9
9
 
10
10
  class << self
11
+
12
+ def host
13
+ ::Fiveruns::Dash.host
14
+ end
15
+
11
16
  def replacements
12
17
  @replacements ||= begin
13
18
  paths = {
@@ -24,11 +29,11 @@ module Fiveruns
24
29
  end
25
30
 
26
31
  def system_gempaths
27
- `gem environment gempath`
32
+ host.result :gem, 'environment gempath', :bat
28
33
  end
29
-
34
+
30
35
  def system_paths
31
- `ruby -e 'puts $:.reject{|p|p=="."}.join(":")'`
36
+ host.result :ruby, %(-e 'puts $:.reject { |p| p == "." }.join(":")'), :exe
32
37
  end
33
38
 
34
39
  def regexp_for_path(path)
@@ -46,6 +51,7 @@ module Fiveruns
46
51
  def add_ignore_rule(&rule)
47
52
  RULES << rule
48
53
  end
54
+
49
55
  end
50
56
 
51
57
  def initialize(session)
@@ -65,6 +65,15 @@ module Fiveruns::Dash
65
65
  def execute_on_windows(&block)
66
66
  block.call if RUBY_PLATFORM =~ /win32|i386-mingw32/
67
67
  end
68
+
69
+ def result(command, args, windows_ext=nil)
70
+ name = if windows_ext && os_name_match?(:windows)
71
+ "#{command}.#{windows_ext}"
72
+ else
73
+ command.to_s
74
+ end
75
+ `#{name} #{args}`
76
+ end
68
77
 
69
78
  def hostname
70
79
  @hostname
data/recipes/ruby.rb CHANGED
@@ -1,34 +1,41 @@
1
1
  Fiveruns::Dash.register_recipe :ruby, :url => 'http://dash.fiveruns.com' do |metrics|
2
- metrics.absolute :vsz,
3
- "Virtual Memory Usage", "The amount of virtual memory used by this process",
4
- :unit => 'kbytes', :scope => :host do
5
- Integer(`ps -o vsz -p #{Process.pid}`[/(\d+)/, 1])
6
- end
7
- metrics.absolute :rss, "Resident Memory Usage",
8
- "The amount of physical memory used by this process",
9
- :unit => 'kbytes',
2
+
3
+ # TODO: Support Windows
4
+ Fiveruns::Dash.host.execute_on_unix do
5
+
6
+ metrics.absolute :vsz,
7
+ "Virtual Memory Usage", "The amount of virtual memory used by this process",
8
+ :unit => 'kbytes', :scope => :host do
9
+ Integer(`ps -o vsz -p #{Process.pid}`[/(\d+)/, 1])
10
+ end
11
+ metrics.absolute :rss, "Resident Memory Usage",
12
+ "The amount of physical memory used by this process",
13
+ :unit => 'kbytes',
14
+ :scope => :host do
15
+ Integer(`ps -o rss -p #{Process.pid}`[/(\d+)/, 1])
16
+ end
17
+ metrics.percentage :pmem,
18
+ "Resident Memory Usage",
19
+ "Percentage of Resident Memory Usage",
10
20
  :scope => :host do
11
- Integer(`ps -o rss -p #{Process.pid}`[/(\d+)/, 1])
12
- end
13
- metrics.percentage :pmem,
14
- "Resident Memory Usage",
15
- "Percentage of Resident Memory Usage",
16
- :scope => :host do
17
- Float(`ps -o pmem -p #{Process.pid}`[/(\d+\.\d+)/, 1])
18
- end
21
+ Float(`ps -o pmem -p #{Process.pid}`[/(\d+\.\d+)/, 1])
22
+ end
19
23
 
20
- if RUBY_PLATFORM == 'java'
21
- Fiveruns::Dash.logger.warn "Cannot collect CPU usage data on JRuby"
22
- else
23
- metrics.percentage :cpu,
24
- 'CPU Usage',
25
- 'Percentage CPU Usage',
26
- :scope => :host do
27
- before = Thread.current[:dash_utime] ||= Process.times.utime
28
- after = Process.times.utime
29
- this_minute = after - before
30
- Thread.current[:dash_utime] = after
31
- (this_minute / 60) * 100.00
24
+ if RUBY_PLATFORM == 'java'
25
+ Fiveruns::Dash.logger.warn "Cannot collect CPU usage data on JRuby"
26
+ else
27
+ metrics.percentage :cpu,
28
+ 'CPU Usage',
29
+ 'Percentage CPU Usage',
30
+ :scope => :host do
31
+ before = Thread.current[:dash_utime] ||= Process.times.utime
32
+ after = Process.times.utime
33
+ this_minute = after - before
34
+ Thread.current[:dash_utime] = after
35
+ (this_minute / 60) * 100.00
36
+ end
32
37
  end
38
+
33
39
  end
40
+
34
41
  end
data/version.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 8
4
- :patch: 5
4
+ :patch: 6
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiveruns-dash-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - FiveRuns Development Team
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-09 00:00:00 -07:00
12
+ date: 2009-03-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -19,8 +19,8 @@ executables: []
19
19
 
20
20
  extensions: []
21
21
 
22
- extra_rdoc_files:
23
- - README.rdoc
22
+ extra_rdoc_files: []
23
+
24
24
  files:
25
25
  - README.rdoc
26
26
  - Rakefile
@@ -32,6 +32,7 @@ files:
32
32
  - lib/fiveruns/dash/host.rb
33
33
  - lib/fiveruns/dash/instrument.rb
34
34
  - lib/fiveruns/dash/metric.rb
35
+ - lib/fiveruns/dash/read
35
36
  - lib/fiveruns/dash/recipe.rb
36
37
  - lib/fiveruns/dash/reporter.rb
37
38
  - lib/fiveruns/dash/scm.rb