Skip to content

Commit

Permalink
Support returning actual peak-memory instead of reverting to current …
Browse files Browse the repository at this point in the history
…usage
  • Loading branch information
niklasso committed Sep 25, 2013
1 parent cd3a2d6 commit 37dc6c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions minisat/utils/System.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ static inline int memReadPeak(void)
}

double Minisat::memUsed() { return (double)memReadStat(0) * (double)getpagesize() / (1024*1024); }
double Minisat::memUsedPeak() {
double peak = memReadPeak() / 1024;
return peak == 0 ? memUsed() : peak; }
double Minisat::memUsedPeak(bool strictlyPeak) {
double peak = memReadPeak() / (double)1024;
return peak == 0 && !strictlyPeak ? memUsed() : peak; }

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

Expand Down
2 changes: 1 addition & 1 deletion minisat/utils/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Minisat {
static inline double cpuTime(void); // CPU-time in seconds.

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

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

0 comments on commit 37dc6c6

Please sign in to comment.