diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-04-28 16:03:57 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-04-28 16:03:57 -0400 |
commit | 93f94e356d47ea20ca7c2fcb65cbb746049fe4d1 (patch) | |
tree | dbcda7c998055cdd32363b8c902d31932a03b59e /contrib/pg_stat_statements | |
parent | cdbad241f41362aaf09f913722a541e04e048742 (diff) | |
download | postgresql-93f94e356d47ea20ca7c2fcb65cbb746049fe4d1.tar.gz postgresql-93f94e356d47ea20ca7c2fcb65cbb746049fe4d1.zip |
Adjust timing units in pg_stat_statements.
Display total time and I/O timings in milliseconds, for consistency with
the units used for timings in the core statistics views. The columns
remain of float8 type, so that sub-msec precision is available. (At some
point we will probably want to convert the core views to use float8 type
for the same reason, but this patch does not touch that issue.)
This is a release-note-requiring change in the meaning of the total_time
column. The I/O timing columns are new as of 9.2, so there is no
compatibility impact from redefining them.
Do some minor copy-editing in the documentation, too.
Diffstat (limited to 'contrib/pg_stat_statements')
-rw-r--r-- | contrib/pg_stat_statements/pg_stat_statements.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c index 5264d142942..6f936b7b261 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -101,7 +101,7 @@ typedef struct pgssHashKey typedef struct Counters { int64 calls; /* # of times executed */ - double total_time; /* total execution time in seconds */ + double total_time; /* total execution time, in msec */ int64 rows; /* total # of retrieved or affected rows */ int64 shared_blks_hit; /* # of shared buffer hits */ int64 shared_blks_read; /* # of shared disk blocks read */ @@ -113,8 +113,8 @@ typedef struct Counters int64 local_blks_written; /* # of local disk blocks written */ int64 temp_blks_read; /* # of temp blocks read */ int64 temp_blks_written; /* # of temp blocks written */ - double time_read; /* time spent reading in seconds */ - double time_write; /* time spent writing in seconds */ + double time_read; /* time spent reading, in msec */ + double time_write; /* time spent writing, in msec */ double usage; /* usage factor */ } Counters; @@ -752,7 +752,7 @@ pgss_ExecutorEnd(QueryDesc *queryDesc) pgss_store(queryDesc->sourceText, queryId, - queryDesc->totaltime->total, + queryDesc->totaltime->total * 1000.0, /* convert to msec */ queryDesc->estate->es_processed, &queryDesc->totaltime->bufusage, NULL); @@ -856,7 +856,7 @@ pgss_ProcessUtility(Node *parsetree, const char *queryString, pgss_store(queryString, queryId, - INSTR_TIME_GET_DOUBLE(duration), + INSTR_TIME_GET_MILLISEC(duration), rows, &bufusage, NULL); @@ -1021,9 +1021,9 @@ pgss_store(const char *query, uint32 queryId, e->counters.local_blks_written += bufusage->local_blks_written; e->counters.temp_blks_read += bufusage->temp_blks_read; e->counters.temp_blks_written += bufusage->temp_blks_written; - e->counters.time_read += INSTR_TIME_GET_DOUBLE(bufusage->time_read); - e->counters.time_write += INSTR_TIME_GET_DOUBLE(bufusage->time_write); - e->counters.usage += USAGE_EXEC(duration); + e->counters.time_read += INSTR_TIME_GET_MILLISEC(bufusage->time_read); + e->counters.time_write += INSTR_TIME_GET_MILLISEC(bufusage->time_write); + e->counters.usage += USAGE_EXEC(total_time); SpinLockRelease(&e->mutex); } |