Skip to content

Commit

Permalink
added --bench for easier memory measuring
Browse files Browse the repository at this point in the history
git-svn-id: http://rubygems.rubyforge.org/svn/trunk@1249 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information
jimweirich committed May 31, 2007
1 parent 71a03e9 commit e365da7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/rubygems/config_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class ConfigFile
# this threshhold value, then a bulk download technique is used.
attr_accessor :bulk_threshhold

# True if we are benchmarking this run.
attr_accessor :benchmark

# Create the config file object. +args+ is the list of arguments
# from the command line.
#
Expand All @@ -50,6 +53,7 @@ class ConfigFile
def initialize(arg_list)
@config_file_name = nil
@verbose = true
@benchmark = false
handle_arguments(arg_list)
begin
@hash = open(config_file_name) {|f| YAML.load(f) }
Expand Down Expand Up @@ -94,6 +98,8 @@ def handle_arguments(arg_list)
need_cfg_name = true
when /^--config-file=(.+)$/
@config_file_name = $1
when /^--bench(mark)?$/
@benchmark = true
else
@args << arg
end
Expand Down
7 changes: 7 additions & 0 deletions lib/rubygems/gem_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ def initialize(options={})

# Run the gem command with the following arguments.
def run(args)
start_time = Time.now
do_configuration(args)
cmd = @command_manager_class.instance
cmd.command_names.each do |c|
Command.add_specific_extra_args c, Array(Gem.configuration[c])
end
cmd.run(Gem.configuration.args)
end_time = Time.now
if Gem.configuration.benchmark
printf "\nExecution time: %0.2f seconds.\n", end_time-start_time
puts "Press Enter to finish"
STDIN.gets
end
end

private
Expand Down

0 comments on commit e365da7

Please sign in to comment.