添加性能监控日志
This commit is contained in:
parent
8f289ea48f
commit
2408f952be
@ -5,37 +5,44 @@
|
||||
|
||||
#include "perfmonitor.h"
|
||||
#include "app.h"
|
||||
#include "playermgr.h"
|
||||
#include "dbhelper.h"
|
||||
|
||||
static void SavePerfLog()
|
||||
{
|
||||
a8::UdpLog::Instance()->Info(" max_run_delay_time:%d max_timer_idle:%d "
|
||||
"in_data_size:%d out_data_size:%d msgnode_size:%d read_count:%d max_login_time:%d "
|
||||
"max_join_time:%d",
|
||||
{
|
||||
PerfMonitor::Instance()->max_run_delay_time,
|
||||
PerfMonitor::Instance()->max_timer_idle,
|
||||
PerfMonitor::Instance()->in_data_size,
|
||||
PerfMonitor::Instance()->out_data_size,
|
||||
App::Instance()->msgnode_size_,
|
||||
PerfMonitor::Instance()->read_count,
|
||||
PerfMonitor::Instance()->max_login_time,
|
||||
});
|
||||
a8::UdpLog::Instance()->Info(" run_times:%d timer_times:%d event_times:%d free_times:%d "
|
||||
" shutdown_times:%d connect_times:%d close_times:%d "
|
||||
" send_times:%d recv_times:%d error_times:%d immsg_times:%d",
|
||||
{
|
||||
(long long)a8::IoLoop::Instance()->run_times,
|
||||
(long long)a8::IoLoop::Instance()->timer_times,
|
||||
(long long)a8::IoLoop::Instance()->event_times,
|
||||
(long long)a8::IoLoop::Instance()->free_times,
|
||||
(long long)a8::IoLoop::Instance()->shutdown_times,
|
||||
(long long)a8::IoLoop::Instance()->connect_times,
|
||||
(long long)a8::IoLoop::Instance()->close_times,
|
||||
(long long)a8::IoLoop::Instance()->send_times,
|
||||
(long long)a8::IoLoop::Instance()->recv_times,
|
||||
(long long)a8::IoLoop::Instance()->error_times,
|
||||
(long long)a8::IoLoop::Instance()->immsg_times
|
||||
});
|
||||
a8::UdpLog::Instance()->Info
|
||||
("max_run_delay_time:%d max_timer_idle:%d "
|
||||
"in_data_size:%d out_data_size:%d msgnode_size:%d read_count:%d max_login_time:%d "
|
||||
"max_join_time:%d online_num:%d watch_num:%d cache_users_num:%d ",
|
||||
{
|
||||
PerfMonitor::Instance()->max_run_delay_time,
|
||||
PerfMonitor::Instance()->max_timer_idle,
|
||||
PerfMonitor::Instance()->in_data_size,
|
||||
PerfMonitor::Instance()->out_data_size,
|
||||
App::Instance()->msgnode_size_,
|
||||
PerfMonitor::Instance()->read_count,
|
||||
PerfMonitor::Instance()->max_login_time,
|
||||
PlayerMgr::Instance()->OnlineNum(),
|
||||
PlayerMgr::Instance()->WatchPlayerNum(),
|
||||
DBHelper::Instance()->cache_users_hash.size()
|
||||
});
|
||||
a8::UdpLog::Instance()->Info
|
||||
("run_times:%d timer_times:%d event_times:%d free_times:%d "
|
||||
"shutdown_times:%d connect_times:%d close_times:%d "
|
||||
"send_times:%d recv_times:%d error_times:%d immsg_times:%d",
|
||||
{
|
||||
(long long)a8::IoLoop::Instance()->run_times,
|
||||
(long long)a8::IoLoop::Instance()->timer_times,
|
||||
(long long)a8::IoLoop::Instance()->event_times,
|
||||
(long long)a8::IoLoop::Instance()->free_times,
|
||||
(long long)a8::IoLoop::Instance()->shutdown_times,
|
||||
(long long)a8::IoLoop::Instance()->connect_times,
|
||||
(long long)a8::IoLoop::Instance()->close_times,
|
||||
(long long)a8::IoLoop::Instance()->send_times,
|
||||
(long long)a8::IoLoop::Instance()->recv_times,
|
||||
(long long)a8::IoLoop::Instance()->error_times,
|
||||
(long long)a8::IoLoop::Instance()->immsg_times
|
||||
});
|
||||
PerfMonitor::Instance()->max_run_delay_time = 0;
|
||||
PerfMonitor::Instance()->max_timer_idle = 0;
|
||||
PerfMonitor::Instance()->max_login_time = 0;
|
||||
|
@ -237,6 +237,11 @@ int PlayerMgr::OnlineNum()
|
||||
return socket_hash_.size();
|
||||
}
|
||||
|
||||
int PlayerMgr::WatchPlayerNum()
|
||||
{
|
||||
return watch_players_.size();
|
||||
}
|
||||
|
||||
void PlayerMgr::Update(long long tick)
|
||||
{
|
||||
for (auto& pair : accountid_hash_) {
|
||||
|
@ -62,6 +62,7 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
|
||||
void WatchPlayer(Friend* friend_data);
|
||||
void UnWatchPlayer(Friend* friend_data);
|
||||
int OnlineNum();
|
||||
int WatchPlayerNum();
|
||||
void Update(long long tick);
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user