|
|
031387 |
Support s390/s390x in performance schema's cycle-counting functions.
|
|
|
031387 |
Filed upstream at http://bugs.mysql.com/bug.php?id=59953
|
|
|
031387 |
|
|
|
031387 |
|
|
|
031387 |
diff -up mysql-5.5.28/include/my_rdtsc.h.p11 mysql-5.5.28/include/my_rdtsc.h
|
|
|
031387 |
--- mysql-5.5.28/include/my_rdtsc.h.p11 2012-08-29 10:50:46.000000000 +0200
|
|
|
031387 |
+++ mysql-5.5.28/include/my_rdtsc.h 2012-12-06 14:22:13.651823354 +0100
|
|
|
031387 |
@@ -125,6 +125,7 @@ C_MODE_END
|
|
|
031387 |
#define MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME 25
|
|
|
031387 |
#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
|
|
|
031387 |
#define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27
|
|
|
031387 |
+#define MY_TIMER_ROUTINE_ASM_S390 28
|
|
|
031387 |
|
|
|
031387 |
#endif
|
|
|
031387 |
|
|
|
031387 |
diff -up mysql-5.5.28/mysys/my_rdtsc.c.p11 mysql-5.5.28/mysys/my_rdtsc.c
|
|
|
031387 |
--- mysql-5.5.28/mysys/my_rdtsc.c.p11 2012-08-29 10:50:46.000000000 +0200
|
|
|
031387 |
+++ mysql-5.5.28/mysys/my_rdtsc.c 2012-12-06 14:22:13.672823375 +0100
|
|
|
031387 |
@@ -224,6 +224,13 @@ ulonglong my_timer_cycles(void)
|
|
|
031387 |
clock_gettime(CLOCK_SGI_CYCLE, &tp);
|
|
|
031387 |
return (ulonglong) tp.tv_sec * 1000000000 + (ulonglong) tp.tv_nsec;
|
|
|
031387 |
}
|
|
|
031387 |
+#elif defined(__GNUC__) && defined(__s390__)
|
|
|
031387 |
+ /* covers both s390 and s390x */
|
|
|
031387 |
+ {
|
|
|
031387 |
+ ulonglong result;
|
|
|
031387 |
+ __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc");
|
|
|
031387 |
+ return result;
|
|
|
031387 |
+ }
|
|
|
031387 |
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
|
|
031387 |
/* gethrtime may appear as either cycle or nanosecond counter */
|
|
|
031387 |
return (ulonglong) gethrtime();
|
|
|
031387 |
@@ -533,6 +540,8 @@ void my_timer_init(MY_TIMER_INFO *mti)
|
|
|
031387 |
mti->cycles.routine= MY_TIMER_ROUTINE_ASM_GCC_SPARC32;
|
|
|
031387 |
#elif defined(__sgi) && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_SGI_CYCLE)
|
|
|
031387 |
mti->cycles.routine= MY_TIMER_ROUTINE_SGI_CYCLE;
|
|
|
031387 |
+#elif defined(__GNUC__) && defined(__s390__)
|
|
|
031387 |
+ mti->cycles.routine= MY_TIMER_ROUTINE_ASM_S390;
|
|
|
031387 |
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
|
|
031387 |
mti->cycles.routine= MY_TIMER_ROUTINE_GETHRTIME;
|
|
|
031387 |
#else
|