13#include <sys/resource.h>
29extern const std::chrono::steady_clock::time_point
startTime;
A set of utilities for monitoring and managing system resources.
Definition System.hpp:24
const std::chrono::steady_clock::time_point startTime
The start time of the program.
long getUsedMemoryKB()
Get the used system memory in kilobytes.
bool parseMemInfo(const std::string &key, long &value)
Parse a specific key from /proc/meminfo.
long getAvailableMemoryKB()
Get the available system memory in kilobytes(accounts page cache as available).
long getTotalMemoryKB()
Get the total system memory in kilobytes.
double getAbsoluteTimeSeconds()
Get the absolute time in seconds since the epoch.
bool setMemoryLimitKB(rlim_t limitInKB)
Set the memory limit for the process.
bool isMemoryLimitExceeded()
Check if the current memory usage exceeds the set limit.
std::atomic< rlim_t > memoryLimitKB
The current memory limit for the process in kilobytes.
long getFreeMemoryKB()
Get the free system memory in kilobytes(totally free memory, not even used for cache).
void printProcessResourceUsage()
Pretty print for the resource usage data gotten from getrusage()
rlim_t getMemoryLimitKB()
Get the current memory limit for the process.
double getRelativeTimeSeconds()
Get the relative time in seconds since the program started.