summaryrefslogtreecommitdiff
path: root/src/include/pgstat.h
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2012-04-05 11:37:31 -0400
committerRobert Haas <rhaas@postgresql.org>2012-04-05 11:40:24 -0400
commit644828908fb132ee1f1da5b8b7975c0d73d6158a (patch)
treecb90eb1d3f1953919b757d16c06ef447463dbdd3 /src/include/pgstat.h
parent05dbd4a7734e09bd1f835f4197d9befa1c00c4f3 (diff)
Expose track_iotiming data via the statistics collector.
Ants Aasma's original patch to add timing information for buffer I/O requests exposed this data at the relation level, which was judged too costly. I've here exposed it at the database level instead.
Diffstat (limited to 'src/include/pgstat.h')
-rw-r--r--src/include/pgstat.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 1281bd8b69f..b3618f28d01 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -233,6 +233,8 @@ typedef struct PgStat_MsgTabstat
int m_nentries;
int m_xact_commit;
int m_xact_rollback;
+ PgStat_Counter m_block_time_read;
+ PgStat_Counter m_block_time_write;
PgStat_TableEntry m_entry[PGSTAT_NUM_TABENTRIES];
} PgStat_MsgTabstat;
@@ -536,6 +538,8 @@ typedef struct PgStat_StatDBEntry
PgStat_Counter n_temp_files;
PgStat_Counter n_temp_bytes;
PgStat_Counter n_deadlocks;
+ PgStat_Counter n_block_time_read; /* times in microseconds */
+ PgStat_Counter n_block_time_write;
TimestampTz stat_reset_timestamp;
@@ -721,6 +725,12 @@ extern char *pgstat_stat_filename;
*/
extern PgStat_MsgBgWriter BgWriterStats;
+/*
+ * Updated by pgstat_count_time_* macros.
+ */
+extern PgStat_Counter pgStatBlockTimeRead;
+extern PgStat_Counter pgStatBlockTimeWrite;
+
/* ----------
* Functions called from postmaster
* ----------
@@ -816,6 +826,10 @@ extern void pgstat_initstats(Relation rel);
if ((rel)->pgstat_info != NULL) \
(rel)->pgstat_info->t_counts.t_blocks_hit++; \
} while (0)
+#define pgstat_count_buffer_read_time(n) \
+ pgStatBlockTimeRead += (n);
+#define pgstat_count_buffer_write_time(n) \
+ pgStatBlockTimeWrite += (n);
extern void pgstat_count_heap_insert(Relation rel, int n);
extern void pgstat_count_heap_update(Relation rel, bool hot);