*Add config option MinRecordUpdateTimeDiff to prevent timediff spams.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-08 14:57:46 -06:00
parent 4296a32f60
commit b57516e170
4 changed files with 19 additions and 8 deletions

View File

@@ -259,6 +259,7 @@ MapManager::Update(time_t diff)
}
ObjectAccessor::Instance().Update(i_timer.GetCurrent());
sWorld.RecordTimeDiff("UpdateObjectAccessor");
for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
(*iter)->Update(i_timer.GetCurrent());
sWorld.RecordTimeDiff("UpdateTransports");

View File

@@ -998,6 +998,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_NO_RESET_TALENT_COST] = sConfig.GetBoolDefault("NoResetTalentsCost", false);
m_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfig.GetBoolDefault("ShowKickInWorld", false);
m_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfig.GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
m_configs[CONFIG_MIN_LOG_UPDATE] = sConfig.GetIntDefault("MinRecordUpdateTimeDiff", 10);
std::string forbiddenmaps = sConfig.GetStringDefault("ForbiddenMaps", "");
char * forbiddenMaps = new char[forbiddenmaps.length() + 1];
@@ -1428,14 +1429,18 @@ void World::RecordTimeDiff(const char *text, ...)
return;
}
uint32 thisTime = getMSTime();
uint32 thisTime = getMSTime();
uint32 diff = getMSTimeDiff(m_currentTime, thisTime);
va_list ap;
char str [256];
va_start(ap, text);
vsnprintf(str,256,text, ap );
va_end(ap);
sLog.outDetail("Difftime %s: %u.", str, getMSTimeDiff(m_currentTime, thisTime));
if(diff > m_configs[CONFIG_MIN_LOG_UPDATE])
{
va_list ap;
char str [256];
va_start(ap, text);
vsnprintf(str,256,text, ap );
va_end(ap);
sLog.outDetail("Difftime %s: %u.", str, diff);
}
m_currentTime = thisTime;
}

View File

@@ -197,6 +197,7 @@ enum WorldConfigs
CONFIG_NO_RESET_TALENT_COST,
CONFIG_SHOW_KICK_IN_WORLD,
CONFIG_INTERVAL_LOG_UPDATE,
CONFIG_MIN_LOG_UPDATE,
CONFIG_ENABLE_SINFO_LOGIN,
CONFIG_VALUE_COUNT

View File

@@ -1265,6 +1265,9 @@ Ra.Secure = 1
# >0 = Interval
# 0 = Disable
#
# MinRecordUpdateTimeDiff
# only record update time diff which is greater than this value
#
# PlayerStart.String
# If set to anything else than "", this string will be displayed to players when they login
# to a newly created character.
@@ -1285,4 +1288,5 @@ PvPToken.ItemCount = 1
NoResetTalentsCost = 0
ShowKickInWorld = 0
RecordUpdateTimeDiffInterval = 60000
PlayerStart.String = ""
MinRecordUpdateTimeDiff = 10
PlayerStart.String = ""