summaryrefslogtreecommitdiffstats
path: root/pg_top.c
diff options
context:
space:
mode:
authorMark Wong <markwkm@gmail.com>2023-05-21 17:04:31 -0700
committerMark Wong <markwkm@gmail.com>2023-05-21 18:09:16 -0700
commit15d2d31ad8d22a836dbb0c1578b0b92a2a7766c3 (patch)
tree16a6d20a6e162575827d2ba48738bc0e8b8fe6aa /pg_top.c
parentb2d63dd8bbf8fd800135b33b74a0be22943c65fe (diff)
Revert "Revert "monitor the disk I/O of the server""
Diffstat (limited to 'pg_top.c')
-rw-r--r--pg_top.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/pg_top.c b/pg_top.c
index 2bb78b2..fee2c18 100644
--- a/pg_top.c
+++ b/pg_top.c
@@ -124,6 +124,8 @@ void (*d_procstates) (int, int *) = i_procstates;
void (*d_cpustates) (int64_t *) = i_cpustates;
void (*d_memory) (long *) = i_memory;
void (*d_swap) (long *) = i_swap;
+void (*d_db) (struct db_info *) = i_db;
+void (*d_io) (struct io_info *) = i_io;
void (*d_message) () = i_message;
void (*d_process) (int, char *) = i_process;
@@ -196,6 +198,12 @@ do_display(struct pg_top_context *pgtctx)
pgtctx->order_index, &pgtctx->conninfo, pgtctx->mode);
}
+ /* Get database activity information */
+ get_database_info(&pgtctx->db_info, &pgtctx->conninfo);
+
+ /* Get database I/O information */
+ get_io_info(&pgtctx->io_info);
+
/* display the load averages */
(*d_loadave) (pgtctx->system_info.last_pid, pgtctx->system_info.load_avg);
@@ -236,6 +244,12 @@ do_display(struct pg_top_context *pgtctx)
/* display memory stats */
(*d_memory) (pgtctx->system_info.memory);
+ /* display database activity */
+ (*d_db) (&pgtctx->db_info);
+
+ /* display database I/O */
+ (*d_io) (&pgtctx->io_info);
+
/* display swap stats */
(*d_swap) (pgtctx->system_info.swap);
@@ -332,6 +346,8 @@ do_display(struct pg_top_context *pgtctx)
d_procstates = u_procstates;
d_cpustates = u_cpustates;
d_memory = u_memory;
+ d_db = u_db;
+ d_io = u_io;
d_swap = u_swap;
d_message = u_message;
pgtctx->d_header = u_header;
@@ -538,6 +554,8 @@ reset_display(struct pg_top_context *pgtctx)
d_cpustates = i_cpustates;
d_memory = i_memory;
d_swap = i_swap;
+ d_db = i_db;
+ d_io = i_io;
d_message = i_message;
pgtctx->d_header = i_header;
d_process = i_process;
@@ -1001,6 +1019,12 @@ main(int argc, char *argv[])
&pgtctx.conninfo, -1);
}
+ /* Get database activity information */
+ get_database_info(&pgtctx.db_info, &pgtctx.conninfo);
+
+ /* Get database I/O information */
+ get_io_info(&pgtctx.io_info);
+
pgtctx.timeout.tv_sec = 1;
pgtctx.timeout.tv_usec = 0;
select(0, NULL, NULL, NULL, &pgtctx.timeout);