Sha256: a28a5fdf4c3feb4ee9f6e9fb41401aa09cfcebf2ed23ecc4b84dbd10dcfb5d53

Contents?: true

Size: 1.03 KB

Versions: 20

Compression:

Stored size: 1.03 KB

Contents

# Generates ruby-prof output based on the config options used by `scout_realtime` optimized for performance.
# ruby prof.rb
require "rubygems"
require "server_metrics"
require "ruby-prof"

class Harness
  attr_accessor :num_runs, :latest_run

  def initialize
    @num_runs=0

    @collectors={:disks => ServerMetrics::Disk.new(:ttl => 60), :cpu => ServerMetrics::Cpu.new(:skip_load => true), :memory => ServerMetrics::Memory.new(), :network => ServerMetrics::Network.new(), :processes=>ServerMetrics::Processes.new()}
    @system_info = ServerMetrics::SystemInfo.to_h
  end

  def run
    collector_res={}
    @collectors.each_pair do |name, collector|
      collector_res[name] = collector.run
    end

    @latest_run = collector_res.merge(:system_info => @system_info)

    @num_runs +=1
  end
end

harness = Harness.new

harness.run
sleep 1
RUNS = 300
result = RubyProf.profile do
  i=0
  while i < RUNS do
    i +=1
    harness.run
  end
end

# Print a graph profile to text
printer = RubyProf::GraphPrinter.new(result)
printer.print(STDOUT, {})

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
server_metrics-1.2.18 test/performance/prof.rb
server_metrics-1.2.14 test/performance/prof.rb
server_metrics-1.2.14.pre1 test/performance/prof.rb
server_metrics-1.2.14.pre0 test/performance/prof.rb
server_metrics-1.2.13 test/performance/prof.rb
server_metrics-1.2.12 test/performance/prof.rb
server_metrics-1.2.10 test/performance/prof.rb
server_metrics-1.2.9.1 test/performance/prof.rb
server_metrics-1.2.8 test/performance/prof.rb
server_metrics-1.2.7 test/performance/prof.rb
server_metrics-1.2.5 test/performance/prof.rb
server_metrics-1.2.5.pre test/performance/prof.rb
server_metrics-1.2.4 test/performance/prof.rb
server_metrics-1.2.3 test/performance/prof.rb
server_metrics-1.2.3.pre test/performance/prof.rb
server_metrics-1.2.2 test/performance/prof.rb
server_metrics-1.2.2.pre test/performance/prof.rb
server_metrics-1.2.1 test/performance/prof.rb
server_metrics-1.2.0 test/performance/prof.rb
server_metrics-1.2.0.pre test/performance/prof.rb