|
|
4b7078 |
Support s390/s390x in performance schema's cycle-counting functions.
|
|
|
4b7078 |
Filed upstream at http://bugs.mysql.com/bug.php?id=59953
|
|
|
4b7078 |
|
|
|
4b7078 |
|
|
|
4b7078 |
diff -up mariadb-10.0.10/include/my_rdtsc.h.p4 mariadb-10.0.10/include/my_rdtsc.h
|
|
|
4b7078 |
--- mariadb-10.0.10/include/my_rdtsc.h.p4 2014-03-30 19:56:36.000000000 +0200
|
|
|
4b7078 |
+++ mariadb-10.0.10/include/my_rdtsc.h 2014-04-07 16:13:55.227792169 +0200
|
|
|
4b7078 |
@@ -125,6 +125,7 @@ C_MODE_END
|
|
|
4b7078 |
#define MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME 25
|
|
|
4b7078 |
#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
|
|
|
4b7078 |
#define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27
|
|
|
4b7078 |
+#define MY_TIMER_ROUTINE_ASM_S390 28
|
|
|
4b7078 |
|
|
|
4b7078 |
#endif
|
|
|
4b7078 |
|
|
|
4b7078 |
diff -up mariadb-10.0.10/mysys/my_rdtsc.c.p4 mariadb-10.0.10/mysys/my_rdtsc.c
|
|
|
4b7078 |
--- mariadb-10.0.10/mysys/my_rdtsc.c.p4 2014-03-30 19:56:36.000000000 +0200
|
|
|
4b7078 |
+++ mariadb-10.0.10/mysys/my_rdtsc.c 2014-04-07 16:15:48.114901576 +0200
|
|
|
4b7078 |
@@ -224,6 +224,13 @@ ulonglong my_timer_cycles(void)
|
|
|
4b7078 |
clock_gettime(CLOCK_SGI_CYCLE, &tp);
|
|
|
4b7078 |
return (ulonglong) tp.tv_sec * 1000000000 + (ulonglong) tp.tv_nsec;
|
|
|
4b7078 |
}
|
|
|
4b7078 |
+#elif defined(__GNUC__) && defined(__s390__)
|
|
|
4b7078 |
+ /* covers both s390 and s390x */
|
|
|
4b7078 |
+ {
|
|
|
4b7078 |
+ ulonglong result;
|
|
|
4b7078 |
+ __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc");
|
|
|
4b7078 |
+ return result;
|
|
|
4b7078 |
+ }
|
|
|
4b7078 |
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
|
|
4b7078 |
/* gethrtime may appear as either cycle or nanosecond counter */
|
|
|
4b7078 |
return (ulonglong) gethrtime();
|
|
|
4b7078 |
@@ -533,6 +540,8 @@ void my_timer_init(MY_TIMER_INFO *mti)
|
|
|
4b7078 |
mti->cycles.routine= MY_TIMER_ROUTINE_ASM_GCC_SPARC32;
|
|
|
4b7078 |
#elif defined(__sgi) && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_SGI_CYCLE)
|
|
|
4b7078 |
mti->cycles.routine= MY_TIMER_ROUTINE_SGI_CYCLE;
|
|
|
4b7078 |
+#elif defined(__GNUC__) && defined(__s390__)
|
|
|
4b7078 |
+ mti->cycles.routine= MY_TIMER_ROUTINE_ASM_S390;
|
|
|
4b7078 |
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
|
|
4b7078 |
mti->cycles.routine= MY_TIMER_ROUTINE_GETHRTIME;
|
|
|
4b7078 |
#else
|