7 #include <carl-common/meta/platform.h>
8 #include <carl-common/memory/Singleton.h>
12 #include <sys/times.h>
13 #include <sys/resource.h>
21 getrlimit(RLIMIT_CPU, &rl);
22 rl.rlim_cur = seconds;
23 setrlimit(RLIMIT_CPU, &rl);
27 getrlimit(RLIMIT_CPU, &rl);
31 return std::size_t(clock()) / CLOCKS_PER_SEC;
35 getrlimit(RLIMIT_AS, &rl);
36 rl.rlim_cur = megabytes * 1024 * 1024;
37 setrlimit(RLIMIT_AS, &rl);
42 getrlimit(RLIMIT_AS, &rl);
53 inline std::size_t
usedCPU() {
return 0; }
59 class Limiter:
public carl::Singleton<Limiter> {
106 if (signal == SIGXCPU) {
107 std::cerr <<
"(error \"CPU resource out\")" << std::endl;
108 smtrat::resource::Limiter::getInstance().timeoutHandler()();
110 }
else if (signal == ENOMEM) {
111 std::cerr <<
"(error \"Memory resource out\")" << std::endl;
114 std::cerr <<
"(error \"Unknown abort in resource limitation module\")" << std::endl;
constexpr int SMTRAT_EXIT_TIMEOUT
constexpr int SMTRAT_EXIT_GENERALERROR
constexpr int SMTRAT_EXIT_MEMOUT
std::size_t mOriginalTimeout
void setMemout(std::size_t megabytes)
std::function< void()> timeoutHandler() const
std::function< void()> mTimeoutHandler
std::size_t mOriginalMemout
void setTimeout(std::size_t seconds)
void setTimeoutHandler(std::function< void()> f)
void resetTimeout() const
void setMemoryLimit(std::size_t)
std::size_t getMemoryLimit()
void setCPULimit(std::size_t)
void installSignalHandler()
std::size_t getCPULimit()
void signalHandler(int signal)
Class to create the formulas for axioms.