*Write update time diff into log to display server performance.
--HG-- branch : trunk
This commit is contained in:
@@ -93,6 +93,7 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
|
|||||||
uint32 maxActiveClientsNum = sWorld.GetMaxActiveSessionCount();
|
uint32 maxActiveClientsNum = sWorld.GetMaxActiveSessionCount();
|
||||||
uint32 maxQueuedClientsNum = sWorld.GetMaxQueuedSessionCount();
|
uint32 maxQueuedClientsNum = sWorld.GetMaxQueuedSessionCount();
|
||||||
std::string str = secsToTimeString(sWorld.GetUptime());
|
std::string str = secsToTimeString(sWorld.GetUptime());
|
||||||
|
uint32 updateTime = sWorld.GetUpdateTime();
|
||||||
|
|
||||||
PSendSysMessage(_FULLVERSION); //char const* full;
|
PSendSysMessage(_FULLVERSION); //char const* full;
|
||||||
//if(m_session)
|
//if(m_session)
|
||||||
@@ -105,6 +106,7 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
|
|||||||
//PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
|
//PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
|
||||||
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
||||||
PSendSysMessage(LANG_UPTIME, str.c_str());
|
PSendSysMessage(LANG_UPTIME, str.c_str());
|
||||||
|
PSendSysMessage("Update time diff: %u.", updateTime);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ World::World()
|
|||||||
|
|
||||||
m_defaultDbcLocale = LOCALE_enUS;
|
m_defaultDbcLocale = LOCALE_enUS;
|
||||||
m_availableDbcLocaleMask = 0;
|
m_availableDbcLocaleMask = 0;
|
||||||
|
|
||||||
|
m_updateTimeSum = 0;
|
||||||
|
m_updateTimeCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// World destructor
|
/// World destructor
|
||||||
@@ -989,6 +992,7 @@ void World::LoadConfigSettings(bool reload)
|
|||||||
m_configs[CONFIG_PVP_TOKEN_COUNT] = 1;
|
m_configs[CONFIG_PVP_TOKEN_COUNT] = 1;
|
||||||
m_configs[CONFIG_NO_RESET_TALENT_COST] = sConfig.GetBoolDefault("NoResetTalentsCost", false);
|
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_SHOW_KICK_IN_WORLD] = sConfig.GetBoolDefault("ShowKickInWorld", false);
|
||||||
|
m_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfig.GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
|
||||||
|
|
||||||
std::string forbiddenmaps = sConfig.GetStringDefault("ForbiddenMaps", "");
|
std::string forbiddenmaps = sConfig.GetStringDefault("ForbiddenMaps", "");
|
||||||
char * forbiddenMaps = new char[forbiddenmaps.length() + 1];
|
char * forbiddenMaps = new char[forbiddenmaps.length() + 1];
|
||||||
@@ -1409,6 +1413,22 @@ void World::DetectDBCLang()
|
|||||||
/// Update the World !
|
/// Update the World !
|
||||||
void World::Update(time_t diff)
|
void World::Update(time_t diff)
|
||||||
{
|
{
|
||||||
|
m_updateTime = uint32(diff);
|
||||||
|
if(m_configs[CONFIG_INTERVAL_LOG_UPDATE])
|
||||||
|
{
|
||||||
|
if(m_updateTimeSum > m_configs[CONFIG_INTERVAL_LOG_UPDATE])
|
||||||
|
{
|
||||||
|
sLog.outString("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
|
||||||
|
m_updateTimeSum = m_updateTime;
|
||||||
|
m_updateTimeCount = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_updateTimeSum += m_updateTime;
|
||||||
|
++m_updateTimeCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///- Update the different timers
|
///- Update the different timers
|
||||||
for(int i = 0; i < WUPDATE_COUNT; i++)
|
for(int i = 0; i < WUPDATE_COUNT; i++)
|
||||||
if(m_timers[i].GetCurrent()>=0)
|
if(m_timers[i].GetCurrent()>=0)
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ enum WorldConfigs
|
|||||||
CONFIG_PVP_TOKEN_COUNT,
|
CONFIG_PVP_TOKEN_COUNT,
|
||||||
CONFIG_NO_RESET_TALENT_COST,
|
CONFIG_NO_RESET_TALENT_COST,
|
||||||
CONFIG_SHOW_KICK_IN_WORLD,
|
CONFIG_SHOW_KICK_IN_WORLD,
|
||||||
|
CONFIG_INTERVAL_LOG_UPDATE,
|
||||||
|
|
||||||
CONFIG_VALUE_COUNT
|
CONFIG_VALUE_COUNT
|
||||||
};
|
};
|
||||||
@@ -407,6 +408,8 @@ class World
|
|||||||
time_t const& GetGameTime() const { return m_gameTime; }
|
time_t const& GetGameTime() const { return m_gameTime; }
|
||||||
/// Uptime (in secs)
|
/// Uptime (in secs)
|
||||||
uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); }
|
uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); }
|
||||||
|
/// Update time
|
||||||
|
uint32 GetUpdateTime() const { return m_updateTime; }
|
||||||
|
|
||||||
/// Get the maximum skill level a player can reach
|
/// Get the maximum skill level a player can reach
|
||||||
uint16 GetConfigMaxSkillValue() const
|
uint16 GetConfigMaxSkillValue() const
|
||||||
@@ -524,6 +527,8 @@ class World
|
|||||||
IntervalTimer m_timers[WUPDATE_COUNT];
|
IntervalTimer m_timers[WUPDATE_COUNT];
|
||||||
uint32 mail_timer;
|
uint32 mail_timer;
|
||||||
uint32 mail_timer_expires;
|
uint32 mail_timer_expires;
|
||||||
|
uint32 m_updateTime, m_updateTimeSum;
|
||||||
|
uint32 m_updateTimeCount;
|
||||||
|
|
||||||
typedef UNORDERED_MAP<uint32, Weather*> WeatherMap;
|
typedef UNORDERED_MAP<uint32, Weather*> WeatherMap;
|
||||||
WeatherMap m_weathers;
|
WeatherMap m_weathers;
|
||||||
|
|||||||
@@ -1257,6 +1257,14 @@ Ra.Secure = 1
|
|||||||
# 1 = Enable
|
# 1 = Enable
|
||||||
# 0 = Disable
|
# 0 = Disable
|
||||||
#
|
#
|
||||||
|
# RecordUpdateTimeDiffInterval
|
||||||
|
# record update time diff to the log file
|
||||||
|
# update diff can be used as a criterion of performance
|
||||||
|
# diff < 300: good performance
|
||||||
|
# diff > 600: bad performance, may be caused by high cpu usage
|
||||||
|
# Default: 60000 (diff is written into log every 60000 ms or 1 minute.
|
||||||
|
# >0 = Interval
|
||||||
|
# 0 = Disable
|
||||||
###################################################################################################################
|
###################################################################################################################
|
||||||
|
|
||||||
PlayerStart.AllReputation = 0
|
PlayerStart.AllReputation = 0
|
||||||
@@ -1271,3 +1279,4 @@ PvPToken.ItemID = 29434
|
|||||||
PvPToken.ItemCount = 1
|
PvPToken.ItemCount = 1
|
||||||
NoResetTalentsCost = 0
|
NoResetTalentsCost = 0
|
||||||
ShowKickInWorld = 0
|
ShowKickInWorld = 0
|
||||||
|
RecordUpdateTimeDiffInterval = 60000
|
||||||
|
|||||||
Reference in New Issue
Block a user