mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
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>
This commit is contained in:
parent
0cb8b7531d
commit
c039ba0716
@ -4421,11 +4421,8 @@ ShowUsage(const char *title)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the only stats we don't show here are for memory usage -- i can't
|
* The only stats we don't show here are ixrss, idrss, isrss. It takes
|
||||||
* figure out how to interpret the relevant fields in the rusage struct,
|
* some work to interpret them, and most platforms don't fill them in.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
initStringInfo(&str);
|
initStringInfo(&str);
|
||||||
|
|
||||||
@ -4445,6 +4442,16 @@ ShowUsage(const char *title)
|
|||||||
(long) sys.tv_sec,
|
(long) sys.tv_sec,
|
||||||
(long) sys.tv_usec);
|
(long) sys.tv_usec);
|
||||||
#if defined(HAVE_GETRUSAGE)
|
#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,
|
appendStringInfo(&str,
|
||||||
"!\t%ld/%ld [%ld/%ld] filesystem blocks in/out\n",
|
"!\t%ld/%ld [%ld/%ld] filesystem blocks in/out\n",
|
||||||
r.ru_inblock - Save_r.ru_inblock,
|
r.ru_inblock - Save_r.ru_inblock,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user