pgstat.c is very long, and it's hard to find an order that makes sense and is likely to be maintained over time. Splitting the different pieces into separate files makes that a lot easier.
With a few exceptions, this commit just moves code around. Those exceptions are:- adding file headers for new files- removing 'static' from functions- adapting pgstat_assert_is_up() to work across TUs- minor comment adjustments git diff --color-moved=dimmed-zebra is very helpful separating code movement from code changes.
The next commit in this series will reorder pgstat.[ch] contents to be a bit more coherent.
Earlier revisions of this patch had "global" statistics (archiver, bgwriter, checkpointer, replication slots, SLRU, WAL) in one file, because each seemed small enough. However later commits will increase their size and their aggregate size is not insubstantial. It also just seems easier to split each type of statistic into its own file.
Author: Andres Freund Discussion: https://firstname.lastname@example.org
13619598f1 pgstat: split different types of stats into separate files.
src/backend/postmaster/pgstat.c | 2113 +---------------------
src/backend/utils/activity/Makefile | 10 +
src/backend/utils/activity/pgstat_archiver.c | 44 +
src/backend/utils/activity/pgstat_bgwriter.c | 63 +
src/backend/utils/activity/pgstat_checkpointer.c | 61 +
src/backend/utils/activity/pgstat_database.c | 279 +++
src/backend/utils/activity/pgstat_function.c | 225 +++
src/backend/utils/activity/pgstat_relation.c | 935 ++++++++++
src/backend/utils/activity/pgstat_replslot.c | 119 ++
src/backend/utils/activity/pgstat_slru.c | 201 ++
src/backend/utils/activity/pgstat_subscription.c | 78 +
src/backend/utils/activity/pgstat_wal.c | 159 ++
src/include/utils/pgstat_internal.h | 161 ++
13 files changed, 2408 insertions(+), 2040 deletions(-)