Use default member initializers in WORKER_STATISTICS
Makes the class simpler and removes the need for an explicit constructor. Also switched to std::array to enable easy iteration over the array.
This commit is contained in:
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <maxbase/ccdefs.hh>
|
#include <maxbase/ccdefs.hh>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -33,33 +34,29 @@ namespace maxbase
|
|||||||
|
|
||||||
struct WORKER_STATISTICS
|
struct WORKER_STATISTICS
|
||||||
{
|
{
|
||||||
WORKER_STATISTICS()
|
|
||||||
{
|
|
||||||
memset(this, 0, sizeof(WORKER_STATISTICS));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MAXNFDS = 10,
|
MAXNFDS = 10,
|
||||||
N_QUEUE_TIMES = 30
|
N_QUEUE_TIMES = 30
|
||||||
};
|
};
|
||||||
|
|
||||||
int64_t n_read; /*< Number of read events */
|
int64_t n_read = 0; /*< Number of read events */
|
||||||
int64_t n_write; /*< Number of write events */
|
int64_t n_write = 0; /*< Number of write events */
|
||||||
int64_t n_error; /*< Number of error events */
|
int64_t n_error = 0; /*< Number of error events */
|
||||||
int64_t n_hup; /*< Number of hangup events */
|
int64_t n_hup = 0; /*< Number of hangup events */
|
||||||
int64_t n_accept; /*< Number of accept events */
|
int64_t n_accept = 0; /*< Number of accept events */
|
||||||
int64_t n_polls; /*< Number of poll cycles */
|
int64_t n_polls = 0; /*< Number of poll cycles */
|
||||||
int64_t n_pollev; /*< Number of polls returning events */
|
int64_t n_pollev = 0; /*< Number of polls returning events */
|
||||||
int64_t n_nbpollev; /*< Number of polls returning events */
|
int64_t n_nbpollev = 0; /*< Number of polls returning events */
|
||||||
int64_t n_fds[MAXNFDS]; /*< Number of wakeups with particular n_fds value */
|
int64_t evq_avg = 0; /*< Average event queue length */
|
||||||
int64_t evq_avg; /*< Average event queue length */
|
int64_t evq_max = 0; /*< Maximum event queue length */
|
||||||
int64_t evq_max; /*< Maximum event queue length */
|
int64_t blockingpolls = 0; /*< Number of epoll_waits with a timeout
|
||||||
int64_t blockingpolls; /*< Number of epoll_waits with a timeout specified */
|
* specified */
|
||||||
uint32_t qtimes[N_QUEUE_TIMES + 1];
|
int64_t maxqtime = 0;
|
||||||
uint32_t exectimes[N_QUEUE_TIMES + 1];
|
int64_t maxexectime = 0;
|
||||||
int64_t maxqtime;
|
std::array<int64_t, MAXNFDS> n_fds {}; /*< Number of wakeups with particular n_fds value */
|
||||||
int64_t maxexectime;
|
std::array<uint32_t, N_QUEUE_TIMES + 1> qtimes {};
|
||||||
|
std::array<uint32_t, N_QUEUE_TIMES + 1> exectimes {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user