From ab4dee91de96555db158db91240ff91520318068 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 14 Feb 2008 16:49:22 +0000 Subject: 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 --- src/socketengines/socketengine_epoll.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/socketengines/socketengine_epoll.cpp') 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); } -- cgit v1.2.3