Sha256: 2529a00cb2d0237fa971116e96db146f8b5d97df33a9bedd3703260cb04cf5cc

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

class Unicorns
	
	include Watchman
	
	def self.data
		out = PS.data.inject({:masters => [], :workers => [], :master_memory => 0, :worker_memory => 0, :total_memory => 0}) do |acc,line|
			if line[:command][/^start master/]
				acc[:masters] << line
				acc[:master_memory] += line[:rss].to_i
				acc[:total_memory] += line[:rss].to_i
			end
			if line[:command][/^start worker/]
				acc[:workers] << line
				acc[:worker_memory] += line[:rss].to_i
				acc[:total_memory] += line[:rss].to_i
			end
			acc
		end
		out.merge({:num_masters => out[:masters].count, :num_workers => out[:workers].count, :summary => [:num_masters, :num_workers]})
	end
	
	add_rule do |dat|
		
	end
	
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
city-watch-0.5.2 lib/city_watch/watchmen/unicorns.rb