Painless
A framework to ease parallelization of sequential CDCL SAT solvers
Loading...
Searching...
No Matches
System.hpp
1
8#pragma once
9
10#include <atomic>
11#include <chrono>
12#include <string>
13#include <sys/resource.h>
14
26extern std::atomic<rlim_t> memoryLimitKB;
27
29extern const std::chrono::steady_clock::time_point startTime;
30
35double
37
42double
44
51bool
52parseMemInfo(const std::string& key, long& value);
53
58long
60
65long
67
72long
74
79long
81
87bool
88setMemoryLimitKB(rlim_t limitInKB);
89
94rlim_t
96
101bool
103
107void
109}
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.