summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wong <mark@2ndQuadrant.com>2019-06-14 02:59:44 +0000
committerMark Wong <mark@2ndQuadrant.com>2019-07-08 12:07:56 -0700
commitfa587455496a1aa45cc9ad7ff1280a927e74493b (patch)
tree1f92e271557e02d33221fa8cdcab4ec2a3b0b23d
parent4b82a5c7e1086f87c6d2214b236a6c2134bb0cfa (diff)
Revert "monitor the disk I/O of the server"
This reverts commit 81be58eb547b0e14f06ec232d93554e502d40535. This functionality is duplicated in pgstat, focus pg_top on process related information.
-rw-r--r--Porting11
-rw-r--r--display.c25
-rw-r--r--display.h2
-rw-r--r--layout.h12
-rw-r--r--machine.h13
-rw-r--r--machine/m_aix43.c7
-rw-r--r--machine/m_aix5.c7
-rw-r--r--machine/m_common.c79
-rw-r--r--machine/m_decosf1.c7
-rw-r--r--machine/m_freebsd.c7
-rw-r--r--machine/m_hpux10.c7
-rw-r--r--machine/m_hpux7.c7
-rw-r--r--machine/m_hpux9.c7
-rw-r--r--machine/m_irix5.c7
-rw-r--r--machine/m_irixsgi.c7
-rw-r--r--machine/m_linux.c75
-rw-r--r--machine/m_linuxthr.c7
-rw-r--r--machine/m_macosx.c11
-rw-r--r--machine/m_netbsd.c7
-rw-r--r--machine/m_openbsd.c7
-rw-r--r--machine/m_sco5.c7
-rw-r--r--machine/m_sunos4.c7
-rw-r--r--machine/m_sunos5.c7
-rw-r--r--machine/m_svr4.c7
-rw-r--r--machine/m_svr5.c7
-rw-r--r--pg_top.c18
-rw-r--r--pg_top.h1
27 files changed, 7 insertions, 359 deletions
diff --git a/Porting b/Porting
index 2570b3b..a1bf0e9 100644
--- a/Porting
+++ b/Porting
@@ -74,15 +74,6 @@ struct system_info
int *memory; /* memory information */
};
-The io_info struct is filled in by get_io_info.
-struct io_info {
- int64_t reads;
- int64_t readsectors;
- int64_t writes;
- int64_t writesectors;
-};
-
-
The last three pointers each point to an array of integers. The
length of the array is determined by the length of the corresponding
_names array in the statics structure. Furthermore, if an entry in a
@@ -125,8 +116,6 @@ int proc_compare(caddr_t, caddr_t)
qsort comparison function
-void get_io_info(struct io_info *)
-
get_process_info is called immediately after get_system_info. In
fact, the two functions could be rolled in to one. The reason they
are not is mostly historical.
diff --git a/display.c b/display.c
index 30a8f9d..66806aa 100644
--- a/display.c
+++ b/display.c
@@ -75,8 +75,6 @@ static int y_swap = -1;
static int y_message = Y_MESSAGE;
static int x_db = X_DB;
static int y_db = Y_DB;
-static int x_io = X_IO;
-static int y_io = Y_IO;
static int x_header = X_HEADER;
static int y_header = Y_HEADER;
static int x_idlecursor = X_IDLECURSOR;
@@ -1249,29 +1247,6 @@ u_db(struct db_info *db_info)
}
/*
- * *_io(io_info) - print "DB I/O: " followed by IO summary
- */
-void
-i_io(struct io_info *io_info)
-{
- char buf[128];
- display_write(x_io, y_io, 0, 0, "DB I/O: ");
-
- snprintf(buf, 80, "%5ld reads/s, %5ld KB/s, %5ld writes/s, %5ld KB/s ",
- io_info->reads,
- io_info->readsectors / 2,
- io_info->writes,
- io_info->writesectors / 2);
- display_write(-1, -1, 0, 0, buf);
-}
-
-void
-u_io(struct io_info *io_info)
-{
- i_io(io_info);
-}
-
-/*
* *_message() - print the next pending message line, or erase the one
* that is there.
*
diff --git a/display.h b/display.h
index 732e473..ec04806 100644
--- a/display.h
+++ b/display.h
@@ -31,8 +31,6 @@ void i_swap(long *stats);
void u_swap(long *stats);
void i_db(struct db_info *db_info);
void u_db(struct db_info *db_info);
-void i_io(struct io_info *io_info);
-void u_io(struct io_info *io_info);
void i_message();
void u_message();
void i_header(char *text);
diff --git a/layout.h b/layout.h
index b0633de..b62b0dc 100644
--- a/layout.h
+++ b/layout.h
@@ -31,15 +31,13 @@
#define Y_MEM 3
#define X_DB 0
#define Y_DB 4
-#define X_IO 0
-#define Y_IO 5
#define X_SWAP 6
-#define Y_SWAP 6
-#define Y_MESSAGE 6
+#define Y_SWAP 5
+#define Y_MESSAGE 5
#define X_HEADER 0
-#define Y_HEADER 7
+#define Y_HEADER 6
#define X_IDLECURSOR 0
-#define Y_IDLECURSOR 6
-#define Y_PROCS 8
+#define Y_IDLECURSOR 5
+#define Y_PROCS 7
#endif /* _LAYOUT_H_ */
diff --git a/machine.h b/machine.h
index a703242..37b1e0d 100644
--- a/machine.h
+++ b/machine.h
@@ -110,17 +110,6 @@ struct db_info {
};
/*
- * Info on reads/writes happening on disk.
- * On Linux, this can be obtained from /proc/diskstats.
- */
-struct io_info {
- int64_t reads;
- int64_t readsectors;
- int64_t writes;
- int64_t writesectors;
-};
-
-/*
* the process_select struct tells get_process_info what processes we
* are interested in seeing
*/
@@ -143,8 +132,6 @@ caddr_t get_process_info(struct system_info *, struct process_select *, int,
caddr_t get_process_info(struct system_info *, struct process_select *, int,
char *);
#endif /* __linux__ */
-void get_database_info(struct db_info *, struct pg_conninfo_ctx *);
-void get_io_info(struct io_info *);
char *format_header(char *);
char *format_next_io(caddr_t);
char *format_next_process(caddr_t);
diff --git a/machine/m_aix43.c b/machine/m_aix43.c
index 381fef5..24887f2 100644
--- a/machine/m_aix43.c
+++ b/machine/m_aix43.c
@@ -741,10 +741,3 @@ proc_owner(int pid)
return (-1);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_aix5.c b/machine/m_aix5.c
index c540933..4946000 100644
--- a/machine/m_aix5.c
+++ b/machine/m_aix5.c
@@ -818,10 +818,3 @@ int pid;
return (-1);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_common.c b/machine/m_common.c
index 70a1258..cc4e94a 100644
--- a/machine/m_common.c
+++ b/machine/m_common.c
@@ -31,85 +31,6 @@ char *procstatenames[] =
" disabled, ", NULL
};
-/*
- * Get database info via the above QUERY_STAT_DB info.
- * Returns rate info on the various statistics by comparing current
- * values with previous values.
- */
-void
-get_database_info(struct db_info *db_info, struct pg_conninfo_ctx *conninfo)
-{
- struct timeval thistime;
- double timediff;
- int i;
- int rows;
- PGresult *pgresult = NULL;
- struct db_info cur_info;
- static struct timeval lasttime;
- static struct db_info last_db_info;
-
- /* calculate the time difference since our last check */
- gettimeofday(&thistime, 0);
- if (lasttime.tv_sec)
- timediff = ((thistime.tv_sec - lasttime.tv_sec) +
- (thistime.tv_usec - lasttime.tv_usec) * 1e-6);
- else
- timediff = 0;
-
- lasttime = thistime;
-
- rows = 0;
- connect_to_db(conninfo);
- if (conninfo->connection != NULL)
- {
- pgresult = PQexec(conninfo->connection, QUERY_STAT_DB);
- if (PQresultStatus(pgresult) == PGRES_TUPLES_OK)
- rows = PQntuples(pgresult);
-
- }
- if (rows == 0)
- {
- /* Database probably stopped, clear current and last */
- memset(&last_db_info, 0, sizeof(last_db_info));
- }
- memset(&cur_info, 0, sizeof(cur_info));
- for (i = 0; i < rows; i++)
- {
- PQgetvalue(pgresult, i, 2);
- /* Count all databases, even with no active backends */
- cur_info.numDb++;
- cur_info.numXact += atoi(PQgetvalue(pgresult, i, 3));
- cur_info.numRollback += atoi(PQgetvalue(pgresult, i, 4));
- cur_info.numBlockRead += atoi(PQgetvalue(pgresult, i, 5));
- cur_info.numBlockHit += atoi(PQgetvalue(pgresult, i, 6));
- cur_info.numTupleFetched += atoi(PQgetvalue(pgresult, i, 8));
- cur_info.numTupleAltered += atoi(PQgetvalue(pgresult, i, 9)) +
- atoi(PQgetvalue(pgresult, i, 10)) +
- atoi(PQgetvalue(pgresult, i, 11));
- cur_info.numConflict += atoi(PQgetvalue(pgresult, i, 12));
- }
- if (pgresult != NULL)
- PQclear(pgresult);
- disconnect_from_db(conninfo);
- if (timediff <= 0)
- {
- last_db_info = cur_info;
- memset(db_info, 0, sizeof(*db_info));
- return;
- }
-
- /* Compute the rate information */
- db_info->numDb = cur_info.numDb;
- db_info->numXact = (double)(cur_info.numXact - last_db_info.numXact) / timediff;
- db_info->numRollback = (double)(cur_info.numRollback - last_db_info.numRollback) / timediff;
- db_info->numBlockRead = (double)(cur_info.numBlockRead - last_db_info.numBlockRead) / timediff;
- db_info->numBlockHit = (double)(cur_info.numBlockHit - last_db_info.numBlockHit) / timediff;
- db_info->numTupleFetched = (double)(cur_info.numTupleFetched - last_db_info.numTupleFetched) / timediff;
- db_info->numTupleAltered = (double)(cur_info.numTupleAltered - last_db_info.numTupleAltered) / timediff;
- db_info->numConflict = (double)(cur_info.numConflict - last_db_info.numConflict) / timediff;
- last_db_info = cur_info;
-}
-
void
update_state(int *pgstate, char *state)
{
diff --git a/machine/m_decosf1.c b/machine/m_decosf1.c
index 7408203..2397fe5 100644
--- a/machine/m_decosf1.c
+++ b/machine/m_decosf1.c
@@ -1012,10 +1012,3 @@ setpriority(int dummy, int procnum, int niceval)
}
return (syscall(SYS_setpriority, PRIO_PROCESS, procnum, niceval));
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_freebsd.c b/machine/m_freebsd.c
index ee3891c..a71baef 100644
--- a/machine/m_freebsd.c
+++ b/machine/m_freebsd.c
@@ -1078,10 +1078,3 @@ swapmode(int *retavail, int *retfree)
(double) swapary[0].ksw_total);
return (n);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_hpux10.c b/machine/m_hpux10.c
index d4d637f..e6b64da 100644
--- a/machine/m_hpux10.c
+++ b/machine/m_hpux10.c
@@ -712,10 +712,3 @@ int *m;
ttynames[*m].name[0] = '\0';
free(namelist);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_hpux7.c b/machine/m_hpux7.c
index 724cdb2..96970b7 100644
--- a/machine/m_hpux7.c
+++ b/machine/m_hpux7.c
@@ -881,10 +881,3 @@ int pid;
}
return (-1);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_hpux9.c b/machine/m_hpux9.c
index 9547ecb..61a9cd3 100644
--- a/machine/m_hpux9.c
+++ b/machine/m_hpux9.c
@@ -835,10 +835,3 @@ int pid;
}
return (-1);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_irix5.c b/machine/m_irix5.c
index 2c3a98f..c20eb8b 100644
--- a/machine/m_irix5.c
+++ b/machine/m_irix5.c
@@ -776,10 +776,3 @@ struct prpsinfo *baseptr;
lasttime = thistime;
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_irixsgi.c b/machine/m_irixsgi.c
index af62385..bdcdf77 100644
--- a/machine/m_irixsgi.c
+++ b/machine/m_irixsgi.c
@@ -1154,10 +1154,3 @@ getptable(struct prpsinfo * baseptr)
op->oldpct = weighted_cpu(currproc);
}
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_linux.c b/machine/m_linux.c
index f796073..b63c932 100644
--- a/machine/m_linux.c
+++ b/machine/m_linux.c
@@ -15,8 +15,6 @@
* AUTHOR: Richard Henderson <rth@tamu.edu>
* Order support added by Alexey Klimkin <kad@klon.tme.mcst.ru>
* Ported to 2.4 by William LeFebvre
- *
- * Portions Copyright (c) 2013 VMware, Inc. All Rights Reserved.
*/
#include "config.h"
@@ -1243,76 +1241,3 @@ compare_writes(const void *v1, const void *v2)
return (result);
}
-
-/*
- * Get IO information for the SCSI devices in the system. Returns
- * read/write IOs per second and bandwidth by comparing current values
- * with previous values.
- */
-void
-get_io_info(struct io_info *io_info)
-{
- struct timeval thistime;
- double timediff;
- static struct timeval lasttime;
- struct io_info cur_info;
- static struct io_info last_io_info;
- FILE *fp;
- char line[256];
- int major, minor;
- char dev_name[32];
- int64_t reads, readsectors, skip, writes, writesectors;
- int i;
-
- /* calculate the time difference since our last check */
- gettimeofday(&thistime, 0);
- if (lasttime.tv_sec)
- timediff = ((thistime.tv_sec - lasttime.tv_sec) +
- (thistime.tv_usec - lasttime.tv_usec) * 1e-6);
- else
- timediff = 0;
-
- lasttime = thistime;
-
- fp = fopen("/proc/diskstats", "r");
- if (fp == NULL)
- {
- memset(io_info, 0, sizeof(*io_info));
- return;
- }
-
- memset(&cur_info, 0, sizeof(cur_info));
- while (fgets(line, 256, fp) != NULL)
- {
- i = sscanf(line, "%d %d %31s %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld",
- &major, &minor, dev_name,
- &reads, &skip, &readsectors, &skip,
- &writes, &skip, &writesectors, &skip,
- &skip, &skip, &skip);
- if (i != 14)
- continue;
-
- /* Total up full scsi devices (not partitions) */
- if (major == 8 && (minor % 16) == 0)
- {
- cur_info.reads += reads;
- cur_info.readsectors += readsectors;
- cur_info.writes += writes;
- cur_info.writesectors += writesectors;
- }
- }
- fclose(fp);
- if (timediff == 0)
- {
- last_io_info = cur_info;
- memset(io_info, 0, sizeof(*io_info));
- return;
- }
-
- /* Compute the rate information */
- io_info->reads = (double)(cur_info.reads - last_io_info.reads) / timediff;
- io_info->readsectors = (double)(cur_info.readsectors - last_io_info.readsectors) / timediff;
- io_info->writes = (double)(cur_info.writes - last_io_info.writes) / timediff;
- io_info->writesectors = (double)(cur_info.writesectors - last_io_info.writesectors) / timediff;
- last_io_info = cur_info;
-}
diff --git a/machine/m_linuxthr.c b/machine/m_linuxthr.c
index b74899a..415e215 100644
--- a/machine/m_linuxthr.c
+++ b/machine/m_linuxthr.c
@@ -1109,10 +1109,3 @@ proc_owner(int pid)
else
return (int) sb.st_uid;
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_macosx.c b/machine/m_macosx.c
index 4e986b7..685f656 100644
--- a/machine/m_macosx.c
+++ b/machine/m_macosx.c
@@ -598,9 +598,9 @@ get_process_info(struct system_info * si, struct process_select * sel, int x,
buffer = (struct kinfo_proc *) malloc( len * sizeof(struct kinfo_proc) );
for (i = 0; i < nproc ; i++) {
- size_t size = sizeof(struct kinfo_proc);
+ size_t size = sizeof(struct kinfo_proc);
mib[3] = atoi(PQgetvalue(pgresult, i, 0));
-
+
if (sysctl(mib, sizeof(mib)/sizeof(int), &buffer[i], &size, NULL,
0) == -1) {
perror("sysctl atoi loop");
@@ -953,10 +953,3 @@ proc_owner(pid_t pid)
}
return (-1);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_netbsd.c b/machine/m_netbsd.c
index 29eb6ed..ed2ddae 100644
--- a/machine/m_netbsd.c
+++ b/machine/m_netbsd.c
@@ -892,10 +892,3 @@ u_int64_t *diffs;
for (i = 0; i < cnt; i++)
*out++ = (int) ((*diffs++ * 1000 + half_total) / total_change);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_openbsd.c b/machine/m_openbsd.c
index a92b1e9..042b78d 100644
--- a/machine/m_openbsd.c
+++ b/machine/m_openbsd.c
@@ -715,10 +715,3 @@ swapmode(long *used, long *total)
free(swdev);
return 1;
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_sco5.c b/machine/m_sco5.c
index d858d3d..d4e968f 100644
--- a/machine/m_sco5.c
+++ b/machine/m_sco5.c
@@ -864,10 +864,3 @@ compare_time(struct proc ** pp1, struct proc ** pp2)
return (result);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_sunos4.c b/machine/m_sunos4.c
index 47d826f..d0b82b2 100644
--- a/machine/m_sunos4.c
+++ b/machine/m_sunos4.c
@@ -957,10 +957,3 @@ int pid;
}
return (-1);
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_sunos5.c b/machine/m_sunos5.c
index a7f4c35..6ab5a35 100644
--- a/machine/m_sunos5.c
+++ b/machine/m_sunos5.c
@@ -1798,10 +1798,3 @@ reallocproc(int n)
op->oldpid = -1;
}
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_svr4.c b/machine/m_svr4.c
index 3171d03..81494b1 100644
--- a/machine/m_svr4.c
+++ b/machine/m_svr4.c
@@ -747,10 +747,3 @@ struct sysinfo *percpu_si;
percpu_p++;
}
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/machine/m_svr5.c b/machine/m_svr5.c
index ca2c963..c5f7024 100644
--- a/machine/m_svr5.c
+++ b/machine/m_svr5.c
@@ -1437,10 +1437,3 @@ kmet_verify(
}
return;
}
-
-void
-get_io_info(struct io_info *io_info)
-{
- /* Not supported yet */
- memset(io_info, 0, sizeof(*io_info));
-}
diff --git a/pg_top.c b/pg_top.c
index 06b6e86..dbf6054 100644
--- a/pg_top.c
+++ b/pg_top.c
@@ -126,7 +126,6 @@ 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;
@@ -207,12 +206,6 @@ do_display(struct pg_top_context *pgtctx)
pgtctx->order_index, &pgtctx->conninfo);
}
- /* 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);
@@ -256,9 +249,6 @@ do_display(struct pg_top_context *pgtctx)
/* 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);
@@ -347,7 +337,6 @@ do_display(struct pg_top_context *pgtctx)
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;
@@ -551,7 +540,6 @@ reset_display(struct pg_top_context *pgtctx)
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;
@@ -1013,12 +1001,6 @@ main(int argc, char *argv[])
&pgtctx.conninfo);
}
- /* 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);
diff --git a/pg_top.h b/pg_top.h
index 5b6f93f..91078e5 100644
--- a/pg_top.h
+++ b/pg_top.h
@@ -96,7 +96,6 @@ struct pg_top_context
char *header_text;
char *header_processes;
char interactive;
- struct io_info io_info;
int mode;
int mode_remote; /* Mode for monitoring a remote database system. */
int order_index;