mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
Rename I/O timing statistics columns to blk_read_time and blk_write_time.
This seems more consistent with the pre-existing choices for names of other statistics columns. Rename assorted internal identifiers to match.
This commit is contained in:
@@ -604,8 +604,8 @@ CREATE VIEW pg_stat_database AS
|
||||
pg_stat_get_db_temp_files(D.oid) AS temp_files,
|
||||
pg_stat_get_db_temp_bytes(D.oid) AS temp_bytes,
|
||||
pg_stat_get_db_deadlocks(D.oid) AS deadlocks,
|
||||
pg_stat_get_db_block_time_read(D.oid) / 1000 AS block_read_time,
|
||||
pg_stat_get_db_block_time_write(D.oid) / 1000 AS block_write_time,
|
||||
pg_stat_get_db_blk_read_time(D.oid) / 1000 AS blk_read_time,
|
||||
pg_stat_get_db_blk_write_time(D.oid) / 1000 AS blk_write_time,
|
||||
pg_stat_get_db_stat_reset_time(D.oid) AS stats_reset
|
||||
FROM pg_database D;
|
||||
|
||||
|
||||
@@ -1236,8 +1236,8 @@ ExplainNode(PlanState *planstate, List *ancestors,
|
||||
usage->local_blks_written > 0);
|
||||
bool has_temp = (usage->temp_blks_read > 0 ||
|
||||
usage->temp_blks_written > 0);
|
||||
bool has_timing = (!INSTR_TIME_IS_ZERO(usage->time_read) ||
|
||||
!INSTR_TIME_IS_ZERO(usage->time_write));
|
||||
bool has_timing = (!INSTR_TIME_IS_ZERO(usage->blk_read_time) ||
|
||||
!INSTR_TIME_IS_ZERO(usage->blk_write_time));
|
||||
|
||||
/* Show only positive counter values. */
|
||||
if (has_shared || has_local || has_temp)
|
||||
@@ -1299,12 +1299,12 @@ ExplainNode(PlanState *planstate, List *ancestors,
|
||||
{
|
||||
appendStringInfoSpaces(es->str, es->indent * 2);
|
||||
appendStringInfoString(es->str, "I/O Timings:");
|
||||
if (!INSTR_TIME_IS_ZERO(usage->time_read))
|
||||
appendStringInfo(es->str, " read=%0.2f",
|
||||
INSTR_TIME_GET_MILLISEC(usage->time_read));
|
||||
if (!INSTR_TIME_IS_ZERO(usage->time_write))
|
||||
appendStringInfo(es->str, " write=%0.2f",
|
||||
INSTR_TIME_GET_MILLISEC(usage->time_write));
|
||||
if (!INSTR_TIME_IS_ZERO(usage->blk_read_time))
|
||||
appendStringInfo(es->str, " read=%0.3f",
|
||||
INSTR_TIME_GET_MILLISEC(usage->blk_read_time));
|
||||
if (!INSTR_TIME_IS_ZERO(usage->blk_write_time))
|
||||
appendStringInfo(es->str, " write=%0.3f",
|
||||
INSTR_TIME_GET_MILLISEC(usage->blk_write_time));
|
||||
appendStringInfoChar(es->str, '\n');
|
||||
}
|
||||
}
|
||||
@@ -1320,8 +1320,8 @@ ExplainNode(PlanState *planstate, List *ancestors,
|
||||
ExplainPropertyLong("Local Written Blocks", usage->local_blks_written, es);
|
||||
ExplainPropertyLong("Temp Read Blocks", usage->temp_blks_read, es);
|
||||
ExplainPropertyLong("Temp Written Blocks", usage->temp_blks_written, es);
|
||||
ExplainPropertyFloat("I/O Read Time", INSTR_TIME_GET_MILLISEC(usage->time_read), 3, es);
|
||||
ExplainPropertyFloat("I/O Write Time", INSTR_TIME_GET_MILLISEC(usage->time_write), 3, es);
|
||||
ExplainPropertyFloat("I/O Read Time", INSTR_TIME_GET_MILLISEC(usage->blk_read_time), 3, es);
|
||||
ExplainPropertyFloat("I/O Write Time", INSTR_TIME_GET_MILLISEC(usage->blk_write_time), 3, es);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +145,8 @@ BufferUsageAccumDiff(BufferUsage *dst,
|
||||
dst->local_blks_written += add->local_blks_written - sub->local_blks_written;
|
||||
dst->temp_blks_read += add->temp_blks_read - sub->temp_blks_read;
|
||||
dst->temp_blks_written += add->temp_blks_written - sub->temp_blks_written;
|
||||
INSTR_TIME_ACCUM_DIFF(dst->time_read, add->time_read, sub->time_read);
|
||||
INSTR_TIME_ACCUM_DIFF(dst->time_write, add->time_write, sub->time_write);
|
||||
INSTR_TIME_ACCUM_DIFF(dst->blk_read_time,
|
||||
add->blk_read_time, sub->blk_read_time);
|
||||
INSTR_TIME_ACCUM_DIFF(dst->blk_write_time,
|
||||
add->blk_write_time, sub->blk_write_time);
|
||||
}
|
||||
|
||||
@@ -197,8 +197,8 @@ static PgStat_SubXactStatus *pgStatXactStack = NULL;
|
||||
|
||||
static int pgStatXactCommit = 0;
|
||||
static int pgStatXactRollback = 0;
|
||||
PgStat_Counter pgStatBlockTimeRead = 0;
|
||||
PgStat_Counter pgStatBlockTimeWrite = 0;
|
||||
PgStat_Counter pgStatBlockReadTime = 0;
|
||||
PgStat_Counter pgStatBlockWriteTime = 0;
|
||||
|
||||
/* Record that's written to 2PC state file when pgstat state is persisted */
|
||||
typedef struct TwoPhasePgStatRecord
|
||||
@@ -791,19 +791,19 @@ pgstat_send_tabstat(PgStat_MsgTabstat *tsmsg)
|
||||
{
|
||||
tsmsg->m_xact_commit = pgStatXactCommit;
|
||||
tsmsg->m_xact_rollback = pgStatXactRollback;
|
||||
tsmsg->m_block_time_read = pgStatBlockTimeRead;
|
||||
tsmsg->m_block_time_write = pgStatBlockTimeWrite;
|
||||
tsmsg->m_block_read_time = pgStatBlockReadTime;
|
||||
tsmsg->m_block_write_time = pgStatBlockWriteTime;
|
||||
pgStatXactCommit = 0;
|
||||
pgStatXactRollback = 0;
|
||||
pgStatBlockTimeRead = 0;
|
||||
pgStatBlockTimeWrite = 0;
|
||||
pgStatBlockReadTime = 0;
|
||||
pgStatBlockWriteTime = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tsmsg->m_xact_commit = 0;
|
||||
tsmsg->m_xact_rollback = 0;
|
||||
tsmsg->m_block_time_read = 0;
|
||||
tsmsg->m_block_time_write = 0;
|
||||
tsmsg->m_block_read_time = 0;
|
||||
tsmsg->m_block_write_time = 0;
|
||||
}
|
||||
|
||||
n = tsmsg->m_nentries;
|
||||
@@ -3360,8 +3360,8 @@ pgstat_get_db_entry(Oid databaseid, bool create)
|
||||
result->n_temp_files = 0;
|
||||
result->n_temp_bytes = 0;
|
||||
result->n_deadlocks = 0;
|
||||
result->n_block_time_read = 0;
|
||||
result->n_block_time_write = 0;
|
||||
result->n_block_read_time = 0;
|
||||
result->n_block_write_time = 0;
|
||||
|
||||
result->stat_reset_timestamp = GetCurrentTimestamp();
|
||||
|
||||
@@ -4080,8 +4080,8 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
|
||||
*/
|
||||
dbentry->n_xact_commit += (PgStat_Counter) (msg->m_xact_commit);
|
||||
dbentry->n_xact_rollback += (PgStat_Counter) (msg->m_xact_rollback);
|
||||
dbentry->n_block_time_read += msg->m_block_time_read;
|
||||
dbentry->n_block_time_write += msg->m_block_time_write;
|
||||
dbentry->n_block_read_time += msg->m_block_read_time;
|
||||
dbentry->n_block_write_time += msg->m_block_write_time;
|
||||
|
||||
/*
|
||||
* Process all table entries in the message.
|
||||
@@ -4278,8 +4278,8 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
|
||||
dbentry->n_temp_bytes = 0;
|
||||
dbentry->n_temp_files = 0;
|
||||
dbentry->n_deadlocks = 0;
|
||||
dbentry->n_block_time_read = 0;
|
||||
dbentry->n_block_time_write = 0;
|
||||
dbentry->n_block_read_time = 0;
|
||||
dbentry->n_block_write_time = 0;
|
||||
|
||||
dbentry->stat_reset_timestamp = GetCurrentTimestamp();
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
|
||||
INSTR_TIME_SET_CURRENT(io_time);
|
||||
INSTR_TIME_SUBTRACT(io_time, io_start);
|
||||
pgstat_count_buffer_read_time(INSTR_TIME_GET_MICROSEC(io_time));
|
||||
INSTR_TIME_ADD(pgBufferUsage.time_read, io_time);
|
||||
INSTR_TIME_ADD(pgBufferUsage.blk_read_time, io_time);
|
||||
}
|
||||
|
||||
/* check for garbage data */
|
||||
@@ -1952,7 +1952,7 @@ FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln)
|
||||
INSTR_TIME_SET_CURRENT(io_time);
|
||||
INSTR_TIME_SUBTRACT(io_time, io_start);
|
||||
pgstat_count_buffer_write_time(INSTR_TIME_GET_MICROSEC(io_time));
|
||||
INSTR_TIME_ADD(pgBufferUsage.time_write, io_time);
|
||||
INSTR_TIME_ADD(pgBufferUsage.blk_write_time, io_time);
|
||||
}
|
||||
|
||||
pgBufferUsage.shared_blks_written++;
|
||||
|
||||
@@ -82,8 +82,8 @@ extern Datum pg_stat_get_db_deadlocks(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_db_stat_reset_time(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_db_temp_files(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_db_temp_bytes(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_db_block_time_read(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_db_block_time_write(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_db_blk_read_time(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_db_blk_write_time(PG_FUNCTION_ARGS);
|
||||
|
||||
extern Datum pg_stat_get_bgwriter_timed_checkpoints(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_get_bgwriter_requested_checkpoints(PG_FUNCTION_ARGS);
|
||||
@@ -1362,7 +1362,7 @@ pg_stat_get_db_deadlocks(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_stat_get_db_block_time_read(PG_FUNCTION_ARGS)
|
||||
pg_stat_get_db_blk_read_time(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid dbid = PG_GETARG_OID(0);
|
||||
int64 result;
|
||||
@@ -1371,13 +1371,13 @@ pg_stat_get_db_block_time_read(PG_FUNCTION_ARGS)
|
||||
if ((dbentry = pgstat_fetch_stat_dbentry(dbid)) == NULL)
|
||||
result = 0;
|
||||
else
|
||||
result = (int64) (dbentry->n_block_time_read);
|
||||
result = (int64) (dbentry->n_block_read_time);
|
||||
|
||||
PG_RETURN_INT64(result);
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_stat_get_db_block_time_write(PG_FUNCTION_ARGS)
|
||||
pg_stat_get_db_blk_write_time(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid dbid = PG_GETARG_OID(0);
|
||||
int64 result;
|
||||
@@ -1386,7 +1386,7 @@ pg_stat_get_db_block_time_write(PG_FUNCTION_ARGS)
|
||||
if ((dbentry = pgstat_fetch_stat_dbentry(dbid)) == NULL)
|
||||
result = 0;
|
||||
else
|
||||
result = (int64) (dbentry->n_block_time_write);
|
||||
result = (int64) (dbentry->n_block_write_time);
|
||||
|
||||
PG_RETURN_INT64(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user