3#include <prometheus/gauge.h>
4#include <prometheus/registry.h>
34 .
tms_utime = 0, .tms_stime = 0, .tms_cutime = 0, .tms_cstime = 0};
91 void threadRunner(
const std::stop_token &stopToken)
noexcept;
99 ProcessMetrics(std::shared_ptr<std::atomic_flag> checkFlag,
const std::shared_ptr<prometheus::Registry> ®);
prometheus::Gauge * _pMemory
Pointer to the memory usage gauge.
ProcessMetrics & operator=(ProcessMetrics)=delete
Copy assignment operator.
std::unique_ptr< std::jthread > _thread
Thread handler.
clock_t _oldCpuTime
Variable to store the old CPU time.
ProcessMetrics(std::shared_ptr< std::atomic_flag > checkFlag, const std::shared_ptr< prometheus::Registry > ®)
prometheus::Gauge * _pInitTime
Pointer to initialization time gauge.
prometheus::Gauge * _pCurrentTime
Pointer to the current time gauge.
size_t _oldWriteBytes
Variable to store the old write bytes.
ProcessMetrics & operator=(ProcessMetrics &&)=delete
Move assignment operator.
ProcessMetrics(ProcessMetrics &&)=delete
Move constructor.
prometheus::Gauge * _pCpuUsage
Pointer to the CPU usage gauge.
static size_t countDirectoryEntries(const std::filesystem::path &path)
prometheus::Gauge * _pPageFaults
Pointer to the page faults gauge.
prometheus::Gauge * _pFileDescriptorCount
Pointer to the file descriptor count gauge.
std::pair< size_t, size_t > getDiskIO()
prometheus::Gauge * _pDiskRead
Pointer to the disk read gauge.
size_t _oldReadBytes
Variable to store the old read bytes.
prometheus::Gauge * _pThreadCount
Pointer to the thread count gauge.
static long int getMemoryUsage()
std::shared_ptr< std::atomic_flag > _checkFlag
Runtime check flag.
ProcessMetrics(const ProcessMetrics &)=delete
Copy constructor.
static size_t getThreadCount()
static long int getPageFaults()
void threadRunner(const std::stop_token &stopToken) noexcept
static size_t getFileDescriptorCount()
prometheus::Gauge * _pDiskWrite
Pointer to the disk write gauge.
Structure to store the old CPU times.