FEATURE: add rss to bench

BUGFIX: profile db generator require ordering
This commit is contained in:
Sam 2014-01-03 11:51:12 +11:00
parent 9f2150faea
commit 90a7cb9dc3
2 changed files with 19 additions and 16 deletions

View File

@ -174,13 +174,16 @@ begin
run("RAILS_ENV=profile bundle exec rake assets:clean") run("RAILS_ENV=profile bundle exec rake assets:clean")
rss = `ps -o rss -p #{pid}`.chomp.split("\n").last.to_i
results = { results = {
"home_page" => home_page, "home_page" => home_page,
"topic_page" => topic_page, "topic_page" => topic_page,
"home_page_admin" => home_page_admin, "home_page_admin" => home_page_admin,
"topic_page_admin" => topic_page_admin, "topic_page_admin" => topic_page_admin,
"timings" => @timings, "timings" => @timings,
"ruby-version" => "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" "ruby-version" => "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}",
"rss_kb" => rss
}.merge(facts).to_yaml }.merge(facts).to_yaml
puts results puts results

View File

@ -28,21 +28,6 @@ def unbundled_require(gem)
end end
end end
# by default, Discourse has a "system" account
if User.count > 1
puts "Only run this script against an empty DB"
exit
end
require 'optparse'
begin
unbundled_require 'gabbler'
rescue LoadError
puts "installing gabbler gem"
puts `gem install gabbler`
unbundled_require 'gabbler'
end
def sentence def sentence
@gabbler ||= Gabbler.new.tap do |gabbler| @gabbler ||= Gabbler.new.tap do |gabbler|
story = File.read(File.dirname(__FILE__) + "/alice.txt") story = File.read(File.dirname(__FILE__) + "/alice.txt")
@ -76,6 +61,21 @@ unless Rails.env == "profile"
exit exit
end end
# by default, Discourse has a "system" account
if User.count > 1
puts "Only run this script against an empty DB"
exit
end
require 'optparse'
begin
unbundled_require 'gabbler'
rescue LoadError
puts "installing gabbler gem"
puts `gem install gabbler`
unbundled_require 'gabbler'
end
puts "Creating 100 users" puts "Creating 100 users"
users = 100.times.map do |i| users = 100.times.map do |i|
putc "." putc "."