#include "../sccs.h"

#ifdef WIN32

#include <psapi.h>

u64
maxrss(void)
{
	PROCESS_MEMORY_COUNTERS cnt;

	if (GetProcessMemoryInfo(GetCurrentProcess(), &cnt, sizeof(cnt))) {
		return (cnt.PeakWorkingSetSize);
	}
	return (0);
}

#else

#include <sys/resource.h>

u64
maxrss(void)
{
	struct rusage ru;

	if (!getrusage(RUSAGE_SELF, &ru)) return (1024 * ru.ru_maxrss);
	return (0);
}

#endif

#include "../sccs.h"

#ifdef WIN32

#include <psapi.h>

u64
maxrss(void)
{
	PROCESS_MEMORY_COUNTERS cnt;

	if (GetProcessMemoryInfo(GetCurrentProcess(), &cnt, sizeof(cnt))) {
		return (cnt.PeakWorkingSetSize);
	}
	return (0);
}

#else

#include <sys/resource.h>

u64
maxrss(void)
{
	struct rusage	ru;
#if defined(sun)
	int		factor = getpagesize();
#elif defined(__APPLE__)
	int	factor = 1;
#else
	int	factor = 1024;
#endif

	if (getrusage(RUSAGE_SELF, &ru)) return (0);

	return (ru.ru_maxrss * factor);
}

#endif

Adjust for the fact that MacOS X and Solaris report maxrss in different units.
Adjust for the fact that MacOS X and Solaris report maxrss in
different units.

bk: 5489ebbfQIN1Wbpf9Qa4aY-VK6F8xw