Re: adding more information about process(es) cpu and memory usage

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: adding more information about process(es) cpu and memory usage
Date: 2015-04-25 13:49:22
Message-ID: CAB7nPqSUDktsxTYhd4X4fy7AxF15nb3gLd2b_=0=9vhNNz8UHA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Apr 25, 2015 at 4:23 PM, Julien Rouhaud wrote:
> There are at least two projects that provides this kind of statistics
> for backends: pg_proctab (https://github.com/markwkm/pg_proctab) and
> pg_stat_kcache (https://github.com/dalibo/pg_stat_kcache) Michael also
> wrote an article on this topic some weeks ago
> (http://michael.otacoo.com/postgresql-2/postgres-calculate-cpu-usage-process/)

Don't use that hack except for development purposes ;) pg_stat_kcache
gives shows that core has enough facility for an extension doing
query-base CPU statistics by using the two hooks at executor init and
end with two calls to getrusage to calculate diffs for the stats it
needs. pg_proctab is useful as well to get live data.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan de Visser 2015-04-25 14:03:15 Re: Idea: closing the loop for "pg_ctl reload"
Previous Message Peter Eisentraut 2015-04-25 12:58:56 Re: forward vs backward slashes in msvc build code