summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2005-05-09 11:31:34 +0000
committerNeil Conway <neilc@samurai.com>2005-05-09 11:31:34 +0000
commit4744c1a0a16d4fdad4196c9874e050936e1133ed (patch)
treef7d0464971f8d6046e0b3e8522e211869e14bbc7 /src/include
parentd8c21181ce406b313bddfdaf49d66458942c16ed (diff)
downloadpostgresql-4744c1a0a16d4fdad4196c9874e050936e1133ed.tar.gz
Complete the following TODO items:
* Add session start time to pg_stat_activity * Add the client IP address and port to pg_stat_activity Original patch from Magnus Hagander, code review by Neil Conway. Catalog version bumped. This patch sends the client IP address and port number in every statistics message; that's not ideal, but will be fixed up shortly.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/pg_proc.h8
-rw-r--r--src/include/pgstat.h8
3 files changed, 15 insertions, 5 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 5916608374..2579b032a5 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.266 2005/04/30 20:31:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.267 2005/05/09 11:31:34 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200504301
+#define CATALOG_VERSION_NO 200505091
#endif
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index c1912c0998..13468fc5be 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.360 2005/04/30 20:31:38 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.361 2005/05/09 11:31:34 neilc Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -2822,6 +2822,12 @@ DATA(insert OID = 1940 ( pg_stat_get_backend_activity PGNSP PGUID 12 f f t f s
DESCR("Statistics: Current query of backend");
DATA(insert OID = 2094 ( pg_stat_get_backend_activity_start PGNSP PGUID 12 f f t f s 1 1184 "23" _null_ _null_ _null_ pg_stat_get_backend_activity_start - _null_));
DESCR("Statistics: Start time for current query of backend");
+DATA(insert OID = 1391 ( pg_stat_get_backend_start PGNSP PGUID 12 f f t f s 1 1184 "23" _null_ _null_ _null_ pg_stat_get_backend_start - _null_));
+DESCR("Statistics: Start time for current backend session");
+DATA(insert OID = 1392 ( pg_stat_get_backend_client_addr PGNSP PGUID 12 f f t f s 1 869 "23" _null_ _null_ _null_ pg_stat_get_backend_client_addr - _null_));
+DESCR("Statistics: Address of client connected to backend");
+DATA(insert OID = 1393 ( pg_stat_get_backend_client_port PGNSP PGUID 12 f f t f s 1 23 "23" _null_ _null_ _null_ pg_stat_get_backend_client_port - _null_));
+DESCR("Statistics: Port number of client connected to backend");
DATA(insert OID = 1941 ( pg_stat_get_db_numbackends PGNSP PGUID 12 f f t f s 1 23 "26" _null_ _null_ _null_ pg_stat_get_db_numbackends - _null_ ));
DESCR("Statistics: Number of backends in database");
DATA(insert OID = 1942 ( pg_stat_get_db_xact_commit PGNSP PGUID 12 f f t f s 1 20 "26" _null_ _null_ _null_ pg_stat_get_db_xact_commit - _null_ ));
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 31e01e4ed4..e38e33536a 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -5,17 +5,17 @@
*
* Copyright (c) 2001-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.27 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.28 2005/05/09 11:31:33 neilc Exp $
* ----------
*/
#ifndef PGSTAT_H
#define PGSTAT_H
+#include "libpq/pqcomm.h"
#include "utils/hsearch.h"
#include "utils/nabstime.h"
#include "utils/rel.h"
-
/* ----------
* The types of backend/postmaster -> collector messages
* ----------
@@ -54,6 +54,7 @@ typedef struct PgStat_MsgHdr
int m_procpid;
Oid m_databaseid;
AclId m_userid;
+ SockAddr m_clientaddr;
} PgStat_MsgHdr;
/* ----------
@@ -231,8 +232,11 @@ typedef struct PgStat_StatBeEntry
Oid databaseid;
Oid userid;
int procpid;
+ AbsoluteTime start_sec;
+ int start_usec;
AbsoluteTime activity_start_sec;
int activity_start_usec;
+ SockAddr clientaddr;
char activity[PGSTAT_ACTIVITY_SIZE];
} PgStat_StatBeEntry;