summaryrefslogtreecommitdiff
path: root/src/include/pgstat.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-04-30 14:02:47 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2012-04-30 14:03:33 -0400
commit809e7e21af8cd24855f1802524a13bbaa823f929 (patch)
tree450387adf177bd65f21de4c29d6428852608a8b4 /src/include/pgstat.h
parent26471a51fc833e2ce58a2f16f891256d57dd28c6 (diff)
Converge all SQL-level statistics timing values to float8 milliseconds.
This patch adjusts the core statistics views to match the decision already taken for pg_stat_statements, that values representing elapsed time should be represented as float8 and measured in milliseconds. By using float8, we are no longer tied to a specific maximum precision of timing data. (Internally, it's still microseconds, but we could now change that without needing changes at the SQL level.) The columns affected are pg_stat_bgwriter.checkpoint_write_time pg_stat_bgwriter.checkpoint_sync_time pg_stat_database.blk_read_time pg_stat_database.blk_write_time pg_stat_user_functions.total_time pg_stat_user_functions.self_time pg_stat_xact_user_functions.total_time pg_stat_xact_user_functions.self_time The first four of these are new in 9.2, so there is no compatibility issue from changing them. The others require a release note comment that they are now double precision (and can show a fractional part) rather than bigint as before; also their underlying statistics functions now match the column definitions, instead of returning bigint microseconds.
Diffstat (limited to 'src/include/pgstat.h')
-rw-r--r--src/include/pgstat.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 8549d17f280..3583bbe3014 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -233,7 +233,7 @@ typedef struct PgStat_MsgTabstat
int m_nentries;
int m_xact_commit;
int m_xact_rollback;
- PgStat_Counter m_block_read_time;
+ PgStat_Counter m_block_read_time; /* times in microseconds */
PgStat_Counter m_block_write_time;
PgStat_TableEntry m_entry[PGSTAT_NUM_TABENTRIES];
} PgStat_MsgTabstat;
@@ -366,7 +366,7 @@ typedef struct PgStat_MsgBgWriter
PgStat_Counter m_buf_written_backend;
PgStat_Counter m_buf_fsync_backend;
PgStat_Counter m_buf_alloc;
- PgStat_Counter m_checkpoint_write_time;
+ PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */
PgStat_Counter m_checkpoint_sync_time;
} PgStat_MsgBgWriter;
@@ -407,8 +407,8 @@ typedef struct PgStat_MsgTempFile
typedef struct PgStat_FunctionCounts
{
PgStat_Counter f_numcalls;
- instr_time f_time;
- instr_time f_time_self;
+ instr_time f_total_time;
+ instr_time f_self_time;
} PgStat_FunctionCounts;
/* ----------
@@ -429,8 +429,8 @@ typedef struct PgStat_FunctionEntry
{
Oid f_id;
PgStat_Counter f_numcalls;
- PgStat_Counter f_time; /* times in microseconds */
- PgStat_Counter f_time_self;
+ PgStat_Counter f_total_time; /* times in microseconds */
+ PgStat_Counter f_self_time;
} PgStat_FunctionEntry;
/* ----------
@@ -545,7 +545,6 @@ typedef struct PgStat_StatDBEntry
TimestampTz stat_reset_timestamp;
-
/*
* tables and functions must be last in the struct, because we don't write
* the pointers out to the stats file.
@@ -601,8 +600,8 @@ typedef struct PgStat_StatFuncEntry
PgStat_Counter f_numcalls;
- PgStat_Counter f_time; /* times in microseconds */
- PgStat_Counter f_time_self;
+ PgStat_Counter f_total_time; /* times in microseconds */
+ PgStat_Counter f_self_time;
} PgStat_StatFuncEntry;
@@ -705,7 +704,7 @@ typedef struct PgStat_FunctionCallUsage
/* NULL means we are not tracking the current function call */
PgStat_FunctionCounts *fs;
/* Total time previously charged to function, as of function start */
- instr_time save_f_time;
+ instr_time save_f_total_time;
/* Backend-wide total time as of function start */
instr_time save_total;
/* system clock as of function start */
@@ -730,7 +729,7 @@ extern char *pgstat_stat_filename;
extern PgStat_MsgBgWriter BgWriterStats;
/*
- * Updated by pgstat_count_time_* macros.
+ * Updated by pgstat_count_buffer_*_time macros
*/
extern PgStat_Counter pgStatBlockReadTime;
extern PgStat_Counter pgStatBlockWriteTime;