Skip to content

floere/squeal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'

About

Log parser to identify actions which significantly increase VM heap size

Resources

License

Stars

Watchers

Forks

Packages

No packages published