Sha256: 5a6cd48628239b73f687e3e93b75a865def716dd8da3ae6b357d3baab5dc0dfe
Contents?: true
Size: 803 Bytes
Versions: 12
Compression:
Stored size: 803 Bytes
Contents
module NewRelic::Agent class CPUSampler def initialize agent = NewRelic::Agent.instance agent.stats_engine.add_sampled_metric("CPU/User Time") do | stats | t = Process.times @last_utime ||= t.utime utime = t.utime stats.record_data_point(utime - @last_utime) if (utime - @last_utime) >= 0 @last_utime = utime end agent.stats_engine.add_sampled_metric("CPU/System Time") do | stats | t = Process.times @last_stime ||= t.stime stime = t.stime stats.record_data_point(stime - @last_stime) if (stime - @last_stime) >= 0 @last_stime = stime end end end end # CPU sampling like this doesn't work for jruby NewRelic::Agent::CPUSampler.new unless defined? Java
Version data entries
12 entries across 12 versions & 1 rubygems