diff options
Diffstat (limited to 'src/backend/utils/activity/pgstat.c')
-rw-r--r-- | src/backend/utils/activity/pgstat.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c index 0fa5370bcd..60fc4e761f 100644 --- a/src/backend/utils/activity/pgstat.c +++ b/src/backend/utils/activity/pgstat.c @@ -72,6 +72,7 @@ * - pgstat_checkpointer.c * - pgstat_database.c * - pgstat_function.c + * - pgstat_io.c * - pgstat_relation.c * - pgstat_replslot.c * - pgstat_slru.c @@ -359,6 +360,15 @@ static const PgStat_KindInfo pgstat_kind_infos[PGSTAT_NUM_KINDS] = { .snapshot_cb = pgstat_checkpointer_snapshot_cb, }, + [PGSTAT_KIND_IO] = { + .name = "io", + + .fixed_amount = true, + + .reset_all_cb = pgstat_io_reset_all_cb, + .snapshot_cb = pgstat_io_snapshot_cb, + }, + [PGSTAT_KIND_SLRU] = { .name = "slru", @@ -582,6 +592,7 @@ pgstat_report_stat(bool force) /* Don't expend a clock check if nothing to do */ if (dlist_is_empty(&pgStatPending) && + !have_iostats && !have_slrustats && !pgstat_have_pending_wal()) { @@ -628,6 +639,9 @@ pgstat_report_stat(bool force) /* flush database / relation / function / ... stats */ partial_flush |= pgstat_flush_pending_entries(nowait); + /* flush IO stats */ + partial_flush |= pgstat_flush_io(nowait); + /* flush wal stats */ partial_flush |= pgstat_flush_wal(nowait); @@ -1323,6 +1337,12 @@ pgstat_write_statsfile(void) write_chunk_s(fpout, &pgStatLocal.snapshot.checkpointer); /* + * Write IO stats struct + */ + pgstat_build_snapshot_fixed(PGSTAT_KIND_IO); + write_chunk_s(fpout, &pgStatLocal.snapshot.io); + + /* * Write SLRU stats struct */ pgstat_build_snapshot_fixed(PGSTAT_KIND_SLRU); @@ -1497,6 +1517,12 @@ pgstat_read_statsfile(void) goto error; /* + * Read IO stats struct + */ + if (!read_chunk_s(fpin, &shmem->io.stats)) + goto error; + + /* * Read SLRU stats struct */ if (!read_chunk_s(fpin, &shmem->slru.stats)) |