Files

88 lines
3.0 KiB
C++

/**
* @file include/ActivMiddleware/ActivFramework/KernelBypass/Statistics.h
*
* @brief Header file for Kernel Bypass statistics.
*/
#if (!defined ACTIV_FRAMEWORK_KERNEL_BYPASS_STATISTICS_H)
#define ACTIV_FRAMEWORK_KERNEL_BYPASS_STATISTICS_H
#include "ActivMiddleware/ActivFramework/External.h"
#include "ActivMiddleware/ActivBase/FieldTypes/DateTime.h"
#include "ActivMiddleware/ActivFramework/KernelBypass/Mode.h"
#include "ActivMiddleware/CxxYZ/functional.h"
//! Activ namespace.
namespace Activ
{
//! KernelBypass namespace.
namespace KernelBypass
{
//! Statistics class.
class Statistics
{
public:
//! Constructor.
Statistics();
//! Clear all statistics.
void Reset();
size_t m_totalPackets; ///< Total number of packets received on this virtual interface.
size_t m_totalBytes; ///< Total number of bytes received on this virtual interface.
size_t m_udpPackets; ///< Number of IPV4 UDP packets received on this virtual interface.
size_t m_udpBytes; ///< Number of IPV4 UDP bytes received on this virtual interface.
size_t m_filteredPackets; ///< Number of packets received matching a filter on this virtual interface.
size_t m_filteredBytes; ///< Number of bytes received matching a filter on this virtual interface.
size_t m_processingErrors; ///< Number of network stack processing errors on this virtual interface.
size_t m_peakQueuedPackets; ///< Peak number of queued packets since reset.
DateTime m_peakQueuedPacketsDateTime; ///< The date and time that the peak queued packets occurred.
uint32_t m_processEventLoops; ///< Process event loop counter.
//! Number of fragmented packets received on this virtual interface. NOTE: fragmented packets are not currently supported.
size_t m_fragmentedPackets;
};
// ---------------------------------------------------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------------------------------------------
inline Statistics::Statistics()
{
Reset();
}
// ---------------------------------------------------------------------------------------------------------------------------------
inline void Statistics::Reset()
{
m_totalPackets = 0;
m_totalBytes = 0;
m_udpPackets = 0;
m_udpBytes = 0;
m_filteredPackets = 0;
m_filteredBytes = 0;
m_processingErrors = 0;
m_peakQueuedPackets = 0;
m_peakQueuedPacketsDateTime.Reset();
m_fragmentedPackets = 0;
m_processEventLoops = 0;
}
// ---------------------------------------------------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------------------------------------------
//! Statistics callback function definition.
typedef CxxYZ::function<void(const Mode, const String &, const Statistics &, const uint64_t)> StatisticsLogCallback;
} // namespace KernelBypass
} // namespace Activ
#endif // (!defined ACTIV_FRAMEWORK_KERNEL_BYPASS_STATISTICS_H)