mysql8.4/community-mysql-s390-tsc.patch
2024-02-05 16:59:12 +01:00

42 lines
1.7 KiB
Diff

Support s390/s390x in performance schema's cycle-counting functions.
Filed upstream at http://bugs.mysql.com/bug.php?id=59953
diff -up --recursive mysql-5.7.9.orig/include/my_rdtsc.h mysql-5.7.9/include/my_rdtsc.h
--- mysql-5.7.9.orig/include/my_rdtsc.h 2015-10-12 08:21:33.000000000 +0200
+++ mysql-5.7.9/include/my_rdtsc.h 2015-11-10 16:33:36.037432669 +0100
@@ -125,6 +125,7 @@ C_MODE_END
#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 --recursive mysql-5.7.9.orig/mysys/my_rdtsc.c mysql-5.7.9/mysys/my_rdtsc.c
--- mysql-5.7.9.orig/mysys/my_rdtsc.c 2015-10-12 08:21:33.000000000 +0200
+++ mysql-5.7.9/mysys/my_rdtsc.c 2015-11-10 16:33:36.038432668 +0100
@@ -183,6 +183,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();
@@ -487,6 +494,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