This commit is contained in:
aozhiwei 2019-05-22 17:54:20 +08:00
parent 1568015fee
commit 193d1454b9
2 changed files with 19 additions and 2 deletions

View File

@ -58,7 +58,15 @@ static void SavePerfLog()
App::Instance()->perf.max_run_delay_time,
RoomMgr::Instance()->RoomNum()
});
a8::XPrintf("max_mainloop_rundelay:%d max_dispatchmsg_time:%d room_num:%d player_num:%d\n",
{
App::Instance()->perf.max_run_delay_time,
App::Instance()->perf.max_dispatchmsg_time,
RoomMgr::Instance()->RoomNum(),
PlayerMgr::Instance()->GetPlayerNum()
});
App::Instance()->perf.max_run_delay_time = 0;
App::Instance()->perf.max_dispatchmsg_time = 0;
App::Instance()->perf.max_timer_idle = 0;
f8::HttpClientPool::Instance()->max_request_delay = 0;
}
@ -291,7 +299,9 @@ bool App::HasTask()
void App::DispatchMsg()
{
long long starttick = a8::XGetTickCount();
#ifdef PERFT
long long begin_tick = a8::XGetTickCount();
#endif
if (!work_node_ && top_node_) {
msg_mutex_->lock();
work_node_ = top_node_;
@ -324,7 +334,7 @@ void App::DispatchMsg()
}
free(pdelnode);
working_msgnode_size_--;
if (a8::XGetTickCount() - starttick > 200) {
if (a8::XGetTickCount() - begin_tick > 200) {
break;
}
}//end while
@ -332,6 +342,12 @@ void App::DispatchMsg()
if (!work_node_) {
working_msgnode_size_ = 0;
}
#ifdef PERFT
a8::tick_t end_tick = a8::XGetTickCount();
if (end_tick - begin_tick > perf.max_dispatchmsg_time) {
perf.max_dispatchmsg_time = end_tick - begin_tick;
}
#endif
}
void App::ProcessGameGateMsg(f8::MsgHdr& hdr)

View File

@ -3,6 +3,7 @@
struct PerfMonitor
{
int max_run_delay_time = 0;
int max_dispatchmsg_time = 0;
int max_timer_idle = 0;
long long out_data_size = 0;
long long in_data_size = 0;