Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
7bdc55cc
Commit
7bdc55cc
authored
18 years ago
by
Andrew Dunstan
Browse files
Options
Downloads
Patches
Plain Diff
enable \timing oputput for \copy commands
parent
281f4018
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/bin/psql/command.c
+18
-2
18 additions, 2 deletions
src/bin/psql/command.c
src/bin/psql/common.c
+1
-25
1 addition, 25 deletions
src/bin/psql/common.c
src/bin/psql/common.h
+28
-1
28 additions, 1 deletion
src/bin/psql/common.h
with
47 additions
and
28 deletions
src/bin/psql/command.c
+
18
−
2
View file @
7bdc55cc
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.17
4
2006/1
0/06 17:14:00 petere
Exp $
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.17
5
2006/1
2/16 00:38:43 adunstan
Exp $
*/
#include
"postgres_fe.h"
#include
"command.h"
...
...
@@ -303,10 +303,26 @@ exec_command(const char *cmd,
/* \copy */
else
if
(
pg_strcasecmp
(
cmd
,
"copy"
)
==
0
)
{
/* Default fetch-it-all-and-print mode */
TimevalStruct
before
,
after
;
double
elapsed_msec
=
0
;
char
*
opt
=
psql_scan_slash_option
(
scan_state
,
OT_WHOLE_LINE
,
NULL
,
false
);
if
(
pset
.
timing
)
GETTIMEOFDAY
(
&
before
);
success
=
do_copy
(
opt
);
if
(
pset
.
timing
&&
success
)
{
GETTIMEOFDAY
(
&
after
);
elapsed_msec
=
DIFF_MSEC
(
&
after
,
&
before
);
printf
(
_
(
"Time: %.3f ms
\n
"
),
elapsed_msec
);
}
free
(
opt
);
}
...
...
This diff is collapsed.
Click to expand it.
src/bin/psql/common.c
+
1
−
25
View file @
7bdc55cc
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.13
0
2006/1
0/04
00:3
0:05 momji
an Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.13
1
2006/1
2/16
00:3
8:43 adunst
an Exp $
*/
#include
"postgres_fe.h"
#include
"common.h"
...
...
@@ -11,12 +11,10 @@
#include
<ctype.h>
#include
<signal.h>
#ifndef WIN32
#include
<sys/time.h>
#include
<unistd.h>
/* for write() */
#else
#include
<io.h>
/* for _write() */
#include
<win32.h>
#include
<sys/timeb.h>
/* for _ftime() */
#endif
#include
"pqsignal.h"
...
...
@@ -28,28 +26,6 @@
#include
"mbprint.h"
/* Workarounds for Windows */
/* Probably to be moved up the source tree in the future, perhaps to be replaced by
* more specific checks like configure-style HAVE_GETTIMEOFDAY macros.
*/
#ifndef WIN32
typedef
struct
timeval
TimevalStruct
;
#define GETTIMEOFDAY(T) gettimeofday(T, NULL)
#define DIFF_MSEC(T, U) \
((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \
((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0)
#else
typedef
struct
_timeb
TimevalStruct
;
#define GETTIMEOFDAY(T) _ftime(T)
#define DIFF_MSEC(T, U) \
(((T)->time - (U)->time) * 1000.0 + \
((T)->millitm - (U)->millitm))
#endif
static
bool
ExecQueryUsingCursor
(
const
char
*
query
,
double
*
elapsed_msec
);
static
bool
command_no_begin
(
const
char
*
query
);
...
...
This diff is collapsed.
Click to expand it.
src/bin/psql/common.h
+
28
−
1
View file @
7bdc55cc
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.5
1
2006/1
0/04
00:3
0:05 momji
an Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.5
2
2006/1
2/16
00:3
8:43 adunst
an Exp $
*/
#ifndef COMMON_H
#define COMMON_H
...
...
@@ -63,4 +63,31 @@ extern const char *session_username(void);
extern
char
*
expand_tilde
(
char
**
filename
);
/* Workarounds for Windows */
/* Probably to be moved up the source tree in the future, perhaps to be replaced by
* more specific checks like configure-style HAVE_GETTIMEOFDAY macros.
*/
#ifndef WIN32
#include
<sys/time.h>
typedef
struct
timeval
TimevalStruct
;
#define GETTIMEOFDAY(T) gettimeofday(T, NULL)
#define DIFF_MSEC(T, U) \
((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \
((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0)
#else
typedef
struct
_timeb
TimevalStruct
;
#include
<sys/types.h>
#include
<sys/timeb.h>
#define GETTIMEOFDAY(T) _ftime(T)
#define DIFF_MSEC(T, U) \
(((T)->time - (U)->time) * 1000.0 + \
((T)->millitm - (U)->millitm))
#endif
#endif
/* COMMON_H */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment