| 1 | #ifndef QUERY_RESPONSE_TIME_H |
| 2 | #define QUERY_RESPONSE_TIME_H |
| 3 | |
| 4 | /* |
| 5 | Settings for query response time |
| 6 | */ |
| 7 | |
| 8 | /* |
| 9 | Maximum string length for (10 ^ (-1 * QRT_STRING_NEGATIVE_POWER_LENGTH)) in text representation. |
| 10 | Example: for 6 is 0.000001 |
| 11 | Always 2 |
| 12 | |
| 13 | Maximum string length for (10 ^ (QRT_STRING_POSITIVE_POWER_LENGTH + 1) - 1) in text representation. |
| 14 | Example: for 7 is 9999999.0 |
| 15 | */ |
| 16 | #define QRT_TIME_STRING_POSITIVE_POWER_LENGTH 7 |
| 17 | #define QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH 7 |
| 18 | |
| 19 | /* |
| 20 | Minimum base for log - ALWAYS 2 |
| 21 | Maximum base for log: |
| 22 | */ |
| 23 | #define QRT_MAXIMUM_BASE 1000 |
| 24 | |
| 25 | /* |
| 26 | Filler for whole number (positive power) |
| 27 | Example: for |
| 28 | QRT_POSITIVE_POWER_FILLER ' ' |
| 29 | QRT_POSITIVE_POWER_LENGTH 7 |
| 30 | and number 7234 result is: |
| 31 | ' 7234' |
| 32 | */ |
| 33 | #define QRT_POSITIVE_POWER_FILLER "" |
| 34 | /* |
| 35 | Filler for fractional number. Similiary to whole number |
| 36 | */ |
| 37 | #define QRT_NEGATIVE_POWER_FILLER "0" |
| 38 | |
| 39 | /* |
| 40 | Message if time too big for statistic collecting (very long query) |
| 41 | */ |
| 42 | #define QRT_TIME_OVERFLOW "TOO LONG" |
| 43 | |
| 44 | #define QRT_DEFAULT_BASE 10 |
| 45 | |
| 46 | #define QRT_TIME_STRING_LENGTH \ |
| 47 | MY_MAX( (QRT_TIME_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TIME_STRING_NEGATIVE_POWER_LENGTH*/), \ |
| 48 | (sizeof(QRT_TIME_OVERFLOW) - 1) ) |
| 49 | |
| 50 | #define QRT_TOTAL_STRING_LENGTH \ |
| 51 | MY_MAX( (QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TOTAL_STRING_NEGATIVE_POWER_LENGTH*/), \ |
| 52 | (sizeof(QRT_TIME_OVERFLOW) - 1) ) |
| 53 | |
| 54 | extern ST_SCHEMA_TABLE query_response_time_table; |
| 55 | |
| 56 | #ifdef HAVE_RESPONSE_TIME_DISTRIBUTION |
| 57 | extern void query_response_time_init (); |
| 58 | extern void query_response_time_free (); |
| 59 | extern int query_response_time_flush (); |
| 60 | extern void query_response_time_collect(ulonglong query_time); |
| 61 | extern int query_response_time_fill (THD* thd, TABLE_LIST *tables, COND *cond); |
| 62 | |
| 63 | extern ulong opt_query_response_time_range_base; |
| 64 | extern my_bool opt_query_response_time_stats; |
| 65 | #endif // HAVE_RESPONSE_TIME_DISTRIBUTION |
| 66 | |
| 67 | #endif // QUERY_RESPONSE_TIME_H |
| 68 | |