[HACKERS] memory fields from getrusage() - Mailing list pgsql-hackers

From Justin Pryzby
Subject [HACKERS] memory fields from getrusage()
Date
Msg-id 20170610222026.GE18003@telsasoft.com
Whole thread Raw
Responses Re: [HACKERS] memory fields from getrusage()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I'm interested to expose output of the remaining (memory) fields from getrusage().

postgres=# SET log_parser_stats='on';
postgres=# SELECT c.oid::regclass, usagecount FROM pg_buffercache b JOIN pg_class c USING (relfilenode) WHERE
usagecount=1;
 
LOG:  PARSER STATISTICS
DETAIL:  ! system usage stats:       !       0.000197 elapsed 0.000119 user 0.000079 system sec       !       [0.011572
user0.007714 sys total]       !       0/0 [0/264] filesystem blocks in/out       !       0/39 [0/989] page
faults/reclaims,0 [0] swaps       !       0 [0] signals rcvd, 0/0 [0/0] messages rcvd/sent       !       0/0 [2/2]
voluntary/involuntarycontext switches       !       3920 MAX RESIDENT, 0 SHARED, 0 UNSHARED DATA, 0 UNSHARED STACK
(Kb)

Before that can work for some platforms, it looks like rusagestub.h needs to
have any desired fields added, and ./src/port/getrusage.c should memset(0) in
the non-windows case before adding any reliance on the rest of the structure.

This comment from ~1996 says:
https://doxygen.postgresql.org/postgres_8c_source.html4421      * the only stats we don't show here are for memory
usage-- i can't4422      * figure out how to interpret the relevant fields in the rusage struct,4423      * and they
changenames across o/s platforms, anyway. if you can figure4424      * out what the entries mean, you can somehow
extractresident set size,4425      * shared text size, and unshared data and stack sizes.
 

.. is that really (still) the case for supported platforms?  I'm hoping that in
2017 one can just call getrusage() if autoconf says it's okay ??

Justin



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: [HACKERS] Notes on testing Postgres 10b1
Next
From: Mark Rofail
Date:
Subject: Re: [HACKERS] GSoC 2017: Foreign Key Arrays