Class: Baykit::BayServer::MemUsage
- Inherits:
-
Object
- Object
- Baykit::BayServer::MemUsage
- Includes:
- Baykit::BayServer, Agent, Common, Docker::Base, Protocol, Tours, Util
- Defined in:
- lib/baykit/bayserver/mem_usage.rb
Defined Under Namespace
Classes: AgentListener
Class Attribute Summary collapse
-
.mem_usages ⇒ Object
readonly
Returns the value of attribute mem_usages.
Instance Attribute Summary collapse
-
#agent_id ⇒ Object
readonly
Returns the value of attribute agent_id.
Class Method Summary collapse
- .get(agent_id) ⇒ Object
-
.init ⇒ Object
Class methods.
Instance Method Summary collapse
-
#initialize(agt_id) ⇒ MemUsage
constructor
A new instance of MemUsage.
- #print_city_usage(port, city, indent) ⇒ Object
- #print_usage(indent) ⇒ Object
Constructor Details
#initialize(agt_id) ⇒ MemUsage
Returns a new instance of MemUsage.
43 44 45 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 43 def initialize(agt_id) @agent_id = agt_id end |
Class Attribute Details
.mem_usages ⇒ Object (readonly)
Returns the value of attribute mem_usages.
36 37 38 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 36 def mem_usages @mem_usages end |
Instance Attribute Details
#agent_id ⇒ Object (readonly)
Returns the value of attribute agent_id.
41 42 43 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 41 def agent_id @agent_id end |
Class Method Details
.get(agent_id) ⇒ Object
99 100 101 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 99 def self.get(agent_id) return @mem_usages[agent_id] end |
.init ⇒ Object
Class methods
95 96 97 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 95 def self.init() GrandAgent.add_lifecycle_listener(AgentListener.new()); end |
Instance Method Details
#print_city_usage(port, city, indent) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 68 def print_city_usage(port, city, indent) if port == nil pname = "" else pname = "@#{port}" end city.clubs().each do |club| if club.kind_of?(WarpBase) BayLog.info("%sClub(%s%s) Usage:", StringUtil.indent(indent), club, pname); club.get_ship_store(@agent_id).print_usage(indent+1) end end city.towns().each do |town| town.clubs().each do |club| if club.kind_of?(WarpBase) BayLog.info("%sClub(%s%s) Usage:", StringUtil.indent(indent), club, pname); club.get_ship_store(@agent_id).print_usage(indent+1) end end end end |
#print_usage(indent) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 47 def print_usage(indent) InboundShipStore.get_store(@agent_id).print_usage(indent+1) ProtocolHandlerStore.get_stores(@agent_id).each do |store| store.print_usage(indent+1) end PacketStore.get_stores(@agent_id).each do |store| store.print_usage(indent+1) end TourStore.get_store(@agent_id).print_usage(indent+1); BayServer.cities.cities.each do |city| print_city_usage(nil, city, indent) end BayServer.ports.each do |port| port.cities.cities().each do |city| print_city_usage(port, city, indent) end end end |