Sha256: a97c1642a938884f0e47ac27e28a95320ea556dc695e36fd32f20a6ce4c103c9

Contents?: true

Size: 774 Bytes

Versions: 3

Compression:

Stored size: 774 Bytes

Contents

require 'pyroscope'

puts "prestart #{Process.pid}"

Pyroscope.configure do |config|
  config.app_name = "test.ruby.app{}"
  config.server_address = "http://localhost:4040/"
end

puts "start"
iteration=0
st = Time.new

def work(n)
  i = 0
  while i < n
    i += 1
  end
end

def job_0
  work(rand()*1_000_000)
end

def job_1
  work(rand()*2_000_000)
end

def sleep_job
  sleep(rand()*10)
end


while true
  iteration+=1

  r = rand
  if r < 0.1
    sleep_job
  elsif r < 0.5
    puts(" * test.ruby.app{job=0}")
    Pyroscope.change_name("test.ruby.app{job=0}")
    job_0
    Pyroscope.change_name("test.ruby.app{}")
  else
    puts(" * test.ruby.app{job=1}")
    Pyroscope.change_name("test.ruby.app{job=1}")
    job_1
    Pyroscope.change_name("test.ruby.app{}")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pyroscope-0.0.16 test.rb
pyroscope-0.0.14 test.rb
pyroscope-0.0.12 test.rb