summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ohai/application.rb3
-rw-r--r--lib/ohai/runner.rb3
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/ohai/application.rb b/lib/ohai/application.rb
index 586a275d..51ba6433 100644
--- a/lib/ohai/application.rb
+++ b/lib/ohai/application.rb
@@ -20,6 +20,7 @@ require "chef-config/workstation_config_loader"
require "ohai"
require "ohai/log"
require "mixlib/cli"
+require "time"
class Ohai::Application
include Mixlib::CLI
@@ -74,8 +75,10 @@ class Ohai::Application
end
def run
+ start_time = Time.now
configure_ohai
run_application
+ Ohai::Log.debug("Ohai took #{Time.now - start_time} total seconds to run.")
end
def configure_ohai
diff --git a/lib/ohai/runner.rb b/lib/ohai/runner.rb
index 93ec46a3..87a3f1d8 100644
--- a/lib/ohai/runner.rb
+++ b/lib/ohai/runner.rb
@@ -18,6 +18,7 @@
#
require "ohai/dsl"
+require "time"
module Ohai
class Runner
@@ -33,6 +34,7 @@ module Ohai
# If force is set to true, then this plugin and its dependencies
# will be run even if they have been run before.
def run_plugin(plugin)
+ start_time = Time.now
unless plugin.kind_of?(Ohai::DSL::Plugin)
raise Ohai::Exceptions::InvalidPlugin, "Invalid plugin #{plugin} (must be an Ohai::DSL::Plugin or subclass)"
end
@@ -53,6 +55,7 @@ module Ohai
rescue Exception, Errno::ENOENT => e
Ohai::Log.debug("Plugin #{plugin.name} threw exception #{e.inspect} #{e.backtrace.join("\n")}")
end
+ Ohai::Log.debug("Plugin #{plugin.name} took #{Time.now - start_time} seconds to run.")
end
def run_v6_plugin(plugin)