performance graphing and profiling improvements
This commit is contained in:
parent
4c717f0873
commit
6f2b7624cf
1
Gemfile
1
Gemfile
@ -17,6 +17,7 @@ group :development, :test do
|
||||
gem "ci_reporter"
|
||||
gem "ruby-prof" unless RUBY_PLATFORM =~ /java/
|
||||
gem "perftools.rb" unless RUBY_PLATFORM =~ /java/
|
||||
gem "rake-compiler"
|
||||
|
||||
# Java
|
||||
platforms :jruby do
|
||||
|
10
Rakefile
10
Rakefile
@ -7,6 +7,8 @@ end
|
||||
require 'fileutils'
|
||||
require 'rake/testtask'
|
||||
require 'rake'
|
||||
require 'rake/extensiontask'
|
||||
require 'rake/javaextensiontask'
|
||||
|
||||
begin
|
||||
require 'git'
|
||||
@ -20,6 +22,14 @@ end
|
||||
|
||||
ENV['TEST_MODE'] = 'TRUE'
|
||||
|
||||
Rake::ExtensionTask.new('cbson') do |ext|
|
||||
ext.lib_dir = "lib/bson_ext"
|
||||
end
|
||||
|
||||
#Rake::JavaExtensionTask.new('jbson') do |ext| # not yet functional
|
||||
# ext.ext_dir = 'ext/src/org/jbson'
|
||||
#end
|
||||
|
||||
task :java do
|
||||
Rake::Task['build:java'].invoke
|
||||
Rake::Task['test:ruby'].invoke
|
||||
|
@ -25,7 +25,7 @@
|
||||
<h1>Exp Series Performance Tests</h1>
|
||||
x-axis is power of 2, log base 2 of size<br>
|
||||
y-axis is operations per user-time CPU-second<br>
|
||||
Note that this is not operations per real-time second that includes DB real-time<br>
|
||||
Note that this is not operations per real-time second that include DB real-time<br>
|
||||
<div id="placeholder"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
@ -136,10 +136,8 @@ $(function () {
|
||||
]
|
||||
];
|
||||
$.each(graph, function(i, e){
|
||||
var title = e[0];
|
||||
var xMax = e[1];
|
||||
var labelSpec = e[2];
|
||||
var plotSpecs = e[3];
|
||||
var title, xMax, labelSpec, plotSpecs;
|
||||
title = e[0]; xMax = e[1]; labelSpec = e[2]; plotSpecs = e[3]; //[title, xMax, labelSpec, plotSpecs] = e;
|
||||
var series = flotSeries(expSeries, xMax, labelSpec, plotSpecs);
|
||||
doPlot(title, series);
|
||||
});
|
||||
|
@ -16,7 +16,6 @@ def set_mongo_driver_mode(mode)
|
||||
end
|
||||
|
||||
$mode = ARGV[0].to_sym if ARGV[0]
|
||||
#p (ARGV[0] && ARGV[0].to_sym || :c)
|
||||
set_mongo_driver_mode($mode || :c)
|
||||
|
||||
require 'rubygems'
|
||||
@ -40,6 +39,16 @@ def insert(coll, h)
|
||||
coll.insert(h) # note that insert stores :_id in h and subsequent inserts are updates
|
||||
end
|
||||
|
||||
def benchmark(iterations)
|
||||
btms = Benchmark.measure do
|
||||
(0...iterations).each do
|
||||
yield
|
||||
end
|
||||
end
|
||||
utime = btms.utime
|
||||
p ({'ops' => (iterations.to_f / utime.to_f).round(1)})
|
||||
end
|
||||
|
||||
def ruby_prof(iterations)
|
||||
RubyProf.start
|
||||
puts Benchmark.measure {
|
||||
@ -57,7 +66,7 @@ def ruby_prof(iterations)
|
||||
end
|
||||
|
||||
def perftools(iterations)
|
||||
profile_file_name = "/tmp/profile_array.perftools"
|
||||
profile_file_name = '/tmp/profile_array.perftools'
|
||||
PerfTools::CpuProfiler.start(profile_file_name) do
|
||||
iterations.times { yield }
|
||||
end
|
||||
@ -71,12 +80,17 @@ db = conn['benchmark']
|
||||
coll = db['profile']
|
||||
|
||||
coll.remove
|
||||
puts "coll.count: #{coll.count}"
|
||||
#puts "coll.count: #{coll.count}"
|
||||
|
||||
n, doc = array_size_fixnum(2, 6)
|
||||
ruby_prof(1000) { insert(coll, doc) }
|
||||
base = 2
|
||||
power = 6
|
||||
n, doc = array_size_fixnum(base, power)
|
||||
p ({'generator' => 'array_size_fixnum', 'operation' => 'insert', 'base' => base, 'power' => power})
|
||||
|
||||
benchmark(10000) { insert(coll, doc)} # valgrind --tool=callgrind ruby bench/profile_array.rb; callgrind_annotate ...
|
||||
#ruby_prof(1000) { insert(coll, doc) }
|
||||
#perftools(10000) { insert(coll, doc) }
|
||||
|
||||
puts "coll.count: #{coll.count}"
|
||||
#puts "coll.count: #{coll.count}"
|
||||
coll.remove
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user