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
|
|
|
|
|
2018-04-25 08:13:27 +00:00
|
|
|
diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h
|
2022-01-06 14:47:39 +00:00
|
|
|
index 6e378e94..7703cf85 100644
|
2018-04-25 08:13:27 +00:00
|
|
|
--- a/include/my_rdtsc.h
|
|
|
|
+++ b/include/my_rdtsc.h
|
2022-01-06 14:47:39 +00:00
|
|
|
@@ -137,5 +137,6 @@ void my_timer_init(MY_TIMER_INFO *mti);
|
2021-10-12 13:54:40 +00:00
|
|
|
/* #define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27 - No longer used */
|
2018-04-25 08:13:27 +00:00
|
|
|
#define MY_TIMER_ROUTINE_ASM_AARCH64 28
|
2022-01-06 14:47:39 +00:00
|
|
|
#define MY_TIMER_ROUTINE_GET_THREAD_TIMES 29
|
|
|
|
+#define MY_TIMER_ROUTINE_ASM_S390 30
|
2011-02-04 17:52:14 +00:00
|
|
|
|
|
|
|
#endif
|
2018-04-25 08:13:27 +00:00
|
|
|
diff --git a/mysys/my_rdtsc.cc b/mysys/my_rdtsc.cc
|
2022-01-06 14:47:39 +00:00
|
|
|
index 3869db57..655a955e 100644
|
2018-04-25 08:13:27 +00:00
|
|
|
--- a/mysys/my_rdtsc.cc
|
|
|
|
+++ b/mysys/my_rdtsc.cc
|
2022-01-06 14:47:39 +00:00
|
|
|
@@ -169,6 +169,13 @@ ulonglong my_timer_cycles(void) {
|
2019-08-02 11:44:21 +00:00
|
|
|
__asm __volatile__("mrs %[rt],cntvct_el0" : [ rt ] "=r"(result));
|
2015-09-23 10:31:06 +00:00
|
|
|
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 */
|
2018-04-25 08:13:27 +00:00
|
|
|
return (ulonglong)gethrtime();
|
2022-01-06 14:47:39 +00:00
|
|
|
@@ -491,6 +498,8 @@ void my_timer_init(MY_TIMER_INFO *mti) {
|
2021-10-12 13:54:40 +00:00
|
|
|
mti->cycles.routine = MY_TIMER_ROUTINE_ASM_GCC_SPARC64;
|
2015-09-23 10:31:06 +00:00
|
|
|
#elif defined(__GNUC__) && defined(__aarch64__)
|
2018-04-25 08:13:27 +00:00
|
|
|
mti->cycles.routine = MY_TIMER_ROUTINE_ASM_AARCH64;
|
2011-02-04 17:52:14 +00:00
|
|
|
+#elif defined(__GNUC__) && defined(__s390__)
|
2018-04-25 08:13:27 +00:00
|
|
|
+ mti->cycles.routine = MY_TIMER_ROUTINE_ASM_S390;
|
2011-02-04 17:52:14 +00:00
|
|
|
#elif defined(HAVE_SYS_TIMES_H) && defined(HAVE_GETHRTIME)
|
2018-04-25 08:13:27 +00:00
|
|
|
mti->cycles.routine = MY_TIMER_ROUTINE_GETHRTIME;
|
2011-02-04 17:52:14 +00:00
|
|
|
#else
|