diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-02-08 22:40:30 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-02-08 22:40:30 +0100 |
commit | 689996cb8856af43a033eb5ca1cb9df7475c0854 (patch) | |
tree | 258bbb81046a8cefe49a65d4f15ea36779352261 /src/socketengines | |
parent | aea38a0dd702895b7dfd18efd26a0dcead2279fc (diff) |
Move socketengine stats into a new class
Diffstat (limited to 'src/socketengines')
-rw-r--r-- | src/socketengines/socketengine_epoll.cpp | 10 | ||||
-rw-r--r-- | src/socketengines/socketengine_kqueue.cpp | 8 | ||||
-rw-r--r-- | src/socketengines/socketengine_ports.cpp | 6 | ||||
-rw-r--r-- | src/socketengines/socketengine_select.cpp | 6 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index 7ee01b2cc..39cc60606 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -185,7 +185,7 @@ int EPollEngine::DispatchEvents() int i = epoll_wait(EngineHandle, &events[0], events.size(), 1000); ServerInstance->UpdateTime(); - TotalEvents += i; + stats.TotalEvents += i; for (int j = 0; j < i; j++) { @@ -202,14 +202,14 @@ int EPollEngine::DispatchEvents() if (ev.events & EPOLLHUP) { - ErrorEvents++; + stats.ErrorEvents++; eh->HandleEvent(EVENT_ERROR, 0); continue; } if (ev.events & EPOLLERR) { - ErrorEvents++; + stats.ErrorEvents++; /* Get error number */ socklen_t codesize = sizeof(int); int errcode; @@ -235,7 +235,7 @@ int EPollEngine::DispatchEvents() SetEventMask(eh, mask); if (ev.events & EPOLLIN) { - ReadEvents++; + stats.ReadEvents++; eh->HandleEvent(EVENT_READ); if (eh != GetRef(ev.data.fd)) // whoa! we got deleted, better not give out the write event @@ -243,7 +243,7 @@ int EPollEngine::DispatchEvents() } if (ev.events & EPOLLOUT) { - WriteEvents++; + stats.WriteEvents++; eh->HandleEvent(EVENT_WRITE); } } diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index c51789b29..0a9a0a399 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -207,7 +207,7 @@ int KQueueEngine::DispatchEvents() if (i < 0) return i; - TotalEvents += i; + stats.TotalEvents += i; for (int j = 0; j < i; j++) { @@ -223,13 +223,13 @@ int KQueueEngine::DispatchEvents() if (kev.flags & EV_EOF) { - ErrorEvents++; + stats.ErrorEvents++; eh->HandleEvent(EVENT_ERROR, kev.fflags); continue; } if (filter == EVFILT_WRITE) { - WriteEvents++; + stats.WriteEvents++; /* When mask is FD_WANT_FAST_WRITE or FD_WANT_SINGLE_WRITE, * we set a one-shot write, so we need to clear that bit * to detect when it set again. @@ -240,7 +240,7 @@ int KQueueEngine::DispatchEvents() } else if (filter == EVFILT_READ) { - ReadEvents++; + stats.ReadEvents++; SetEventMask(eh, eh->GetEventMask() & ~FD_READ_WILL_BLOCK); eh->HandleEvent(EVENT_READ); } diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp index 226f59f04..e1fcc0e6c 100644 --- a/src/socketengines/socketengine_ports.cpp +++ b/src/socketengines/socketengine_ports.cpp @@ -148,7 +148,7 @@ int PortsEngine::DispatchEvents() if (ret == -1) return -1; - TotalEvents += nget; + stats.TotalEvents += nget; unsigned int i; for (i = 0; i < nget; i++) @@ -175,14 +175,14 @@ int PortsEngine::DispatchEvents() port_associate(EngineHandle, PORT_SOURCE_FD, fd, mask_to_events(mask), eh); if (portev_events & POLLRDNORM) { - ReadEvents++; + stats.ReadEvents++; eh->HandleEvent(EVENT_READ); if (eh != GetRef(fd)) continue; } if (portev_events & POLLWRNORM) { - WriteEvents++; + stats.WriteEvents++; eh->HandleEvent(EVENT_WRITE); } } diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp index 7aaa7aaf7..be380cb46 100644 --- a/src/socketengines/socketengine_select.cpp +++ b/src/socketengines/socketengine_select.cpp @@ -135,7 +135,7 @@ int SelectEngine::DispatchEvents() if (has_error) { - ErrorEvents++; + stats.ErrorEvents++; socklen_t codesize = sizeof(int); int errcode = 0; @@ -148,7 +148,7 @@ int SelectEngine::DispatchEvents() if (has_read) { - ReadEvents++; + stats.ReadEvents++; SetEventMask(ev, ev->GetEventMask() & ~FD_READ_WILL_BLOCK); ev->HandleEvent(EVENT_READ); if (ev != GetRef(i)) @@ -157,7 +157,7 @@ int SelectEngine::DispatchEvents() if (has_write) { - WriteEvents++; + stats.WriteEvents++; int newmask = (ev->GetEventMask() & ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE)); this->OnSetEvent(ev, ev->GetEventMask(), newmask); SetEventMask(ev, newmask); |