Support s390/s390x in performance schema's cycle-counting functions.
Filed upstream at http://bugs.mysql.com/bug.php?id=59953
diff -up mysql-8.0.17/include/my_rdtsc.h.patch2 mysql-8.0.17/include/my_rdtsc.h
--- mysql-8.0.17/include/my_rdtsc.h.patch2 2019-06-25 12:23:30.000000000 +0200
+++ mysql-8.0.17/include/my_rdtsc.h 2019-07-22 19:02:43.824388869 +0200
@@ -128,5 +128,6 @@ void my_timer_init(MY_TIMER_INFO *mti);
#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
#define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27
#define MY_TIMER_ROUTINE_ASM_AARCH64 28
+#define MY_TIMER_ROUTINE_ASM_S390 29
#endif
diff -up mysql-8.0.17/mysys/my_rdtsc.cc.patch2 mysql-8.0.17/mysys/my_rdtsc.cc
--- mysql-8.0.17/mysys/my_rdtsc.cc.patch2 2019-06-25 12:23:30.000000000 +0200
+++ mysql-8.0.17/mysys/my_rdtsc.cc 2019-07-22 19:04:03.227227901 +0200
@@ -204,6 +204,13 @@ ulonglong my_timer_cycles(void) {
__asm __volatile__("mrs %[rt],cntvct_el0" : [ rt ] "=r"(result));
return result;
}
+#elif defined(__GNUC__) && defined(__s390__)
+ /* covers both s390 and s390x */
+ {
+ ulonglong result;
+ __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc");
+ return result;
+ }
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
/* gethrtime may appear as either cycle or nanosecond counter */
return (ulonglong)gethrtime();
@@ -505,6 +512,8 @@ void my_timer_init(MY_TIMER_INFO *mti) {
mti->cycles.routine = MY_TIMER_ROUTINE_ASM_GCC_SPARC32;
#elif defined(__GNUC__) && defined(__aarch64__)
mti->cycles.routine = MY_TIMER_ROUTINE_ASM_AARCH64;
+#elif defined(__GNUC__) && defined(__s390__)
+ mti->cycles.routine = MY_TIMER_ROUTINE_ASM_S390;
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
mti->cycles.routine = MY_TIMER_ROUTINE_GETHRTIME;
#else