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
44 45 46 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 44 def initialize(agt_id) @agent_id = agt_id end |
Class Attribute Details
.mem_usages ⇒ Object (readonly)
Returns the value of attribute mem_usages.
37 38 39 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 37 def mem_usages @mem_usages end |
Instance Attribute Details
#agent_id ⇒ Object (readonly)
Returns the value of attribute agent_id.
42 43 44 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 42 def agent_id @agent_id end |
Class Method Details
.get(agent_id) ⇒ Object
101 102 103 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 101 def self.get(agent_id) return @mem_usages[agent_id] end |
.init ⇒ Object
Class methods
97 98 99 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 97 def self.init() GrandAgent.add_lifecycle_listener(AgentListener.new()); end |
Instance Method Details
#print_city_usage(port, city, indent) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 70 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
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/baykit/bayserver/mem_usage.rb', line 48 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 RudderStateStore.get_store(@agent_id).print_usage(indent+1) 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 |