# File src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb, line 176
    def dump_system_metrics(options)
      if dir = ENV['PASSENGER_DEBUG_DIR']
        # When invoked through Passenger Standalone, we want passenger-config
        # to use the PassengerAgent in the Passsenger Standalone buildout directory,
        # because the one in the source root may not exist.
        passenger_config = "#{PhusionPassenger.bin_dir}/passenger-config"
        if is_ruby_program?(passenger_config)
          ruby = options["ruby"]
        else
          ruby = nil
        end
        command = [
          "env",
          "PASSENGER_LOCATION_CONFIGURATION_FILE=#{PhusionPassenger.install_spec}",
          ruby,
          passenger_config,
          "system-metrics"
        ].compact
        contents = `#{Shellwords.join(command)}`
        if $? && $?.exitstatus == 0
          File.open("#{dir}/system_metrics", "wb") do |f|
            f.write(contents)
          end
        end
      end
    rescue SystemCallError
      # Don't care.
    end