Sha256: 0c03e34f4ec86e8fc949c6006d7718c7176bce6181c00f7783c2e4bbd8a02019

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 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
			end
			if line[:command][/^start worker/]
				acc[:workers] << line
				acc[:worker_memory] += line[:rss].to_i
			end
			acc[:total_memory] += line[:rss].to_i
			acc
		end
		out.merge({:num_masters => out[:masters].count, :num_workers => out[:workers].count, :summary => [:num_masters, :num_workers]})
	end
	
end

Version data entries

1 entries across 1 versions & 1 rubygems

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