diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-14 19:10:29 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-14 19:10:29 +0000 |
commit | 3bc25384d7a698f25e418bdc5aa7cdd038477d9c (patch) | |
tree | 0d17e084e418a335ec4eb48470bf7847a9102a6e /src/bin/psql/command.c | |
parent | 719a115874226f6e294a7d1d81d7a8ae559768ad (diff) | |
download | postgresql-3bc25384d7a698f25e418bdc5aa7cdd038477d9c.tar.gz postgresql-3bc25384d7a698f25e418bdc5aa7cdd038477d9c.zip |
Move the "instr_time" typedef and associated macros into a new header
file portability/instr_time.h, and add a couple more macros to eliminate
some abstraction leakage we formerly had. Also update psql to use this
header instead of its own copy of nearly the same code.
This commit in itself is just code cleanup and shouldn't change anything.
It lays some groundwork for the upcoming function-stats patch, though.
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index f74ce951409..b86d67e9281 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2008, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.188 2008/05/08 17:04:26 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.189 2008/05/14 19:10:29 tgl Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -30,6 +30,8 @@ #include <sys/stat.h> /* for stat() */ #endif +#include "portability/instr_time.h" + #include "libpq-fe.h" #include "pqexpbuffer.h" #include "dumputils.h" @@ -282,24 +284,22 @@ exec_command(const char *cmd, else if (pg_strcasecmp(cmd, "copy") == 0) { /* Default fetch-it-all-and-print mode */ - TimevalStruct before, + instr_time before, after; - double elapsed_msec = 0; char *opt = psql_scan_slash_option(scan_state, OT_WHOLE_LINE, NULL, false); if (pset.timing) - GETTIMEOFDAY(&before); + INSTR_TIME_SET_CURRENT(before); success = do_copy(opt); if (pset.timing && success) { - GETTIMEOFDAY(&after); - elapsed_msec = DIFF_MSEC(&after, &before); - printf(_("Time: %.3f ms\n"), elapsed_msec); - + INSTR_TIME_SET_CURRENT(after); + INSTR_TIME_SUBTRACT(after, before); + printf(_("Time: %.3f ms\n"), INSTR_TIME_GET_MILLISEC(after)); } free(opt); |