diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-06-30 20:41:41 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-06-30 20:41:41 +0000 |
commit | 795ec70fc1ae678178e4a7cf16ea8fa76a122ea6 (patch) | |
tree | d19714aa351848804da2a7ffdaea555450b4272e /lib/puppet/util.rb | |
parent | 19b5d3033cc9a80666941b607e2fc5932fa8011e (diff) | |
download | puppet-795ec70fc1ae678178e4a7cf16ea8fa76a122ea6.tar.gz puppet-795ec70fc1ae678178e4a7cf16ea8fa76a122ea6.tar.xz puppet-795ec70fc1ae678178e4a7cf16ea8fa76a122ea6.zip |
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
Diffstat (limited to 'lib/puppet/util.rb')
-rw-r--r-- | lib/puppet/util.rb | 14 |
1 files changed, 12 insertions, 2 deletions
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 |