|
72 | 72 | * - pgstat_checkpointer.c
|
73 | 73 | * - pgstat_database.c
|
74 | 74 | * - pgstat_function.c
|
| 75 | + * - pgstat_io.c |
75 | 76 | * - pgstat_relation.c
|
76 | 77 | * - pgstat_replslot.c
|
77 | 78 | * - pgstat_slru.c
|
@@ -359,6 +360,15 @@ static const PgStat_KindInfo pgstat_kind_infos[PGSTAT_NUM_KINDS] = {
|
359 | 360 | .snapshot_cb = pgstat_checkpointer_snapshot_cb,
|
360 | 361 | },
|
361 | 362 |
|
| 363 | + [PGSTAT_KIND_IO] = { |
| 364 | + .name = "io", |
| 365 | + |
| 366 | + .fixed_amount = true, |
| 367 | + |
| 368 | + .reset_all_cb = pgstat_io_reset_all_cb, |
| 369 | + .snapshot_cb = pgstat_io_snapshot_cb, |
| 370 | + }, |
| 371 | + |
362 | 372 | [PGSTAT_KIND_SLRU] = {
|
363 | 373 | .name = "slru",
|
364 | 374 |
|
@@ -582,6 +592,7 @@ pgstat_report_stat(bool force)
|
582 | 592 |
|
583 | 593 | /* Don't expend a clock check if nothing to do */
|
584 | 594 | if (dlist_is_empty(&pgStatPending) &&
|
| 595 | + !have_iostats && |
585 | 596 | !have_slrustats &&
|
586 | 597 | !pgstat_have_pending_wal())
|
587 | 598 | {
|
@@ -628,6 +639,9 @@ pgstat_report_stat(bool force)
|
628 | 639 | /* flush database / relation / function / ... stats */
|
629 | 640 | partial_flush |= pgstat_flush_pending_entries(nowait);
|
630 | 641 |
|
| 642 | + /* flush IO stats */ |
| 643 | + partial_flush |= pgstat_flush_io(nowait); |
| 644 | + |
631 | 645 | /* flush wal stats */
|
632 | 646 | partial_flush |= pgstat_flush_wal(nowait);
|
633 | 647 |
|
@@ -1322,6 +1336,12 @@ pgstat_write_statsfile(void)
|
1322 | 1336 | pgstat_build_snapshot_fixed(PGSTAT_KIND_CHECKPOINTER);
|
1323 | 1337 | write_chunk_s(fpout, &pgStatLocal.snapshot.checkpointer);
|
1324 | 1338 |
|
| 1339 | + /* |
| 1340 | + * Write IO stats struct |
| 1341 | + */ |
| 1342 | + pgstat_build_snapshot_fixed(PGSTAT_KIND_IO); |
| 1343 | + write_chunk_s(fpout, &pgStatLocal.snapshot.io); |
| 1344 | + |
1325 | 1345 | /*
|
1326 | 1346 | * Write SLRU stats struct
|
1327 | 1347 | */
|
@@ -1496,6 +1516,12 @@ pgstat_read_statsfile(void)
|
1496 | 1516 | if (!read_chunk_s(fpin, &shmem->checkpointer.stats))
|
1497 | 1517 | goto error;
|
1498 | 1518 |
|
| 1519 | + /* |
| 1520 | + * Read IO stats struct |
| 1521 | + */ |
| 1522 | + if (!read_chunk_s(fpin, &shmem->io.stats)) |
| 1523 | + goto error; |
| 1524 | + |
1499 | 1525 | /*
|
1500 | 1526 | * Read SLRU stats struct
|
1501 | 1527 | */
|
|
0 commit comments