NebulaStream
0.6.213
NebulaStream is a data and application management framework for the internet of things
|
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 |
Wrapper class to represent a tuple buffer with multiple CpuMetrics objects.
NES::Monitoring::CpuMetricsWrapper::CpuMetricsWrapper | ( | ) |
Default Ctor for CpuMetricsWrapper with timestamp=0.
Referenced by readFromBuffer().
|
explicit |
Ctor for CpuMetricsWrapper with a nodeId.
nodeId |
|
explicit |
Ctor for CpuMetricsWrapper with a set of CpuMetrics. Node is 0 here.
arr | CpuMetrics |
References backward::details::move(), NES_THROW_RUNTIME_ERROR, and NES_TRACE.
WorkerId NES::Monitoring::CpuMetricsWrapper::getNodeId | ( | ) | const |
CpuMetrics NES::Monitoring::CpuMetricsWrapper::getTotal | ( | ) | const |
The summarized stats over all CPU metrics. This metric is equivalent to the 0th element of the list.
References getValue().
CpuMetrics NES::Monitoring::CpuMetricsWrapper::getValue | ( | unsigned int | cpuCore | ) | const |
Returns the cpu metrics for a given core.
cpuCore | core number |
Referenced by getTotal(), NES::TEST_F(), and writeToBuffer().
bool NES::Monitoring::CpuMetricsWrapper::operator!= | ( | const CpuMetricsWrapper & | rhs | ) | const |
bool NES::Monitoring::CpuMetricsWrapper::operator== | ( | const CpuMetricsWrapper & | rhs | ) | const |
void NES::Monitoring::CpuMetricsWrapper::readFromBuffer | ( | Runtime::TupleBuffer & | buf, |
uint64_t | tupleIndex | ||
) |
Parses a wrapper object from a given TupleBuffer.
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().
void NES::Monitoring::CpuMetricsWrapper::setNodeId | ( | WorkerId | nodeId | ) |
References nodeId.
Referenced by NES::Monitoring::CpuCollector::fillBuffer(), and NES::Monitoring::CpuCollector::readMetric().
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.
Referenced by operator==(), NES::Monitoring::LinuxSystemResourcesReader::readRegistrationMetrics(), NES::TEST_F(), and writeToBuffer().
nlohmann::json NES::Monitoring::CpuMetricsWrapper::toJson | ( | ) | const |
Returns the metrics as json.
Referenced by NES::Monitoring::asJson().
void NES::Monitoring::CpuMetricsWrapper::writeToBuffer | ( | Runtime::TupleBuffer & | buf, |
uint64_t | tupleIndex | ||
) | const |
Writes a wrapper object to a given TupleBuffer.
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().