Re: [HACKERS] memory fields from getrusage()

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: [HACKERS] memory fields from getrusage()
Дата
Msg-id CA+Tgmob-3j56RHjq5TBW83J7fMjPouL+msee4sRFnbU9wHt2qA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] memory fields from getrusage()  (Justin Pryzby <pryzby@telsasoft.com>)
Ответы Re: [HACKERS] memory fields from getrusage()  (Justin Pryzby <pryzby@telsasoft.com>)
Список pgsql-hackers
On Wed, Jun 14, 2017 at 6:28 PM, Justin Pryzby <pryzby@telsasoft.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 think it's fine to show zeros for unsupported fields; that's what getusage(2)
> and time(1) do after all.

Meh.  I think if we're going to go to the trouble of customizing this
code by platform, we ought to get rid of values that are meaningless
on that platform.

>> it would be a good idea to install code specific to Linux that
>> displays all and only those values that are meaningful on Linux, and
>> (less importantly) similarly for macOS.  Linux is such a common
>> platform that reporting bogus zero values and omitting other fields
>> that are actually meaningful does not seem like a very good plan.
>
> That has the issue that it varies not just by OS but also by OS version.  For
> example PG already shows context switches and FS in/out puts, but they're
> nonzero only since linux 2.6 (yes, 2.4 is ancient and unsupported but still).
>
>        ru_nvcsw (since Linux 2.6)
>        ru_inblock (since Linux 2.6.22)

If people who are still running 10 or 15 year old versions of Linux
see some zeroes for fields that might've been populated on a newer
release, I'm OK with that.  Maybe it will encourage them to upgrade.
We've completely removed platform support for systems newer than that.

> ..and other fields are "currently unused", but maybe supported in the past or
> future(?)
>        ru_ixrss (unmaintained)
>               This field is currently unused on Linux.

Could be worth a bit of research here.

> Are you thinking of something like this, maybe hidden away in a separate file
> somewhere?
>
> #if defined(__linux__) || defined(BSD)
>         appendStringInfo(&str, "!\t%ld max resident, %ld shared, %ld unshared data, %ld unshared stack (kB)\n",
r.ru_maxrss,r.ru_ixrss, r.ru_idrss, r.ru_isrss);
 
> #elif defined(__darwin__)
>         appendStringInfo(&str, "!\t%ld max resident, %ld shared, %ld unshared data, %ld unshared stack (kB)\n",
r.ru_maxrss/1024,r.ru_ixrss/1024, r.ru_idrss/1024, r.ru_isrss/1024);
 
> #endif /* __linux__ */

I don't think it needs to go in a separate file.  I'd just patch ShowUsage().

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Marina Polyakova
Дата:
Сообщение: Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] intermittent failures in Cygwin from select_parallel tests