This commit is contained in:
aozhiwei 2019-12-06 17:57:01 +08:00
parent b7aae72085
commit 91cd2a33ec
3 changed files with 10 additions and 1 deletions

View File

@ -54,7 +54,7 @@ const char* const PROJ_LOG_FILENAME_FMT = "log_$pid_%Y%m%d.log";
static void SavePerfLog() static void SavePerfLog()
{ {
a8::UdpLog::Instance()->Info(" max_run_delay_time:%d max_timer_idle:%d " 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", "in_data_size:%d out_data_size:%d msgnode_size:%d read_count:%d max_login_time:%d",
{ {
App::Instance()->perf.max_run_delay_time, App::Instance()->perf.max_run_delay_time,
App::Instance()->perf.max_timer_idle, App::Instance()->perf.max_timer_idle,
@ -62,6 +62,7 @@ static void SavePerfLog()
App::Instance()->perf.out_data_size, App::Instance()->perf.out_data_size,
App::Instance()->msgnode_size_, App::Instance()->msgnode_size_,
App::Instance()->perf.read_count, App::Instance()->perf.read_count,
App::Instance()->perf.max_login_time,
}); });
if (App::Instance()->HasFlag(2)) { if (App::Instance()->HasFlag(2)) {
a8::XPrintf("mainloop_time:%d netmsg_time:%d send_node_num:%d sent_bytes_num:%d\n", a8::XPrintf("mainloop_time:%d netmsg_time:%d send_node_num:%d sent_bytes_num:%d\n",
@ -75,6 +76,7 @@ static void SavePerfLog()
#if 1 #if 1
App::Instance()->perf.max_run_delay_time = 0; App::Instance()->perf.max_run_delay_time = 0;
App::Instance()->perf.max_timer_idle = 0; App::Instance()->perf.max_timer_idle = 0;
App::Instance()->perf.max_login_time = 0;
#else #else
App::Instance()->perf = PerfMonitor(); App::Instance()->perf = PerfMonitor();
#endif #endif

View File

@ -56,6 +56,11 @@ void MasterSvrMgr::_SS_MS_ResponseTargetServer(f8::MsgHdr& hdr, const ss::SS_MS_
auto_free = false; auto_free = false;
conn->ForwardClientMsgEx(context_hdr); conn->ForwardClientMsgEx(context_hdr);
} }
long long req_tick = (long long)hdr.hum;
long long req_handle_time = a8::XGetTickCount() - req_tick;
if (req_handle_time > App::Instance()->perf.max_login_time) {
App::Instance()->perf.max_login_time = req_handle_time;
}
} }
RemoveRequest(socket_handle, msg.context_id(), auto_free); RemoveRequest(socket_handle, msg.context_id(), auto_free);
} }
@ -93,6 +98,7 @@ void MasterSvrMgr::RequestTargetServer(f8::MsgHdr& hdr, const std::string& team_
a8::TimerAttacher* timer_attacher = new a8::TimerAttacher(); a8::TimerAttacher* timer_attacher = new a8::TimerAttacher();
f8::MsgHdr* new_hdr = hdr.Clone(); f8::MsgHdr* new_hdr = hdr.Clone();
new_hdr->user_data = timer_attacher; new_hdr->user_data = timer_attacher;
new_hdr->hum = (Player*)a8::XGetTickCount();
ss::SS_WSP_RequestTargetServer msg; ss::SS_WSP_RequestTargetServer msg;
msg.set_context_id(curr_context_id_); msg.set_context_id(curr_context_id_);

View File

@ -5,6 +5,7 @@ struct PerfMonitor
int max_run_delay_time = 0; int max_run_delay_time = 0;
int max_dispatchmsg_time = 0; int max_dispatchmsg_time = 0;
int max_timer_idle = 0; int max_timer_idle = 0;
int max_login_time = 0;
long long out_data_size = 0; long long out_data_size = 0;
long long in_data_size = 0; long long in_data_size = 0;
long long read_count = 0; long long read_count = 0;