Skip to content

Commit 37dc6c6

Browse files
committed
Support returning actual peak-memory instead of reverting to current usage
1 parent cd3a2d6 commit 37dc6c6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

minisat/utils/System.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ static inline int memReadPeak(void)
6767
}
6868

6969
double Minisat::memUsed() { return (double)memReadStat(0) * (double)getpagesize() / (1024*1024); }
70-
double Minisat::memUsedPeak() {
71-
double peak = memReadPeak() / 1024;
72-
return peak == 0 ? memUsed() : peak; }
70+
double Minisat::memUsedPeak(bool strictlyPeak) {
71+
double peak = memReadPeak() / (double)1024;
72+
return peak == 0 && !strictlyPeak ? memUsed() : peak; }
7373

7474
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__gnu_hurd__)
7575

minisat/utils/System.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace Minisat {
3434
static inline double cpuTime(void); // CPU-time in seconds.
3535

3636
extern double memUsed(); // Memory in mega bytes (returns 0 for unsupported architectures).
37-
extern double memUsedPeak(); // Peak-memory in mega bytes (returns 0 for unsupported architectures).
37+
extern double memUsedPeak(bool strictlyPeak = false); // Peak-memory in mega bytes (returns 0 for unsupported architectures).
3838

3939
extern void setX86FPUPrecision(); // Make sure double's are represented with the same precision
4040
// in memory and registers.

0 commit comments

Comments
 (0)