mitchellh/vagrant — pull request #3034 by endemics (2014-02-27 02:06:55+00:00)
Title: Adding profiling to the puppet apply provisioner

This allows you to display a list of the puppet resources taking the longest to execute.

By default profiling is deactivated.

To activate, you need to set a numerical value to config.profiling corresponding
to the number of resources you want to see in your profiling report, as in:

config.vm.provision "puppet" do |puppet|
puppet.profiling = 5
...
end

This would display the slowest 5 puppet resources as such:

Top 5 Puppet resources by runtime
=================================
0s - Service[squid3]
0s - Class[Squid]
0s - Class[Settings]
0s - Stage[post-yum-repo-setup]
0s - Class[Squid]
0s - Stage[yum-repo-setup]

As shown in this example, execution times are displayed in seconds (truncated),
and in this specific case there is probably not much we can do to make it go faster ;)

This code is based on code originally written in a custom provisioner for vagrant 1.0.x by:
Peter Leschev

This commit makes it configurable and ports is to the upstream puppet provisioner plugin.

I am willing to add documentation and tests if required.