23#include <sys/resource.h>
27double kissat_process_time (
void) {
30 if (getrusage (RUSAGE_SELF, &u))
32 res = u.ru_utime.tv_sec + 1e-6 * u.ru_utime.tv_usec;
33 res += u.ru_stime.tv_sec + 1e-6 * u.ru_stime.tv_usec;
37uint64_t kissat_maximum_resident_set_size (
void) {
39 if (getrusage (RUSAGE_SELF, &u))
41 return ((uint64_t) u.ru_maxrss) << 10;
47mach_port_t mach_task_self (
void);
49uint64_t kissat_current_resident_set_size (
void) {
50 struct task_basic_info info;
51 mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT;
52 if (KERN_SUCCESS != task_info (mach_task_self (), TASK_BASIC_INFO,
53 (task_info_t) &info, &count))
55 return info.resident_size;
60uint64_t kissat_current_resident_set_size (
void) {
62 sprintf (path,
"/proc/%" PRIu64
"/statm", (uint64_t) getpid ());
63 FILE *
file = fopen (path,
"r");
67 int scanned = fscanf (
file,
"%" PRIu64
" %" PRIu64
"", &dummy, &rss);
69 return scanned == 2 ? rss * sysconf (_SC_PAGESIZE) : 0;
75 uint64_t rss = kissat_maximum_resident_set_size ();
76 double t = kissat_time (
solver);
83 solver->prefix,
"maximum-resident-set-size:", rss,
"bytes",
84 rss / (
double) (1 << 20));
94 solver->prefix,
"max-allocated:", max_allocated,
"bytes",
95 kissat_percent (max_allocated, rss));
99 memset (&buffer, 0,
sizeof buffer);
100 printf (
"%sprocess-time: %30s %18.2f seconds\n",
solver->prefix,
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END