#!/usr/bin/env ruby
require 'benchmark'

Benchmark.bm do |b|
  b.report("require") { require 'puppet' }
  b.report("init") do
    Puppet.initialize_settings(ARGV)
    Puppet::Node::Environment.current = Puppet[:environment]
  end
  b.report("import") { Puppet::Node::Environment.current.known_resource_types.loader.import_all }
end

puts "Stats"
puts "Known resource classes: #{Puppet::Node::Environment.current.known_resource_types.hostclasses.size}"
puts "Known resource defines: #{Puppet::Node::Environment.current.known_resource_types.definitions.size}"
puts "Known resource nodes: #{Puppet::Node::Environment.current.known_resource_types.nodes.size}"
puts "Manifests loaded: #{Puppet::Node::Environment.current.known_resource_types.instance_variable_get('@watched_files').to_a.size}"
puts "Manifests:"
Puppet::Node::Environment.current.known_resource_types.instance_variable_get('@watched_files').each do |file|
  puts "\t#{file}"
end
