|
|
2aefdf |
Support s390/s390x in performance schema's cycle-counting functions.
|
|
|
2aefdf |
Filed upstream at http://bugs.mysql.com/bug.php?id=59953
|
|
|
2aefdf |
|
|
|
2aefdf |
diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h
|
|
|
2aefdf |
index 65f7df1..a28f470 100644
|
|
|
2aefdf |
--- a/include/my_rdtsc.h
|
|
|
2aefdf |
+++ b/include/my_rdtsc.h
|
|
|
2aefdf |
@@ -128,5 +128,6 @@ void my_timer_init(MY_TIMER_INFO *mti);
|
|
|
2aefdf |
#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
|
|
|
2aefdf |
#define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27
|
|
|
2aefdf |
#define MY_TIMER_ROUTINE_ASM_AARCH64 28
|
|
|
2aefdf |
+#define MY_TIMER_ROUTINE_ASM_S390 29
|
|
|
2aefdf |
|
|
|
2aefdf |
#endif
|
|
|
2aefdf |
diff --git a/mysys/my_rdtsc.cc b/mysys/my_rdtsc.cc
|
|
|
2aefdf |
index ec8e855..c3408b1 100644
|
|
|
2aefdf |
--- a/mysys/my_rdtsc.cc
|
|
|
2aefdf |
+++ b/mysys/my_rdtsc.cc
|
|
|
2aefdf |
@@ -204,6 +204,13 @@ ulonglong my_timer_cycles(void) {
|
|
|
2aefdf |
__asm __volatile__("mrs %[rt],cntvct_el0" : [ rt ] "=r"(result));
|
|
|
2aefdf |
return result;
|
|
|
2aefdf |
}
|
|
|
2aefdf |
+#elif defined(__GNUC__) && defined(__s390__)
|
|
|
2aefdf |
+ /* covers both s390 and s390x */
|
|
|
2aefdf |
+ {
|
|
|
2aefdf |
+ ulonglong result;
|
|
|
2aefdf |
+ __asm__ __volatile__ ("stck %0" : "=Q" (result) : : "cc");
|
|
|
2aefdf |
+ return result;
|
|
|
2aefdf |
+ }
|
|
|
2aefdf |
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
|
|
2aefdf |
/* gethrtime may appear as either cycle or nanosecond counter */
|
|
|
2aefdf |
return (ulonglong)gethrtime();
|
|
|
2aefdf |
@@ -505,6 +512,8 @@ void my_timer_init(MY_TIMER_INFO *mti) {
|
|
|
2aefdf |
mti->cycles.routine = MY_TIMER_ROUTINE_ASM_GCC_SPARC32;
|
|
|
2aefdf |
#elif defined(__GNUC__) && defined(__aarch64__)
|
|
|
2aefdf |
mti->cycles.routine = MY_TIMER_ROUTINE_ASM_AARCH64;
|
|
|
2aefdf |
+#elif defined(__GNUC__) && defined(__s390__)
|
|
|
2aefdf |
+ mti->cycles.routine = MY_TIMER_ROUTINE_ASM_S390;
|
|
|
2aefdf |
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
|
|
2aefdf |
mti->cycles.routine = MY_TIMER_ROUTINE_GETHRTIME;
|
|
|
2aefdf |
#else
|