Class: GameMachine::SystemStats
Constant Summary
Constants inherited
from Actor::Base
Actor::Base::ON_RECEIVE_HOOKS
Instance Method Summary
collapse
Methods inherited from Actor::Base
aspect, aspects, find, find_by_address, find_distributed, find_distributed_local, find_remote, hashring, local_path, model_filter, #onReceive, player_controller, #receive_message, #schedule_message, #sender, set_player_controller
Instance Method Details
#on_receive(message) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/game_machine/system_stats.rb', line 15
def on_receive(message)
if message.is_a?(String)
if message == 'message_count'
current_count = JavaLib::MessageGateway.messageCount.incrementAndGet
diff = current_count - @last_count
GameMachine.logger.info "GatewayMessagesPerSecond: #{diff}"
@last_count = current_count
current_count = JavaLib::UdpServerHandler.countIn.incrementAndGet
diff = current_count - @last_in_count
GameMachine.logger.info "MessagesInPerSecond: #{diff}"
@last_in_count = current_count
current_count = JavaLib::UdpServerHandler.countOut.incrementAndGet
diff = current_count - @last_out_count
GameMachine.logger.info "MessagesOutPerSecond: #{diff}"
@last_out_count = current_count
elsif message == 'update'
JavaLib::Grid.grids.each do |name,grid|
object_index_size = grid.objectIndex.length
cellscache_size = grid.cellsCache.length
cells_size = grid.cells.length
GameMachine.logger.info "Grid #{name} ondex_size: #{object_index_size} ccache_size: #{cellscache_size} csize: #{cells_size}"
end
end
end
end
|
#post_init(*args) ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/game_machine/system_stats.rb', line 4
def post_init(*args)
@last_count = 0
@last_in_count = 0
@last_out_count = 0
if getContext.system.name == 'cluster'
@cluster = JavaLib::Cluster.get(getContext.system)
end
end
|