From: Andy D. <kha...@us...> - 2005-06-21 18:39:47
|
Update of /cvsroot/planeshift/planeshift/src/server/bulkobjects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26053/server/bulkobjects Modified Files: pscharacter.cpp pscharacterloader.cpp Log Message: Added messages to debug the cause of slow NPC respawning. Index: pscharacter.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/pscharacter.cpp,v retrieving revision 1.231 retrieving revision 1.232 diff -C2 -d -r1.231 -r1.232 *** pscharacter.cpp 17 Jun 2005 14:10:02 -0000 1.231 --- pscharacter.cpp 21 Jun 2005 13:59:57 -0000 1.232 *************** *** 1027,1030 **** --- 1027,1031 ---- bool psCharacter::Load(iResultRow& row) { + csTicks start = csGetTicks(); // TODO: Link in account ID? SetCharacterID(row.GetInt("id")); *************** *** 1087,1090 **** --- 1088,1099 ---- spawn_loc = location; + if(csGetTicks() - start > 300) + { + csString status; + status.Format("Warning: Stage 1 so far spent %u time loading character ID", + csGetTicks() - start); + psserver->GetLogCSV()->Write(CSV_STATUS, status); + } + // NPC fields here npc_spawnruleid = row.GetUInt32("npc_spawn_rule"); *************** *** 1133,1136 **** --- 1142,1152 ---- } + if(csGetTicks() - start > 300) + { + csString status; + status.Format("Warning: Stage 2 so far spent %u time loading character ID", + csGetTicks() - start); + psserver->GetLogCSV()->Write(CSV_STATUS, status); + } inventory.Load(); if (npc_masterid && use_id != npc_masterid) *************** *** 1195,1199 **** return false; } ! return true; } --- 1211,1221 ---- return false; } ! if(csGetTicks() - start > 300) ! { ! csString status; ! status.Format("Warning: Stage 3 so far spent %u time loading character ID", ! csGetTicks() - start); ! psserver->GetLogCSV()->Write(CSV_STATUS, status); ! } return true; } *************** *** 1337,1342 **** } - - void psCharacter::SetCharacterID(const unsigned int characterID) { --- 1359,1362 ---- Index: pscharacterloader.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/pscharacterloader.cpp,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** pscharacterloader.cpp 17 Jun 2005 14:10:03 -0000 1.93 --- pscharacterloader.cpp 21 Jun 2005 13:59:58 -0000 1.94 *************** *** 281,284 **** --- 281,286 ---- psCharacter *psCharacterLoader::LoadCharacterData(unsigned int uid) { + csTicks start = csGetTicks(); + psCharacter *chardata; Result result(db->Select("SELECT * from characters where id=%u",uid)); *************** *** 306,313 **** --- 308,330 ---- if (!chardata->Load(result[0])) { + if(csGetTicks() - start > 500) + { + csString status; + status.Format("Warning: Spent %u time loading FAILED character ID %u", + csGetTicks() - start, uid); + psserver->GetLogCSV()->Write(CSV_STATUS, status); + } Error2("Load failed for character ID %u.",uid); delete chardata; return NULL; } + if(csGetTicks() - start > 500) + { + csString status; + status.Format("Warning: Spent %u time loading character ID %u", + csGetTicks() - start, uid); + psserver->GetLogCSV()->Write(CSV_STATUS, status); + } + return chardata; } |