mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: memory stats route for diagnostics in admin
This commit is contained in:
@ -7,6 +7,8 @@ require "optparse"
|
||||
@result_file = nil
|
||||
@iterations = 500
|
||||
@best_of = 1
|
||||
@mem_stats = false
|
||||
|
||||
opts = OptionParser.new do |o|
|
||||
o.banner = "Usage: ruby bench.rb [options]"
|
||||
|
||||
@ -22,6 +24,9 @@ opts = OptionParser.new do |o|
|
||||
o.on("-b", "--best_of [NUM]", "Number of times to run the bench taking best as result") do |i|
|
||||
@best_of = i.to_i
|
||||
end
|
||||
o.on("-m", "--memory_stats") do
|
||||
@mem_stats = true
|
||||
end
|
||||
end
|
||||
opts.parse!
|
||||
|
||||
@ -212,6 +217,11 @@ begin
|
||||
|
||||
puts results.to_yaml
|
||||
|
||||
if @mem_stats
|
||||
puts
|
||||
puts open("http://127.0.0.1:#{@port}/admin/memory_stats#{append}").read
|
||||
end
|
||||
|
||||
if @result_file
|
||||
File.open(@result_file,"wb") do |f|
|
||||
f.write(results)
|
||||
|
Reference in New Issue
Block a user