72#ifndef UNIV_NO_ERR_MSGS
74#include "mysqld_error.h"
79#define TEMP_INDEX_PREFIX_STR "\377"
82#if defined(HAVE_PAUSE_INSTRUCTION)
87#define UT_RELAX_CPU() __asm__ __volatile__("pause")
89#elif defined(HAVE_FAKE_PAUSE_INSTRUCTION)
90#define UT_RELAX_CPU() __asm__ __volatile__("rep; nop")
95#define UT_RELAX_CPU() YieldProcessor()
96#elif defined(__aarch64__)
103#define UT_RELAX_CPU() __asm__ __volatile__("isb" ::: "memory")
105#define UT_RELAX_CPU() __asm__ __volatile__("" ::: "memory")
108#if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
109#define UT_LOW_PRIORITY_CPU() __asm__ __volatile__("or 1,1,1")
110#define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__("or 2,2,2")
112#define UT_LOW_PRIORITY_CPU() ((void)0)
113#define UT_RESUME_PRIORITY_CPU() ((void)0)
117#define UT_RELAX_CPU()
120#ifndef UNIV_HOTBACKUP
155#define ut_2pow_remainder(n, m) ((n) & ((m)-1))
161#define ut_2pow_round(n, m) ((n) & ~((m)-1))
166#define ut_calc_align_down(n, m) ut_2pow_round(n, m)
172#define ut_calc_align(n, m) (((n) + ((m)-1)) & ~((m)-1))
192#define UT_BITS_IN_BYTES(b) (((b) + 7UL) / 8UL)
197#define ut_is_2pow(n) UNIV_LIKELY(!((n) & ((n)-1)))
203 return (strcmp(a, b) < 0);
287#define ut_vsnprintf(buf, size, fmt, ap) ((void)vsnprintf(buf, size, fmt, ap))
302 using SC = std::chrono::steady_clock;
312 template <
typename T = std::chrono::milliseconds>
314 return std::chrono::duration_cast<T>(SC::now() -
m_start).count();
321 template <
typename T,
typename Traits>
323 std::basic_ostream<T, Traits> &out,
const Timer &timer)
noexcept {
324 return out << timer.elapsed();
338void meb_sprintf_timestamp_without_extra_chars(
char *
buf);
369 const auto current_time = std::chrono::steady_clock::now();
370 const auto current_time_in_sec =
371 std::chrono::duration_cast<std::chrono::seconds>(
372 current_time.time_since_epoch())
376 static_cast<uint64_t
>(current_time_in_sec)) {
378 current_time_in_sec)) {
Allows to monitor an event processing times, allowing to throttle the processing to one per THROTTLE_...
Definition: ut0ut.h:362
static constexpr uint64_t THROTTLE_DELAY_SEC
Throttle all items within that amount seconds from the last non throttled one.
Definition: ut0ut.h:395
std::atomic< uint64_t > m_last_applied_time
Definition: ut0ut.h:391
Throttler()
Definition: ut0ut.h:364
bool apply()
Checks if the item should be processed or ignored to not process them more frequently than one per TH...
Definition: ut0ut.h:368
For measuring time elapsed.
Definition: ut0ut.h:300
std::chrono::steady_clock SC
Definition: ut0ut.h:302
void reset()
Reset the timer to the current time.
Definition: ut0ut.h:309
SC::time_point m_start
High resolution timer instance used for timimg.
Definition: ut0ut.h:329
int64_t elapsed() const noexcept
Definition: ut0ut.h:313
friend std::basic_ostream< T, Traits > & operator<<(std::basic_ostream< T, Traits > &out, const Timer &timer) noexcept
Print time elapsed since last reset (in milliseconds) to the stream.
Definition: ut0ut.h:322
Timer() noexcept
Constructor.
Definition: ut0ut.h:306
Global error codes for the database.
dberr_t
Definition: db0err.h:39
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1052
Definition: buf0block_hint.cc:30
const std::string FILE("FILE")
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
ulong spin_wait_pause_multiplier
The current value of @innodb_spin_wait_pause_multiplier.
Definition: ut0ut.cc:65
Macros for using atomics.
case opt name
Definition: sslopt-case.h:33
Wait_stats & operator+=(const Wait_stats &rhs)
Definition: ut0ut.h:346
Wait_stats(uint64_t wait_loops=0)
Definition: ut0ut.h:344
uint64_t wait_loops
Definition: ut0ut.h:342
Wait_stats operator+(const Wait_stats &rhs) const
Definition: ut0ut.h:351
bool any_waits() const
Definition: ut0ut.h:355
Definition: trx0trx.h:675
Functor that compares two C strings.
Definition: ut0ut.h:201
bool operator()(const char *a, const char *b) const
Definition: ut0ut.h:202
Include file for Sun RPC to compile out of the box.
unsigned long int ulint
Definition: univ.i:406
Debug utilities for Innobase.
void ut_copy_file(FILE *dest, FILE *src)
Catenate files.
Definition: ut0ut.cc:219
static int ut_pair_cmp(ulint a_h, ulint a_l, ulint b_h, ulint b_l)
Compare two pairs of integers.
const char * ut_strerr(dberr_t num)
Convert an error number to a human readable text message.
Definition: ut0ut.cc:290
ulint ut_2_power_up(ulint n)
Calculates fast the number rounded up to the nearest power of 2.
Definition: ut0ut.cc:123
#define ut_vsnprintf(buf, size, fmt, ap)
A wrapper for vsnprintf(3), formatted output conversion into a limited buffer.
Definition: ut0ut.h:287
static uint32_t ut_2_exp(uint32_t n)
Calculates 2 to power n.
char * ut_format_name(const char *name, char *formatted, ulint formatted_size)
Format a table name, quoted as an SQL identifier.
Definition: ut0ut.cc:189
void ut_format_byte_value(uint64_t data_bytes, std::string &data_str)
Convert byte value to string with unit.
Definition: ut0ut.cc:237
static int ut_ulint_cmp(ulint a, ulint b)
Compares two ulints.
std::string ut_get_name(const trx_t *trx, const char *name)
Get a fixed-length string, quoted as an SQL identifier.
Definition: ut0ut.cc:147
constexpr ulint ut_2_log(ulint n)
Calculates fast the 2-logarithm of a number, rounded upward to an integer.
Definition: ut0ut.ic:98
void ut_print_name(FILE *f, const trx_t *trx, const char *name)
Outputs a fixed-length string, quoted as an SQL identifier.
Definition: ut0ut.cc:163
ulint ut_delay(ulint delay)
Runs an idle loop on CPU.
Definition: ut0ut.cc:99
static void ut_pair_min(ulint *min_hi, ulint *min_lo, ulint a_hi, ulint a_lo, ulint b_hi, ulint b_lo)
Calculate the minimum of two pairs.
int n
Definition: xcom_base.cc:509