From d812d9fac7bae4eff66a5ce8275be19d0ca77a32 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Nov 2012 21:13:16 +0300 Subject: Add own profiler and profiler info to some code. --- src/net/tmwa/adminhandler.cpp | 2 ++ src/net/tmwa/beinghandler.cpp | 2 ++ src/net/tmwa/buysellhandler.cpp | 3 ++- src/net/tmwa/charserverhandler.cpp | 2 ++ src/net/tmwa/chathandler.cpp | 2 ++ src/net/tmwa/gamehandler.cpp | 2 ++ src/net/tmwa/generalhandler.cpp | 6 ++++++ src/net/tmwa/guildhandler.cpp | 2 ++ src/net/tmwa/inventoryhandler.cpp | 2 ++ src/net/tmwa/itemhandler.cpp | 2 ++ src/net/tmwa/loginhandler.cpp | 2 ++ src/net/tmwa/network.cpp | 4 ++++ src/net/tmwa/npchandler.cpp | 2 ++ src/net/tmwa/partyhandler.cpp | 2 ++ src/net/tmwa/playerhandler.cpp | 2 ++ src/net/tmwa/questhandler.cpp | 2 ++ src/net/tmwa/specialhandler.cpp | 2 ++ src/net/tmwa/tradehandler.cpp | 2 ++ 18 files changed, 42 insertions(+), 1 deletion(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index d7fc78d1d..26abfc0cd 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -56,6 +56,7 @@ AdminHandler::AdminHandler() : void AdminHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("AdminHandler::handleMessage") int id; switch (msg.getId()) { @@ -68,6 +69,7 @@ void AdminHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("AdminHandler::handleMessage") } void AdminHandler::announce(const std::string &text) diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 5bf0bc1d6..9d9c82fce 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -107,6 +107,7 @@ void BeingHandler::requestNameById(int id) void BeingHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("BeingHandler::handleMessage") switch (msg.getId()) { case SMSG_BEING_VISIBLE: @@ -235,6 +236,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("BeingHandler::handleMessage") } void BeingHandler::undress(Being *being) diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 6d94370c7..fcc6be2cf 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -73,6 +73,7 @@ BuySellHandler::BuySellHandler() : void BuySellHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("BuySellHandler::handleMessage") switch (msg.getId()) { case SMSG_NPC_BUY_SELL_CHOICE: @@ -98,7 +99,7 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg) default: break; } - + BLOCK_END("BuySellHandler::handleMessage") } void BuySellHandler::processNpcBuy(Net::MessageIn &msg) diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 039010535..4d0fae108 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -73,6 +73,7 @@ CharServerHandler::CharServerHandler() : void CharServerHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("CharServerHandler::handleMessage") switch (msg.getId()) { case SMSG_CHAR_LOGIN: @@ -162,6 +163,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("CharServerHandler::handleMessage") } void CharServerHandler::readPlayerData(Net::MessageIn &msg, diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index ef6ff2847..07f95d5f9 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -69,6 +69,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) if (!localChatTab) return; + BLOCK_START("ChatHandler::handleMessage") switch (msg.getId()) { case SMSG_WHISPER_RESPONSE: @@ -100,6 +101,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("ChatHandler::handleMessage") } void ChatHandler::talk(const std::string &text) diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 2515a45d3..e09bb5436 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -58,6 +58,7 @@ GameHandler::GameHandler() : void GameHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("GameHandler::handleMessage") switch (msg.getId()) { case SMSG_MAP_LOGIN_SUCCESS: @@ -84,6 +85,7 @@ void GameHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("GameHandler::handleMessage") } void GameHandler::mapLoadedEvent() diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 33ccfe819..b26a14daf 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -121,6 +121,7 @@ GeneralHandler::~GeneralHandler() void GeneralHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("GeneralHandler::handleMessage") int code; switch (msg.getId()) @@ -164,6 +165,7 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("GeneralHandler::handleMessage") } void GeneralHandler::load() @@ -220,9 +222,12 @@ void GeneralHandler::flushNetwork() if (!mNetwork) return; + BLOCK_START("GeneralHandler::flushNetwork 1") mNetwork->flush(); + BLOCK_END("GeneralHandler::flushNetwork 1") mNetwork->dispatchMessages(); + BLOCK_START("GeneralHandler::flushNetwork 3") if (mNetwork->getState() == Network::NET_ERROR) { if (!mNetwork->getError().empty()) @@ -232,6 +237,7 @@ void GeneralHandler::flushNetwork() Client::setState(STATE_ERROR); } + BLOCK_END("GeneralHandler::flushNetwork 3") } void GeneralHandler::clearHandlers() diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 6b97c6020..5f148ebac 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -80,6 +80,7 @@ GuildHandler::~GuildHandler() void GuildHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("GuildHandler::handleMessage") switch (msg.getId()) { case SMSG_GUILD_CREATE_RESPONSE: @@ -189,6 +190,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("GuildHandler::handleMessage") } void GuildHandler::create(const std::string &name) diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index f5768f8c5..562e9c00b 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -67,6 +67,7 @@ InventoryHandler::~InventoryHandler() void InventoryHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("InventoryHandler::handleMessage") switch (msg.getId()) { case SMSG_PLAYER_INVENTORY: @@ -133,6 +134,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("InventoryHandler::handleMessage") } void InventoryHandler::equipItem(const Item *item) diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp index 7612b638e..d1becafef 100644 --- a/src/net/tmwa/itemhandler.cpp +++ b/src/net/tmwa/itemhandler.cpp @@ -45,6 +45,7 @@ ItemHandler::ItemHandler() : void ItemHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("ItemHandler::handleMessage") switch (msg.getId()) { case SMSG_ITEM_VISIBLE: @@ -62,6 +63,7 @@ void ItemHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("ItemHandler::handleMessage") } } // namespace TmwAthena diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index eb0364d44..7e4eca95f 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -65,6 +65,7 @@ LoginHandler::~LoginHandler() void LoginHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("LoginHandler::handleMessage") switch (msg.getId()) { case SMSG_CHAR_PASSWORD_RESPONSE: @@ -94,6 +95,7 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("LoginHandler::handleMessage") } void LoginHandler::connect() diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index c8c28e0d2..e7e336d2d 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -135,6 +135,7 @@ void Network::clearHandlers() void Network::dispatchMessages() { + BLOCK_START("Network::dispatchMessages") while (messageReady()) { MessageIn *const msg = getNextMessage(); @@ -158,6 +159,7 @@ void Network::dispatchMessages() skip(msg->getLength()); delete msg; } + BLOCK_END("Network::dispatchMessages") } bool Network::messageReady() @@ -197,6 +199,7 @@ bool Network::messageReady() MessageIn *Network::getNextMessage() { + BLOCK_START("Network::getNextMessage") while (!messageReady()) { if (mState == NET_ERROR) @@ -224,6 +227,7 @@ MessageIn *Network::getNextMessage() MessageIn *const msg = new MessageIn(mInBuffer, len); SDL_mutexV(mMutex); + BLOCK_END("Network::getNextMessage") return msg; } diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 3e9fe3822..732fc7d06 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -63,6 +63,7 @@ NpcHandler::NpcHandler() : void NpcHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("NpcHandler::handleMessage") const int npcId = getNpc(msg, msg.getId() == SMSG_NPC_CHOICE || msg.getId() == SMSG_NPC_MESSAGE); @@ -107,6 +108,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) } mDialog = nullptr; + BLOCK_END("NpcHandler::handleMessage") } void NpcHandler::talk(int npcId) diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index e23629bc2..7ff752252 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -65,6 +65,7 @@ PartyHandler::~PartyHandler() void PartyHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("PartyHandler::handleMessage") switch (msg.getId()) { case SMSG_PARTY_CREATE: @@ -101,6 +102,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("PartyHandler::handleMessage") } void PartyHandler::create(const std::string &name) diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 1067418e2..d5c48e387 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -62,6 +62,7 @@ PlayerHandler::PlayerHandler() : void PlayerHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("PlayerHandler::handleMessage") switch (msg.getId()) { case SMSG_WALK_RESPONSE: @@ -107,6 +108,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("PlayerHandler::handleMessage") } void PlayerHandler::attack(int id, bool keep) diff --git a/src/net/tmwa/questhandler.cpp b/src/net/tmwa/questhandler.cpp index bd03dc7a2..228e06ed0 100644 --- a/src/net/tmwa/questhandler.cpp +++ b/src/net/tmwa/questhandler.cpp @@ -52,6 +52,7 @@ QuestHandler::QuestHandler() : void QuestHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("QuestHandler::handleMessage") switch (msg.getId()) { case CMSG_QUEST_SET_VAR: @@ -65,6 +66,7 @@ void QuestHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("QuestHandler::handleMessage") } void QuestHandler::processSetQuestVar(Net::MessageIn &msg A_UNUSED) diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp index ab37aba97..72838e052 100644 --- a/src/net/tmwa/specialhandler.cpp +++ b/src/net/tmwa/specialhandler.cpp @@ -50,6 +50,7 @@ SpecialHandler::SpecialHandler() : void SpecialHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("SpecialHandler::handleMessage") switch (msg.getId()) { case SMSG_PLAYER_SKILLS: @@ -67,6 +68,7 @@ void SpecialHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("SpecialHandler::handleMessage") } void SpecialHandler::useBeing(int id, int level, int beingId) diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 4fc099f27..727ca581a 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -58,6 +58,7 @@ TradeHandler::TradeHandler() : void TradeHandler::handleMessage(Net::MessageIn &msg) { + BLOCK_START("TradeHandler::handleMessage") switch (msg.getId()) { case SMSG_TRADE_REQUEST: @@ -91,6 +92,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) default: break; } + BLOCK_END("TradeHandler::handleMessage") } void TradeHandler::request(Being *being) -- cgit v1.2.3-70-g09d2