memory fields from getrusage()

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: memory fields from getrusage()
Date: 2017-06-10 22:20:26
Message-ID: 20170610222026.GE18003@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 user 0.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/involuntary context 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.html
4421 * the only stats we don't show here are for memory usage -- i can't
4422 * figure out how to interpret the relevant fields in the rusage struct,
4423 * and they change names across o/s platforms, anyway. if you can figure
4424 * out what the entries mean, you can somehow extract resident 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Rofail 2017-06-10 22:35:01 Re: GSoC 2017: Foreign Key Arrays
Previous Message Josh Berkus 2017-06-10 18:33:48 Re: Notes on testing Postgres 10b1