Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Log parser to identify actions which significantly increase VM heap size
branch: master

This branch is 12 commits ahead, 86 commits behind noahd1:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
History.textile
MIT-LICENSE
README.textile
Rakefile
squeal.gemspec

README.textile

Squeal

A simple object instantiation counter.

Inspired by oink (http://github.com/noahd1/oink).
I needed a non-rails one for my search engine project Picky (http://github.com/floere/picky), but oink did not fit well.

Note: It reports cumulatively until Squeal.reset is called.

Only works on certain Ruby classes yet (not String, for example).

Examples

Installation

gem install squeal

On a single class.

require 'squeal'

TestClass.squeal do
  TestClass.new
  TestClass.new
  Object.new
  String.new
end
TestClass.new

Squeal.report # => 'TestClass: 2'

On multiple classes

require 'squeal'

# Aliased as Squeal.record
#
Squeal.squeal(Object, TestClass) do
  TestClass.new
  String.new
  Object.new
  TestClass.new
  String.new
end
Object.new
TestClass.new

Squeal.report # => 'Object: 1, TestClass: 2'

Without a block

require 'squeal'

# Aliased as Squeal.squeal
#
Squeal.record Object, TestClass

TestClass.new
String.new
Object.new
TestClass.new
String.new

Squeal.stop

Object.new
TestClass.new

Squeal.report # => 'Object: 1, TestClass: 2'
Something went wrong with that request. Please try again.