diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/catalog/system_views.sql | 4 | ||||
-rw-r--r-- | src/backend/commands/explain.c | 20 | ||||
-rw-r--r-- | src/backend/executor/instrument.c | 6 | ||||
-rw-r--r-- | src/backend/postmaster/pgstat.c | 28 | ||||
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/pgstatfuncs.c | 12 |
6 files changed, 38 insertions, 36 deletions
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 4054b9e716e..9dacd01ecab 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -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; diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 81d63f87f10..e2b4b994b47 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -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); } } diff --git a/src/backend/executor/instrument.c b/src/backend/executor/instrument.c index 92e56d13ae6..c58ee3d3002 100644 --- a/src/backend/executor/instrument.c +++ b/src/backend/executor/instrument.c @@ -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); } diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index ee3ad1060ba..04f7c1aa711 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -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(); diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 2141487475d..1889941eda1 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -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++; diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index 288243a7787..0be55e007ca 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -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); } |