Skip to content

Instantly share code, notes, and snippets.

@tmm1
Created March 6, 2009 21:03
Show Gist options
  • Select an option

  • Save tmm1/75072 to your computer and use it in GitHub Desktop.

Select an option

Save tmm1/75072 to your computer and use it in GitHub Desktop.
class GCTime < Graph
name 'gc_time'
title 'Time spent in GC'
vlabel 'microseconds'
category 'gc'
gc_len 'musec in GC'
def self.fetch
if GC.respond_to? :time
@last ||= 0
value :gc_len, GC.time - @last
@last = GC.time
end
super
end
end
class GCCount < Graph
name 'gc_count'
title 'GC runs per minute'
vlabel 'num per min'
scale 'no'
category 'gc'
period 'minute'
default :type => 'DERIVE',
:min => 0
gc_count 'number of gc runs'
def self.fetch
if GC.respond_to? :collections
value :gc_count, GC.collections
end
super
end
end
if GC.respond_to? :num_objects
class GCObjects < Graph
name 'gc_objects'
title 'live ruby objects'
vlabel 'number of objects'
category 'gc'
obj_count 'number of objects'
def self.fetch
value :obj_count, GC.num_objects
super
end
end
end
if GC.respond_to? :malloc_limit
class GCMallocLimit < Graph
name 'gc_malloc_limit'
title 'GC malloc limit'
vlabel 'bytes'
category 'gc'
malloc_limit 'malloc limit'
def self.fetch
value :malloc_limit, GC.malloc_limit
super
end
end
end
if GC.respond_to? :num_heaps
class GCNumHeaps < Graph
name 'gc_num_heaps'
title 'GC num heaps'
vlabel 'number'
category 'gc'
num_heaps 'number of heaps'
def self.fetch
value :num_heaps, GC.num_heaps
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment