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