NebulaStream  0.6.213
NebulaStream is a data and application management framework for the internet of things
NES::Monitoring::CpuMetricsWrapper Class Reference

Wrapper class to represent a tuple buffer with multiple CpuMetrics objects. More...

#include <CpuMetricsWrapper.hpp>

Public Member Functions

 CpuMetricsWrapper ()
 
 CpuMetricsWrapper (uint64_t nodeId)
 
 CpuMetricsWrapper (std::vector< CpuMetrics > &&arr)
 
void writeToBuffer (Runtime::TupleBuffer &buf, uint64_t tupleIndex) const
 Writes a wrapper object to a given TupleBuffer. More...
 
void readFromBuffer (Runtime::TupleBuffer &buf, uint64_t tupleIndex)
 Parses a wrapper object from a given TupleBuffer. More...
 
CpuMetrics getValue (unsigned int cpuCore) const
 Returns the cpu metrics for a given core. More...
 
uint64_t size () const
 The number of CPU metrics contained in the wrapper. The number is equivalent to the number of cores + 1. More...
 
CpuMetrics getTotal () const
 The summarized stats over all CPU metrics. This metric is equivalent to the 0th element of the list. More...
 
WorkerId getNodeId () const
 
void setNodeId (WorkerId nodeId)
 
nlohmann::json toJson () const
 Returns the metrics as json. More...
 
bool operator== (const CpuMetricsWrapper &rhs) const
 
bool operator!= (const CpuMetricsWrapper &rhs) const
 

Detailed Description

Wrapper class to represent a tuple buffer with multiple CpuMetrics objects.

Constructor & Destructor Documentation

◆ CpuMetricsWrapper() [1/3]

NES::Monitoring::CpuMetricsWrapper::CpuMetricsWrapper ( )

Default Ctor for CpuMetricsWrapper with timestamp=0.

Referenced by readFromBuffer().

Here is the caller graph for this function:

◆ CpuMetricsWrapper() [2/3]

NES::Monitoring::CpuMetricsWrapper::CpuMetricsWrapper ( uint64_t  nodeId)
explicit

Ctor for CpuMetricsWrapper with a nodeId.

Parameters
nodeId

◆ CpuMetricsWrapper() [3/3]

NES::Monitoring::CpuMetricsWrapper::CpuMetricsWrapper ( std::vector< CpuMetrics > &&  arr)
explicit

Ctor for CpuMetricsWrapper with a set of CpuMetrics. Node is 0 here.

Parameters
arrCpuMetrics

References backward::details::move(), NES_THROW_RUNTIME_ERROR, and NES_TRACE.

Here is the call graph for this function:

Member Function Documentation

◆ getNodeId()

WorkerId NES::Monitoring::CpuMetricsWrapper::getNodeId ( ) const

Referenced by NES::MetricValidator::checkNodeIds().

Here is the caller graph for this function:

◆ getTotal()

CpuMetrics NES::Monitoring::CpuMetricsWrapper::getTotal ( ) const

The summarized stats over all CPU metrics. This metric is equivalent to the 0th element of the list.

Returns
CPUMetrics

References getValue().

Here is the call graph for this function:

◆ getValue()

CpuMetrics NES::Monitoring::CpuMetricsWrapper::getValue ( unsigned int  cpuCore) const

Returns the cpu metrics for a given core.

Parameters
cpuCorecore number
Returns
the cpu metrics

Referenced by getTotal(), NES::TEST_F(), and writeToBuffer().

Here is the caller graph for this function:

◆ operator!=()

bool NES::Monitoring::CpuMetricsWrapper::operator!= ( const CpuMetricsWrapper rhs) const

◆ operator==()

bool NES::Monitoring::CpuMetricsWrapper::operator== ( const CpuMetricsWrapper rhs) const

References NES_ERROR, and size().

Here is the call graph for this function:

◆ readFromBuffer()

void NES::Monitoring::CpuMetricsWrapper::readFromBuffer ( Runtime::TupleBuffer buf,
uint64_t  tupleIndex 
)

Parses a wrapper object from a given TupleBuffer.

Parameters
buf
tupleIndex

References NES::Runtime::TupleBuffer::getNumberOfTuples(), NES::Monitoring::CpuMetrics::getSchema(), backward::details::move(), magic_enum::detail::n(), NES_TRACE, and NES::Monitoring::readFromBuffer().

Referenced by NES::Monitoring::readFromBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNodeId()

void NES::Monitoring::CpuMetricsWrapper::setNodeId ( WorkerId  nodeId)

References nodeId.

Referenced by NES::Monitoring::CpuCollector::fillBuffer(), and NES::Monitoring::CpuCollector::readMetric().

Here is the caller graph for this function:

◆ size()

uint64_t NES::Monitoring::CpuMetricsWrapper::size ( ) const

The number of CPU metrics contained in the wrapper. The number is equivalent to the number of cores + 1.

Returns
Number of CPU metrics

Referenced by operator==(), NES::Monitoring::LinuxSystemResourcesReader::readRegistrationMetrics(), NES::TEST_F(), and writeToBuffer().

Here is the caller graph for this function:

◆ toJson()

nlohmann::json NES::Monitoring::CpuMetricsWrapper::toJson ( ) const

Returns the metrics as json.

Returns
Json containing the metrics

Referenced by NES::Monitoring::asJson().

Here is the caller graph for this function:

◆ writeToBuffer()

void NES::Monitoring::CpuMetricsWrapper::writeToBuffer ( Runtime::TupleBuffer buf,
uint64_t  tupleIndex 
) const

Writes a wrapper object to a given TupleBuffer.

Parameters
buf
tupleIndex

References NES::Runtime::TupleBuffer::getBufferSize(), NES::Monitoring::CpuMetrics::getSchema(), getValue(), NES_ERROR, NES_WARNING, NES::Monitoring::CpuMetrics::nodeId, size(), NES::Monitoring::CpuMetrics::timestamp, and NES::Monitoring::CpuMetrics::writeToBuffer().

Referenced by NES::TEST_F(), and NES::Monitoring::writeToBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: