24#define NUM_DIRECT 10000
41main(
int argc,
char *argv[])
76 if (
strcmp(argv[1],
"--help") == 0 ||
strcmp(argv[1],
"-?") == 0)
81 if (
strcmp(argv[1],
"--version") == 0 ||
strcmp(argv[1],
"-V") == 0)
97 if (endptr ==
optarg || *endptr !=
'\0' ||
119 if (endptr ==
optarg || *endptr !=
'\0' ||
errno != 0)
146 _(
"%s: too many command-line arguments (first is \"%s\")\n"),
154 "Testing timing overhead for %u seconds.\n\n",
182#if PG_INSTR_TSC_CLOCK
207 printf(
_(
"TSC calibration did not converge\n"));
211 printf(
_(
"TSC clock source will be used by default, unless timing_clock_source is set to 'system'.\n"));
213 printf(
_(
"TSC clock source will not be used by default, unless timing_clock_source is set to 'tsc'.\n"));
216 printf(
_(
"TSC clock source is not usable. Likely unable to determine TSC frequency. Are you running in an unsupported virtualized environment?\n"));
235#if PG_INSTR_TSC_CLOCK
318 printf(
_(
"Average loop time including overhead: %0.2f ns\n"),
330 const char *
header2 =
_(
"% of total");
331 const char *
header3 =
_(
"running %");
346 len2 =
Max(10, len2);
350 printf(
_(
"Histogram of timing durations:\n"));
351 printf(
"%*s %*s %*s %*s\n",
363 printf(
"%*ld %*.4f %*.4f %*lld\n",
371 printf(
"%*s %*s %*s %*s\n",
396 printf(
"%*d %*.4f %*.4f %*lld\n",
412 printf(
"%*d %*.4f %*.4f %*lld\n",
#define ngettext(s, p, n)
#define PG_TEXTDOMAIN(domain)
void set_pglocale_pgservice(const char *argv0, const char *app)
#define fprintf(file, fmt, msg)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
void pg_initialize_timing(void)
int32 timing_tsc_frequency_khz
bool pg_set_timing_clock_source(TimingClockSourceType source)
#define PG_INSTR_SYSTEM_CLOCK_NAME
#define INSTR_TIME_SET_CURRENT(t)
#define INSTR_TIME_GT(x, y)
#define INSTR_TIME_GET_NANOSEC(t)
#define INSTR_TIME_GET_DOUBLE(t)
#define INSTR_TIME_SET_CURRENT_FAST(t)
#define INSTR_TIME_SUBTRACT(x, y)
#define INSTR_TIME_ADD_NANOSEC(t, n)
static TimingClockSourceType pg_current_timing_clock_source(void)
@ TIMING_CLOCK_SOURCE_SYSTEM
@ TIMING_CLOCK_SOURCE_AUTO
static int pg_leftmost_one_pos32(uint32 word)
PGDLLIMPORT char * optarg
static rewind_source * source
static long long int histogram[32]
static void test_system_timing(void)
static int32 largest_diff
static void handle_args(int argc, char *argv[])
static long long int largest_diff_count
static uint64 test_timing(unsigned int duration, TimingClockSourceType source, bool fast_timing)
static const char * progname
static unsigned int test_duration
static long long int direct_histogram[NUM_DIRECT]
const char * get_progname(const char *argv0)