Added uptime stat in admin irc.

This commit is contained in:
lotodore
2007-11-28 23:31:34 +00:00
parent a71fda5ec2
commit e0b6e16994
3 changed files with 18 additions and 2 deletions
+7 -1
View File
@@ -69,7 +69,7 @@ private:
ServerLobbyThread::ServerLobbyThread(GuiInterface &gui, ConfigFile *playerConfig, AvatarManager &avatarManager)
: m_gui(gui), m_avatarManager(avatarManager), m_playerConfig(playerConfig),
m_curGameId(0), m_curUniquePlayerId(0), m_curSessionId(INVALID_SESSION + 1),
m_statDataChanged(false)
m_statDataChanged(false), m_startTime(boost::posix_time::second_clock::local_time())
{
m_senderCallback.reset(new ServerSenderCallback(*this));
m_sender.reset(new SenderThread(GetSenderCallback()));
@@ -273,6 +273,12 @@ ServerLobbyThread::GetStats() const
return m_statData;
}
boost::posix_time::ptime
ServerLobbyThread::GetStartTime() const
{
return m_startTime;
}
u_int32_t
ServerLobbyThread::GetNextUniquePlayerId()
{
+7
View File
@@ -111,6 +111,13 @@ ServerManager::SignalIrcChatMsg(const std::string &nickName, const std::string &
else if (command == "stat")
{
ServerStats tmpStats = GetLobbyThread().GetStats();
boost::posix_time::ptime curTime(boost::posix_time::second_clock::local_time());
{
ostringstream statStream;
statStream
<< "Server uptime................ " << curTime - GetLobbyThread().GetStartTime();
m_ircThread->SendChatMessage(statStream.str());
}
{
ostringstream statStream;
statStream
+4 -1
View File
@@ -29,6 +29,7 @@
#include <deque>
#include <list>
#include <boost/date_time.hpp>
#include <core/boost/timers.hpp>
#define NET_LOBBY_THREAD_TERMINATE_TIMEOUT_MSEC 20000
@@ -80,6 +81,7 @@ public:
AvatarManager &GetAvatarManager();
ServerStats GetStats() const;
boost::posix_time::ptime GetStartTime() const;
SenderThread &GetSender();
@@ -198,7 +200,8 @@ private:
boost::timers::portable::microsec_timer m_cacheCleanupTimer;
boost::timers::portable::microsec_timer m_saveStatisticsTimer;
boost::timers::portable::microsec_timer m_uptimeTimer;
const boost::posix_time::ptime m_startTime;
};
#endif