- added more perf timings to menus

This commit is contained in:
Mark Vejvoda
2010-09-02 21:40:43 +00:00
parent e4e8beb230
commit 534df002ba
2 changed files with 66 additions and 5 deletions

View File

@@ -498,6 +498,9 @@ void MenuStateConnectedGame::render() {
} }
void MenuStateConnectedGame::update() { void MenuStateConnectedGame::update() {
Chrono chrono;
chrono.start();
ClientInterface* clientInterface= NetworkManager::getInstance().getClientInterface(); ClientInterface* clientInterface= NetworkManager::getInstance().getClientInterface();
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
@@ -525,6 +528,9 @@ void MenuStateConnectedGame::update() {
} }
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//update status label //update status label
if(clientInterface != NULL && clientInterface->isConnected()) { if(clientInterface != NULL && clientInterface->isConnected()) {
buttonDisconnect.setText(lang.get("Disconnect")); buttonDisconnect.setText(lang.get("Disconnect"));
@@ -650,6 +656,9 @@ void MenuStateConnectedGame::update() {
//labelStatus.setText(szBuf); //labelStatus.setText(szBuf);
labelStatus.setText(label); labelStatus.setText(label);
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
} }
else { else {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
@@ -658,15 +667,23 @@ void MenuStateConnectedGame::update() {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
clientInterface->close(); clientInterface->close();
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
returnToJoinMenu(); returnToJoinMenu();
return; return;
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//process network messages //process network messages
if(clientInterface != NULL && clientInterface->isConnected()) { if(clientInterface != NULL && clientInterface->isConnected()) {
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
bool mustSwitchPlayerName = false; bool mustSwitchPlayerName = false;
if(clientInterface->getGameSettingsReceived()) { if(clientInterface->getGameSettingsReceived()) {
@@ -812,6 +829,9 @@ void MenuStateConnectedGame::update() {
} }
} }
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
} }
//update lobby //update lobby
@@ -821,6 +841,9 @@ void MenuStateConnectedGame::update() {
clientInterface->updateLobby(); clientInterface->updateLobby();
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
clientInterface= NetworkManager::getInstance().getClientInterface(); clientInterface= NetworkManager::getInstance().getClientInterface();
@@ -867,11 +890,14 @@ void MenuStateConnectedGame::update() {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
} }
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
} }
if(clientInterface != NULL && clientInterface->getLaunchGame()) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] clientInterface->getLaunchGame() - D\n",__FILE__,__FUNCTION__); //if(clientInterface != NULL && clientInterface->getLaunchGame()) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] clientInterface->getLaunchGame() - D\n",__FILE__,__FUNCTION__);
} }
bool MenuStateConnectedGame::loadFactions(const GameSettings *gameSettings, bool errorOnNoFactions){ bool MenuStateConnectedGame::loadFactions(const GameSettings *gameSettings, bool errorOnNoFactions){

View File

@@ -950,6 +950,9 @@ void MenuStateCustomGame::render() {
} }
void MenuStateCustomGame::update() { void MenuStateCustomGame::update() {
Chrono chrono;
chrono.start();
MutexSafeWrapper safeMutex(&masterServerThreadAccessor); MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
try { try {
@@ -982,10 +985,12 @@ void MenuStateCustomGame::update() {
bool masterServerErr = showMasterserverError; bool masterServerErr = showMasterserverError;
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(masterServerErr) if(masterServerErr) {
{
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(EndsWith(masterServererErrorToShow, "wrong router setup") == true) if(EndsWith(masterServererErrorToShow, "wrong router setup") == true)
@@ -1006,6 +1011,9 @@ void MenuStateCustomGame::update() {
showMessageBox( generalErrorToShow, "Error", false); showMessageBox( generalErrorToShow, "Error", false);
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
// handle setting changes from clients // handle setting changes from clients
@@ -1081,6 +1089,9 @@ void MenuStateCustomGame::update() {
} }
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] mapInfo.players = %d\n",__FILE__,__FUNCTION__,__LINE__,mapInfo.players); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] mapInfo.players = %d\n",__FILE__,__FUNCTION__,__LINE__,mapInfo.players);
for(int i= 0; i<mapInfo.players; ++i) { for(int i= 0; i<mapInfo.players; ++i) {
@@ -1230,6 +1241,9 @@ void MenuStateCustomGame::update() {
} }
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
bool checkDataSynch = (serverInterface->getAllowGameDataSynchCheck() == true && bool checkDataSynch = (serverInterface->getAllowGameDataSynchCheck() == true &&
@@ -1240,12 +1254,18 @@ void MenuStateCustomGame::update() {
GameSettings gameSettings; GameSettings gameSettings;
loadGameSettings(&gameSettings); loadGameSettings(&gameSettings);
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
// Send the game settings to each client if we have at least one networked client // Send the game settings to each client if we have at least one networked client
if(checkDataSynch == true) { if(checkDataSynch == true) {
serverInterface->setGameSettings(&gameSettings,false); serverInterface->setGameSettings(&gameSettings,false);
needToSetChangedGameSettings = false; needToSetChangedGameSettings = false;
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(hasOneNetworkSlotOpen) { if(hasOneNetworkSlotOpen) {
@@ -1273,6 +1293,9 @@ void MenuStateCustomGame::update() {
listBoxPublishServer.getSelectedItemIndex() == 0 && listBoxPublishServer.getSelectedItemIndex() == 0 &&
needToRepublishToMasterserver == true); needToRepublishToMasterserver == true);
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
if(callPublishNow == true) { if(callPublishNow == true) {
// give it to me baby, aha aha ... // give it to me baby, aha aha ...
publishToMasterserver(); publishToMasterserver();
@@ -1284,6 +1307,9 @@ void MenuStateCustomGame::update() {
needToBroadcastServerSettings=true; needToBroadcastServerSettings=true;
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//call the chat manager //call the chat manager
chatManager.updateNetwork(); chatManager.updateNetwork();
@@ -1298,12 +1324,18 @@ void MenuStateCustomGame::update() {
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
if(currentConnectionCount > soundConnectionCount){ if(currentConnectionCount > soundConnectionCount){
soundConnectionCount = currentConnectionCount; soundConnectionCount = currentConnectionCount;
SoundRenderer::getInstance().playFx(CoreData::getInstance().getAttentionSound()); SoundRenderer::getInstance().playFx(CoreData::getInstance().getAttentionSound());
} }
soundConnectionCount = currentConnectionCount; soundConnectionCount = currentConnectionCount;
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
if(enableFactionTexturePreview == true) { if(enableFactionTexturePreview == true) {
string factionLogo = Game::findFactionLogoFile(&gameSettings, NULL,"preview_screen.*"); string factionLogo = Game::findFactionLogoFile(&gameSettings, NULL,"preview_screen.*");
if(factionLogo == "") { if(factionLogo == "") {
@@ -1315,6 +1347,9 @@ void MenuStateCustomGame::update() {
} }
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
} }
catch(const std::exception &ex) { catch(const std::exception &ex) {