From 795ec70fc1ae678178e4a7cf16ea8fa76a122ea6 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 30 Jun 2006 20:41:41 +0000 Subject: adding a "thinmark" method, which does a simple benchmark with no logging git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1346 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/util.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index a157ecf79..b3ad8ec39 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -345,10 +345,10 @@ module Util if Puppet::Log.sendlevel?(level) result = nil seconds = Benchmark.realtime { - result = yield + yield } object.send(level, msg + (" in %0.2f seconds" % seconds)) - result + return seconds else yield end @@ -399,6 +399,16 @@ module Util 0 end end + + # Just benchmark, with no logging. + def thinmark + seconds = Benchmark.realtime { + yield + } + + return seconds + end + module_function :memory end end -- cgit