dpdkstat: enable a plugin for DPDK stats
This patch enables support to retrieve statistics for DPDK
interfaces. An overview of the threading is as follows:
1. collectd init() or read() calls dpdk_helper_spawn() to retrieve
the required size of xstats to allocate.
1.1. DPDK counts ports, stats and length, writing them to
shared-memory (SHM).
1.2. DPDK helper (secondary) process quits, allowing cleanup of
the shared memory.
2. collectd resizes shared-memory to size of stats as provided by
DPDK.
3. collectd respawns the DPDK helper.
3.1. Helper blocks on a semaphore until told to read the stats
from DPDK and write them to SHM.
4. collectd dispatches statistics
4.1. Thread blocks on semaphore until stats are available.
This threading model is required to allow the plugin to detect when
the DPDK primary process/application has been killed/reset, and to avoid
the plugin from stopping another DPDK primary process from starting.
Some extra housekeeping is in place to ensure collectd is never
stalled by using sem_timedwait() with a timeout. If collectd dies, the
helper process will automatically quit after a timeout, as it detects
its ppid has changed.
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>