2011-02-04 17:52:14 +00:00
|
|
|
Support s390/s390x in performance schema's cycle-counting functions.
|
|
|
|
Filed upstream at http://bugs.mysql.com/bug.php?id=59953
|
|
|
|
|
|
|
|
|
2015-09-23 10:31:06 +00:00
|
|
|
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
|
2012-12-06 21:53:33 +00:00
|
|
|
@@ -125,6 +125,7 @@ C_MODE_END
|
2011-02-04 17:52:14 +00:00
|
|
|
#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
|
|
|
|
#define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27
|
2015-09-23 10:31:06 +00:00
|
|
|
#define MY_TIMER_ROUTINE_ASM_AARCH64 28
|
|
|
|
+#define MY_TIMER_ROUTINE_ASM_S390 29
|
2011-02-04 17:52:14 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-09-23 10:31:06 +00:00
|
|
|
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;
|
2011-02-04 17:52:14 +00:00
|
|
|
}
|
|
|
|
+#elif defined(__GNUC__) && defined(__s390__)
|
|
|
|
+ /* covers both s390 and s390x */
|
|
|
|
+ {
|
|
|
|
+ ulonglong result;
|
|
|
|
+ __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc");
|
2015-09-23 10:31:06 +00:00
|
|
|
+ return result;
|
2011-02-04 17:52:14 +00:00
|
|
|
+ }
|
|
|
|
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
|
|
|
/* gethrtime may appear as either cycle or nanosecond counter */
|
|
|
|
return (ulonglong) gethrtime();
|
2015-09-23 10:31:06 +00:00
|
|
|
@@ -487,6 +494,8 @@ void my_timer_init(MY_TIMER_INFO *mti)
|
2011-02-04 17:52:14 +00:00
|
|
|
mti->cycles.routine= MY_TIMER_ROUTINE_ASM_GCC_SPARC32;
|
2015-09-23 10:31:06 +00:00
|
|
|
#elif defined(__GNUC__) && defined(__aarch64__)
|
|
|
|
mti->cycles.routine= MY_TIMER_ROUTINE_ASM_AARCH64;
|
2011-02-04 17:52:14 +00:00
|
|
|
+#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
|