diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-09-01 15:36:33 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-09-01 15:36:33 -0400 |
commit | c039ba0716383ccaf88c9be1a7f0803a77823de1 (patch) | |
tree | 89bfc8097315f0ae9960b3c432b19ae4c89f886e | |
parent | 0cb8b7531db063bce7def2ef24f616285f1f4b04 (diff) | |
download | postgresql-c039ba0716383ccaf88c9be1a7f0803a77823de1.tar.gz postgresql-c039ba0716383ccaf88c9be1a7f0803a77823de1.zip |
Add memory info to getrusage output
Add the maxrss field to the getrusage output (log_*_stats). This was
previously omitted because of portability concerns, but we feel this
might not be a concern anymore.
based on patch by Justin Pryzby <pryzby@telsasoft.com>
-rw-r--r-- | src/backend/tcop/postgres.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index b8d860ebdbf..8d3fecf6d6a 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -4421,11 +4421,8 @@ ShowUsage(const char *title) } /* - * the only stats we don't show here are for memory usage -- i can't - * figure out how to interpret the relevant fields in the rusage struct, - * and they change names across o/s platforms, anyway. if you can figure - * out what the entries mean, you can somehow extract resident set size, - * shared text size, and unshared data and stack sizes. + * The only stats we don't show here are ixrss, idrss, isrss. It takes + * some work to interpret them, and most platforms don't fill them in. */ initStringInfo(&str); @@ -4446,6 +4443,16 @@ ShowUsage(const char *title) (long) sys.tv_usec); #if defined(HAVE_GETRUSAGE) appendStringInfo(&str, + "!\t%ld kB max resident size\n", +#if defined(__darwin__) + /* in bytes on macOS */ + r.ru_maxrss/1024 +#else + /* in kilobytes on most other platforms */ + r.ru_maxrss +#endif + ); + appendStringInfo(&str, "!\t%ld/%ld [%ld/%ld] filesystem blocks in/out\n", r.ru_inblock - Save_r.ru_inblock, /* they only drink coffee at dec */ |