Commit 64d4eb03 authored by sqozz's avatar sqozz
Browse files

Add frame count metric

parent 4e8575cb
......@@ -10,10 +10,11 @@ import time
MESSAGES = { "GameInfo" : 0x00,
"WorldUpdate" : 0x01,
"Tick" : 0x10,
"BotSpawn" : 0x20,
"BotKill" : 0x21,
"BotMove" : 0x22,
"BotStats" : 0x24
"BotStats" : 0x24,
}
......@@ -100,6 +101,7 @@ class Game():
self.food_decay_per_frame = 0
self.users = UserList()
self.uptime = Summary("api_up", "Status of the server API")
self.frames = Counter("frames", "Frame counter")
pass
......@@ -144,8 +146,10 @@ class Game():
for bot in bots:
bot = bots.get(bot)
self.users.update_by_name(bot.get("name"), data=bot)
elif typ == MESSAGES["Tick"]:
game.frames.inc()
elif msg_type != "FoodSpawn" and msg_type != "WorldUpdate" and msg_type != "FoodConsume" and msg_type != "BotMoveHead" and msg_type != "Tick" and msg_type != "FoodDecay":
elif msg_type != "FoodSpawn" and msg_type != "FoodConsume" and msg_type != "BotMoveHead" and msg_type != "FoodDecay":
logging.fatal("Unhandled msg_type: {}".format(msg_type))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment