Class: BleakHouseDiagnostic

Inherits:
Object
  • Object
show all
Defined in:
lib/god/diagnostics.rb

Constant Summary collapse

LOG_FILE =
File.join(File.dirname(__FILE__), *%w[.. .. logs bleak.log])

Class Method Summary collapse

Class Method Details

.installObject



15
16
17
18
# File 'lib/god/diagnostics.rb', line 15

def self.install
  require 'snapshot'
  self.spin
end

.snapshotObject



20
21
22
23
24
25
26
27
# File 'lib/god/diagnostics.rb', line 20

def self.snapshot
  @count ||= 0
  filename = "/tmp/god-bleak-%s-%03i.dump" % [Process.pid,@count]
  STDERR.puts "** BleakHouse: working..."
  BleakHouse.ext_snapshot(filename, 3)
  STDERR.puts "** BleakHouse: complete\n** Bleakhouse: Run 'bleak #{filename}' to analyze."
  @count += 1
end

.spin(delay = 60) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/god/diagnostics.rb', line 29

def self.spin(delay = 60)
  Thread.new do
    loop do
      sleep(delay)
      self.snapshot
    end
  end
end