Re: memory fields from getrusage()

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: memory fields from getrusage()
Date: 2017-09-02 02:41:34
Message-ID: 20170902024134.GU22423@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

On Sat, Sep 02, 2017 at 02:00:44PM +1200, Thomas Munro wrote:
> On Sat, Sep 2, 2017 at 7:46 AM, Peter Eisentraut
> <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> > On 6/15/17 10:58, Justin Pryzby wrote:
> >> On Thu, Jun 15, 2017 at 10:29:21AM -0400, Robert Haas wrote:
> >>> On Wed, Jun 14, 2017 at 6:28 PM, Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
> >>>> On Tue, Jun 13, 2017 at 12:16:00PM -0400, Robert Haas wrote:
> >>>>> It might be worth adding platform-specific code for common platforms.
> >>>>
> >>>> All I care (which linux happily/happens to support) is maxrss; I was probably
> >>>> originally interested in this while digging into an issue with hash agg.
> >>>
> >>> I don't think it needs to go in a separate file. I'd just patch ShowUsage().
> >
> > I have committed a patch that shows maxrss, with /1024 adjustment for
> > macOS. That should cover all platforms that I could find.(*)
>
> Apparently ru_maxrss is in *pages* on Solaris-derived systems:
>
> https://illumos.org/man/3c/getrusage

..but note that that:
"The ru_maxrss, ru_ixrss, ru_idrss, and ru_isrss members of the rusage
structure are set to 0 in this implementation."

Same here:
https://docs.oracle.com/cd/E23823_01/html/816-5168/getrusage-3c.html

..and earlier solaris docs don't seem to mention getrusage at all (?)

posix docs say:
http://pubs.opengroup.org/onlinepubs/009695399/functions/getrusage.html
|CHANGE HISTORY
| First released in Issue 4, Version 2.

..which I gather is SUSv1 c. 1995

Curiously, GNU time reported maxrss too high by a factor of 4 (and that was
present in early centos6.X)
https://bugzilla.redhat.com/show_bug.cgi?id=702826

Justin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-09-02 03:30:12 Re: Function to move the position of a replication slot
Previous Message Amit Kapila 2017-09-02 02:11:59 Re: Speed up Clog Access by increasing CLOG buffers