ioloop添加调试信息
This commit is contained in:
parent
6770f48291
commit
a369c48411
11
a8/ioloop.cc
11
a8/ioloop.cc
@ -133,17 +133,21 @@ namespace a8
|
||||
a8::EpollEventHandler* handler = (a8::EpollEventHandler*)events[i].data.ptr;
|
||||
if (events[i].events & EPOLLOUT) {
|
||||
handler->DoSend();
|
||||
++send_times;
|
||||
}
|
||||
if (events[i].events & EPOLLIN) {
|
||||
handler->DoRecv();
|
||||
++recv_times;
|
||||
}
|
||||
if (events[i].events & EPOLLRDHUP ||
|
||||
events[i].events & EPOLLHUP ||
|
||||
events[i].events & EPOLLERR
|
||||
) {
|
||||
handler->DoError();
|
||||
++error_times;
|
||||
}
|
||||
}
|
||||
++run_times;
|
||||
}
|
||||
ProcessIMMsg(context);
|
||||
delete [] events;
|
||||
@ -176,25 +180,30 @@ namespace a8
|
||||
case kFreeClient:
|
||||
{
|
||||
_IMFreeClient(context, param);
|
||||
++free_times;
|
||||
}
|
||||
break;
|
||||
case kShutdown:
|
||||
{
|
||||
_IMShutdown(context, param);
|
||||
++shutdown_times;
|
||||
}
|
||||
break;
|
||||
case kAsyncConnect:
|
||||
{
|
||||
_IMAsyncConnect(context, param);
|
||||
++connect_times;
|
||||
}
|
||||
break;
|
||||
case kAsyncClose:
|
||||
{
|
||||
_IMAsyncClose(context, param);
|
||||
++close_times;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
++immsg_times;
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,12 +212,14 @@ namespace a8
|
||||
#ifdef DEBUG
|
||||
a8::UdpLog::Instance()->Info("OnEvent %d", {data});
|
||||
#endif
|
||||
++event_times;
|
||||
}
|
||||
|
||||
void IoLoop::OnTimer(void* context, unsigned long long data)
|
||||
{
|
||||
IoLoopThreadContext* thread_context = (IoLoopThreadContext*)context;
|
||||
++thread_context->tick;
|
||||
++timer_times;
|
||||
#ifdef DEBUG
|
||||
a8::UdpLog::Instance()->Info("OnTimer %d", {data});
|
||||
#endif
|
||||
|
13
a8/ioloop.h
13
a8/ioloop.h
@ -15,6 +15,19 @@ namespace a8
|
||||
IoLoop() {};
|
||||
friend class a8::Singleton<IoLoop>;
|
||||
|
||||
public:
|
||||
std::atomic<long long> run_times = {0};
|
||||
std::atomic<long long> timer_times = {0};
|
||||
std::atomic<long long> event_times = {0};
|
||||
std::atomic<long long> free_times = {0};
|
||||
std::atomic<long long> shutdown_times = {0};
|
||||
std::atomic<long long> connect_times = {0};
|
||||
std::atomic<long long> close_times = {0};
|
||||
std::atomic<long long> send_times = {0};
|
||||
std::atomic<long long> recv_times = {0};
|
||||
std::atomic<long long> error_times = {0};
|
||||
std::atomic<long long> immsg_times = {0};
|
||||
|
||||
public:
|
||||
void Init(int thread_num);
|
||||
void UnInit();
|
||||
|
Loading…
x
Reference in New Issue
Block a user