1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

MDEV-19929 Add a startup message about PAUSE instruction timing

On IA-32 and AMD64 (x86-64) CPU implementations, the latency of the
PAUSE instruction (REPZ NOP that was repurposed from a no-operation
on the Intel Pentium 4) can vary a lot, and we may adjust the
my_cpu_relax_multiplier accordingly. Let us display the value of
that variable on startup if --log-warnings=3 or larger was specified.

Microsoft Windows is available for multiple instruction set architectures.
Therefore, we had better not assume that defined(_WIN32) implies the
availability of a PAUSE instruction.

Reviewed by: Sergey Vojtovich
This commit is contained in:
Marko Mäkelä
2026-02-20 08:33:35 +02:00
parent 8d15311b90
commit e23282a068
2 changed files with 8 additions and 2 deletions

View File

@@ -59,8 +59,8 @@
#define HMT_high()
#endif
#if defined __i386__ || defined __x86_64__ || defined _WIN32
# define HAVE_PAUSE_INSTRUCTION /* added in Intel Pentium 4 */
#if defined __i386__ || defined __x86_64__ || defined _M_IX86 || defined _M_X64
# define HAVE_PAUSE_INSTRUCTION /* no-op repurposed in Intel Pentium 4 */
#endif
#ifdef _WIN32

View File

@@ -6023,6 +6023,12 @@ int mysqld_main(int argc, char **argv)
mysqld_port, MYSQL_COMPILATION_COMMENT);
}
#ifdef HAVE_PAUSE_INSTRUCTION
if (global_system_variables.log_warnings > 2)
sql_print_information("Using PAUSE multiplier %u",
my_cpu_relax_multiplier);
#endif
#ifndef _WIN32
// try to keep fd=0 busy
if (please_close_stdin && !freopen("/dev/null", "r", stdin))