spec/lib/rhcf/timeseries/redis_spec.rb in rhcf-timeseries-0.0.4 vs spec/lib/rhcf/timeseries/redis_spec.rb in rhcf-timeseries-0.0.5

- old
+ new

@@ -1,16 +1,15 @@ require 'spec_helper' require 'timecop' require 'redis' require 'rhcf/timeseries/redis' require 'benchmark' -require 'logger' +require 'stackprof' describe Rhcf::Timeseries::Redis do - let(:null_logger){Logger.new('/dev/null')} let(:redis_connection){Redis.new} - subject{Rhcf::Timeseries::Redis.new(null_logger, redis_connection)} + subject{Rhcf::Timeseries::Redis.new(nil, redis_connection)} before(:each) do Timecop.return subject.flush! end @@ -19,12 +18,14 @@ subject.flush! total = 0 start_time = Time.now bench = Benchmark.measure { - 10000.times do - total +=1 - subject.store("a", {"b" => 1} ) #, time) + profile = StackProf.run(mode: :cpu, out: '/tmp/stackprof-cpu-store.dump') do + 10000.times do + total +=1 + subject.store("a", {"b" => 1} ) #, time) + end end } #pp subject.find("a", start_time - 11100, Time.now + 11100).points(:second)