Module: BleakHouse

This class performs the actual object logging of BleakHouse. To use it directly, you need to make calls to BleakHouse.snapshot.

By default, BleakHouse records a snapshot on exit. You can disable this by setting the environment variable NO_EXIT_HANDLER before startup.

It is also possible to externally trigger the snapshot at any time by sending SIGUSR2 to the process.

Example

At the start of your app, put:

  require 'rubygems'
  require 'bleak_house'
  $logfile = "/path/to/logfile"

Run your app. Once it exits, analyze your data:

  bleak /path/to/logfile

Child modules and classes

Module BleakHouse::Analyzer

Public Class Methods


heaps_length ()

Number of allocated heaps_slots

/* Number of allocated <tt>heaps_slots</tt> */
static VALUE heaps_length(VALUE self) {

heaps_used ()

Number of filled heaps_slots

/* Number of filled <tt>heaps_slots</tt> */
static VALUE heaps_used(VALUE self) {

hook ()

The body of the exit handler and SIGUSR2 trap. It writes a snapshot to a dumpfile named after the current Process.pid.

    # File lib/bleak_house/hook.rb, line 4
 4:   def self.hook
 5:     @count ||= 0
 6:     filename = "/tmp/bleak.#{Process.pid}.#{@count}.dump"
 7:     STDERR.puts "** BleakHouse: working..."
 8:     BleakHouse.snapshot(filename)
 9:     STDERR.puts "** BleakHouse: complete\n** Bleakhouse: Run 'bleak #{filename}' to analyze."  
10:     @count += 1
11:   end

snapshot (p1)

Walk the live, instrumented objects on the heap and write them to _logfile.

/* Walk the live, instrumented objects on the heap and write them to <tt>_logfile</tt>. */
static VALUE snapshot(VALUE self, VALUE _logfile) {