<row>
<entry role="catalog_table_entry">
<para role="column_definition">
- <structfield>wait_time</structfield> <type>bigint</type>
+ <structfield>wait_time</structfield> <type>double precision</type>
</para>
<para>
Total time spent waiting for locks of this type, in milliseconds.
TimestampDifference(get_timeout_start_time(DEADLOCK_TIMEOUT),
GetCurrentTimestamp(),
&secs, &usecs);
- msecs = secs * 1000 + usecs / 1000;
- usecs = usecs % 1000;
-
/* Increment the lock statistics counters if done waiting. */
if (myWaitStatus == PROC_WAIT_STATUS_OK)
- pgstat_count_lock_waits(locallock->tag.lock.locktag_type, msecs);
+ pgstat_count_lock_waits(locallock->tag.lock.locktag_type,
+ (PgStat_Counter) secs * 1000000 + usecs);
+
+ msecs = secs * 1000 + usecs / 1000;
+ usecs = usecs % 1000;
if (log_lock_waits)
{
* like lock acquisitions.
*/
void
-pgstat_count_lock_waits(uint8 locktag_type, long msecs)
+pgstat_count_lock_waits(uint8 locktag_type, PgStat_Counter usecs)
{
Assert(locktag_type <= LOCKTAG_LAST_TYPE);
PendingLockStats.stats[locktag_type].waits++;
- PendingLockStats.stats[locktag_type].wait_time += (PgStat_Counter) msecs;
+ PendingLockStats.stats[locktag_type].wait_time += usecs;
have_lockstats = true;
pgstat_report_fixed = true;
}
values[i++] = CStringGetTextDatum(locktypename);
values[i++] = Int64GetDatum(lck_stats->waits);
- values[i++] = Int64GetDatum(lck_stats->wait_time);
+ values[i++] = Float8GetDatum(pg_stat_us_to_ms(lck_stats->wait_time));
values[i++] = Int64GetDatum(lck_stats->fastpath_exceeded);
values[i] = TimestampTzGetDatum(lock_stats->stat_reset_timestamp);
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202606281
+#define CATALOG_VERSION_NO 202606301
#endif
{ oid => '6509', descr => 'statistics: per lock type statistics',
proname => 'pg_stat_get_lock', prorows => '10', proretset => 't',
provolatile => 'v', proparallel => 'r', prorettype => 'record',
- proargtypes => '', proallargtypes => '{text,int8,int8,int8,timestamptz}',
+ proargtypes => '', proallargtypes => '{text,int8,float8,int8,timestamptz}',
proargmodes => '{o,o,o,o,o}',
proargnames => '{locktype,waits,wait_time,fastpath_exceeded,stats_reset}',
prosrc => 'pg_stat_get_lock' },
typedef struct PgStat_LockEntry
{
PgStat_Counter waits;
- PgStat_Counter wait_time; /* time in milliseconds */
+ PgStat_Counter wait_time; /* time in microseconds */
PgStat_Counter fastpath_exceeded;
} PgStat_LockEntry;
extern void pgstat_lock_flush(bool nowait);
extern void pgstat_count_lock_fastpath_exceeded(uint8 locktag_type);
-extern void pgstat_count_lock_waits(uint8 locktag_type, long msecs);
+extern void pgstat_count_lock_waits(uint8 locktag_type,
+ PgStat_Counter usecs);
extern PgStat_Lock *pgstat_fetch_stat_lock(void);
/*