Hi all, I have been looking at the possibility to support wait events for system processes, and here are the things that I think need to be done: - System processes do not have PGPROC entries in PROC_HDR. I think that we should add an array for system processes, putting in it walwriterLatch, checkpointerLatch and startupProc at the same time because we'd store directly a PGPROC entry. Another possibility would be to declare them individually in PROC_HDR, but I'd like to have a routine like BackendPidGetProc() but for system processes. And that is more portable in the long run. - System process PIDs are not reported as global variables. So we would need to move them from postmaster.c to globals.c and declare them as global variables. Those are now just static variables in postmaster.c. This is useful to match those PIDs with the entries in PGPROC_HDR to get the names of each process. - The catalog associated to system processes has this shape: -- name - name of the process, walreceiver, autovacuum, bgworker, autovacuum_worker, startup etc. -- PID -- wait_event -- wait_event_type I think that it would be fine to name it, say pg_stat_system_activity, and to define it as a system view fed by a SRF function that scans the arrays of PGPROC entries for background workers, autovacuum workers and system processes.
Thoughts about that? I am expecting a couple of -1 for suggesting to expose the system PIDs now only local to postmaster.c ;) Thanks, -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers