def process(request,response)
begin
stats = Hash.new(0)
lengths = {}
ObjectSpace.each_object do |o|
begin
if o.respond_to? :length
len = o.length
lengths[o.class] ||= Mongrel::Stats.new(o.class)
lengths[o.class].sample(len)
end
rescue Object
end
stats[o.class] += 1
end
stats.sort {|(k1,v1),(k2,v2)| v2 <=> v1}.each do |k,v|
if $last_stat
delta = v - $last_stat[k]
if v > 10 and delta != 0
if lengths[k]
$objects_out.printf "%d,%s,%d,%d,%d,%f,%f,%f\n", $run_count, k, $last_stat[k], v, delta,lengths[k].mean,lengths[k].sd,lengths[k].max
else
$objects_out.printf "%d,%s,%d,%d,%d,,,\n", $run_count, k, $last_stat[k], v, delta
end
end
end
end
$run_count += 1
$last_stat = stats
rescue Object
STDERR.puts "object.log ERROR: #$!"
end
end