Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc427de4

Browse files
committed
Fix another portability bug in recent pgbench commit.
Commit547f04e produced errors on AIX/xlc while building plpython. Thenew code appears to be incompatible with the hack installed by commita11cf43. Without access to an AIX system to check, my guess is that_POSIX_C_SOURCE may be required for <time.h> to declare the things theheader needs to see, but plpython.h undefines it.For now, to unbreak build farm animal hoverfly, just move the newpg_time_usec_t support into pgbench.c. Perhaps later we could figureout what to rearrange to put it back into a header for wider use.Discussion:https://postgr.es/m/CA%2BhUKG%2BP%2BjcD%3Dx9%2BagyTdWtjpOT64MYiGic%2Bcbu_TD8CV%3D6A3w%40mail.gmail.com
1 parent68b34b2 commitc427de4

File tree

2 files changed

+25
-28
lines changed

2 files changed

+25
-28
lines changed

‎src/bin/pgbench/pgbench.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,13 @@ typedef struct SimpleStats
320320
doublesum2;/* sum of squared values */
321321
}SimpleStats;
322322

323+
/*
324+
* The instr_time type is expensive when dealing with time arithmetic. Define
325+
* a type to hold microseconds instead. Type int64 is good enough for about
326+
* 584500 years.
327+
*/
328+
typedefint64pg_time_usec_t;
329+
323330
/*
324331
* Data structure to hold various statistics: per-thread and per-script stats
325332
* are maintained and merged together.
@@ -658,6 +665,24 @@ static const PsqlScanCallbacks pgbench_callbacks = {
658665
NULL,/* don't need get_variable functionality */
659666
};
660667

668+
staticinlinepg_time_usec_t
669+
pg_time_now(void)
670+
{
671+
instr_timenow;
672+
673+
INSTR_TIME_SET_CURRENT(now);
674+
675+
return (pg_time_usec_t)INSTR_TIME_GET_MICROSEC(now);
676+
}
677+
678+
staticinlinevoid
679+
pg_time_now_lazy(pg_time_usec_t*now)
680+
{
681+
if ((*now)==0)
682+
(*now)=pg_time_now();
683+
}
684+
685+
#definePG_TIME_GET_DOUBLE(t) (0.000001 * (t))
661686

662687
staticvoid
663688
usage(void)

‎src/include/portability/instr_time.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -253,32 +253,4 @@ GetTimerFrequency(void)
253253
#defineINSTR_TIME_SET_CURRENT_LAZY(t) \
254254
(INSTR_TIME_IS_ZERO(t) ? INSTR_TIME_SET_CURRENT(t), true : false)
255255

256-
/*
257-
* Simpler convenient interface
258-
*
259-
* The instr_time type is expensive when dealing with time arithmetic.
260-
* Define a type to hold microseconds on top of this, suitable for
261-
* benchmarking performance measures, eg in "pgbench".
262-
*
263-
* Type int64 is good enough for about 584500 years.
264-
*/
265-
typedefint64pg_time_usec_t;
266-
267-
staticinlinepg_time_usec_t
268-
pg_time_now(void)
269-
{
270-
instr_timenow;
271-
272-
INSTR_TIME_SET_CURRENT(now);
273-
return (pg_time_usec_t)INSTR_TIME_GET_MICROSEC(now);
274-
}
275-
276-
staticinlinevoid
277-
pg_time_now_lazy(pg_time_usec_t*now)
278-
{
279-
if ((*now)==0)
280-
(*now)=pg_time_now();
281-
}
282-
283-
#definePG_TIME_GET_DOUBLE(t) (0.000001 * (t))
284256
#endif/* INSTR_TIME_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp