Skip to content

Instantly share code, notes, and snippets.

@ryanhanks
Created May 14, 2012 14:55
Show Gist options
  • Save ryanhanks/2694426 to your computer and use it in GitHub Desktop.
Save ryanhanks/2694426 to your computer and use it in GitHub Desktop.
Benchmarking
FactoryMonitor.benchmarks = []
FactoryMonitor.stack = []
def run_with_monitor
self.class.stack.push self.class.benchmarks
self.class.benchmarks = child_results = []
results = Benchmark.get
self.class.benchmarks = self.class.stack.pop
self.class.benchmarks << [factory_name, results, child_results]
end
[
[:fidelity_bond, results1, []],
[:bid_bond, results2, [
[:user, results3, []],
[:agency, results4, []]
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment