Sha256: a658005fa5c782662554231a658d0b599d107707625293248b524c9c8abcbae4

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

require 'rubygems'
require 'bundler/setup'

$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "..", "lib")
require 'couchbase'
require 'jruby/profiler'

puts `uname -a`
puts File.readlines('/proc/cpuinfo').sort.uniq.grep(/model name|cpu cores/) rescue nil
puts RUBY_DESCRIPTION

class Profile

  def initialize

    puts "PID is #{Process.pid}"

    @value = { 'im' => [ 'testing', 'stuff' ] }

    puts "Raw value size is: #{@value.size} bytes"

    @keys = [
      @k1 = "Short",
      @k2 = "Sym1-2-3::45" * 8,
      @k3 = "Long" * 40,
      @k4 = "Medium" * 8,
      @k5 = "Medium2" * 8,
      @k6 = "Long3" * 40]

    @cb = Couchbase.new


  end

  def run
    profile_data = JRuby::Profiler.profile do
      2_000.times do
        @cb.set(@k1, @value)
        @cb.set(@k2, @value)
        @cb.set(@k3, @value)
      end

      2_000.times do
        @cb.get(@k1)
        @cb.get(@k2)
        @cb.get(@k3)
      end
    end

    profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data)
    profile_printer.printProfile(STDOUT)

    @cb.disconnect
  end

end

Profile.new.run

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
couchbase-jruby-client-0.2.2-java test/profile/profile.rb
couchbase-jruby-client-0.2.1-java test/profile/profile.rb
couchbase-jruby-client-0.2.0-java test/profile/profile.rb
couchbase-jruby-client-0.1.9-java test/profile/profile.rb
couchbase-jruby-client-0.1.8-java test/profile/profile.rb
couchbase-jruby-client-0.1.7-java test/profile/profile.rb
couchbase-jruby-client-0.1.6-java test/profile/profile.rb
couchbase-jruby-client-0.1.5-java test/profile/profile.rb
couchbase-jruby-client-0.1.4 test/profile/profile.rb
couchbase-jruby-client-0.1.3 test/profile/profile.rb
couchbase-jruby-client-0.1.2 test/profile/profile.rb
couchbase-jruby-client-0.1.1 test/profile/profile.rb