diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-14 16:49:22 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-14 16:49:22 +0000 |
commit | ab4dee91de96555db158db91240ff91520318068 (patch) | |
tree | 1af96344a9c30466cec7e83ec9283efc9e8413a6 /src/socketengines/socketengine_epoll.cpp | |
parent | f4ddd40badd2eb5181dadc1dcd59d7200738bf24 (diff) |
Keep count of the number of events in total, and seperate read, write and error event counters. We can use this for monitoring of heavy socket engine activity, e.g. a 'stuck' eventhandler
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8933 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socketengines/socketengine_epoll.cpp')
-rw-r--r-- | src/socketengines/socketengine_epoll.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index 34fabdf15..ccfa0f769 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -121,16 +121,20 @@ int EPollEngine::DispatchEvents() int errcode; int i = epoll_wait(EngineHandle, events, MAX_DESCRIPTORS, 1000); + TotalEvents += i; + for (int j = 0; j < i; j++) { if (events[j].events & EPOLLHUP) { + ErrorEvents++; if (ref[events[j].data.fd]) ref[events[j].data.fd]->HandleEvent(EVENT_ERROR, 0); continue; } if (events[j].events & EPOLLERR) { + ErrorEvents++; /* Get error number */ if (getsockopt(events[j].data.fd, SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0) errcode = errno; @@ -140,6 +144,7 @@ int EPollEngine::DispatchEvents() } if (events[j].events & EPOLLOUT) { + WriteEvents++; struct epoll_event ev; memset(&ev,0,sizeof(struct epoll_event)); ev.events = EPOLLIN; @@ -150,6 +155,7 @@ int EPollEngine::DispatchEvents() } else { + ReadEvents++; if (ref[events[j].data.fd]) ref[events[j].data.fd]->HandleEvent(EVENT_READ); } |