mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-8684: Remove delaying maths in ut_delay
Also introduce compiler barrier properly on all architectures.
This commit is contained in:
parent
d4ba50477e
commit
3d1a7cba71
4 changed files with 14 additions and 18 deletions
|
@ -89,9 +89,11 @@ private:
|
|||
independent way by using YieldProcessor. */
|
||||
# define UT_RELAX_CPU() YieldProcessor()
|
||||
# else
|
||||
# define UT_RELAX_CPU() __asm__ __volatile__ ("":::"memory")
|
||||
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
|
||||
# endif
|
||||
|
||||
#define UT_COMPILER_BARRIER() __asm__ __volatile__ ("":::"memory")
|
||||
|
||||
# if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
|
||||
# define UT_LOW_PRIORITY_CPU() __asm__ __volatile__ ("or 1,1,1")
|
||||
# define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__ ("or 2,2,2")
|
||||
|
@ -345,7 +347,7 @@ Runs an idle loop on CPU. The argument gives the desired delay
|
|||
in microseconds on 100 MHz Pentium + Visual C++.
|
||||
@return dummy value */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
void
|
||||
ut_delay(
|
||||
/*=====*/
|
||||
ulint delay); /*!< in: delay in microseconds on 100 MHz Pentium */
|
||||
|
|
|
@ -394,25 +394,21 @@ Runs an idle loop on CPU. The argument gives the desired delay
|
|||
in microseconds on 100 MHz Pentium + Visual C++.
|
||||
@return dummy value */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
void
|
||||
ut_delay(
|
||||
/*=====*/
|
||||
ulint delay) /*!< in: delay in microseconds on 100 MHz Pentium */
|
||||
{
|
||||
ulint i, j;
|
||||
ulint i;
|
||||
|
||||
UT_LOW_PRIORITY_CPU();
|
||||
|
||||
j = 0;
|
||||
|
||||
for (i = 0; i < delay * 50; i++) {
|
||||
j += i;
|
||||
UT_RELAX_CPU();
|
||||
UT_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
UT_RESUME_PRIORITY_CPU();
|
||||
|
||||
return(j);
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
|
|
|
@ -86,9 +86,11 @@ private:
|
|||
independent way by using YieldProcessor. */
|
||||
# define UT_RELAX_CPU() YieldProcessor()
|
||||
# else
|
||||
# define UT_RELAX_CPU() __asm__ __volatile__ ("":::"memory")
|
||||
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
|
||||
# endif
|
||||
|
||||
#define UT_COMPILER_BARRIER() __asm__ __volatile__ ("":::"memory")
|
||||
|
||||
# if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
|
||||
# define UT_LOW_PRIORITY_CPU() __asm__ __volatile__ ("or 1,1,1")
|
||||
# define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__ ("or 2,2,2")
|
||||
|
@ -337,7 +339,7 @@ Runs an idle loop on CPU. The argument gives the desired delay
|
|||
in microseconds on 100 MHz Pentium + Visual C++.
|
||||
@return dummy value */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
void
|
||||
ut_delay(
|
||||
/*=====*/
|
||||
ulint delay); /*!< in: delay in microseconds on 100 MHz Pentium */
|
||||
|
|
|
@ -395,25 +395,21 @@ Runs an idle loop on CPU. The argument gives the desired delay
|
|||
in microseconds on 100 MHz Pentium + Visual C++.
|
||||
@return dummy value */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
void
|
||||
ut_delay(
|
||||
/*=====*/
|
||||
ulint delay) /*!< in: delay in microseconds on 100 MHz Pentium */
|
||||
{
|
||||
ulint i, j;
|
||||
ulint i;
|
||||
|
||||
UT_LOW_PRIORITY_CPU();
|
||||
|
||||
j = 0;
|
||||
|
||||
for (i = 0; i < delay * 50; i++) {
|
||||
j += i;
|
||||
UT_RELAX_CPU();
|
||||
UT_COMPILER_BARRIER();
|
||||
}
|
||||
|
||||
UT_RESUME_PRIORITY_CPU();
|
||||
|
||||
return(j);
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
|
|
Loading…
Reference in a new issue