File: query_response_time.h

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (87 lines) | stat: -rw-r--r-- 2,755 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef QUERY_RESPONSE_TIME_H
#define QUERY_RESPONSE_TIME_H

/*
  Settings for query response time
*/

/*
  Maximum string length for (10 ^ (-1 * QRT_STRING_NEGATIVE_POWER_LENGTH)) in text representation.
  Example: for 6 is 0.000001
  Always 2

  Maximum string length for (10 ^ (QRT_STRING_POSITIVE_POWER_LENGTH + 1) - 1) in text representation.
  Example: for 7 is 9999999.0
*/
#define QRT_TIME_STRING_POSITIVE_POWER_LENGTH 7
#define QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH 7

/*
  Minimum base for log - ALWAYS 2
  Maximum base for log:
*/
#define QRT_MAXIMUM_BASE 1000

/*
  Filler for whole number (positive power)
  Example: for
  QRT_POSITIVE_POWER_FILLER ' '
  QRT_POSITIVE_POWER_LENGTH 7
  and number 7234 result is:
  '   7234'
*/
#define QRT_POSITIVE_POWER_FILLER ""
/*
  Filler for fractional number. Similiary to whole number
*/
#define QRT_NEGATIVE_POWER_FILLER "0"

/*
  Message if time too big for statistic collecting (very long query)
*/
#define QRT_TIME_OVERFLOW "TOO LONG"

#define QRT_DEFAULT_BASE 10

#define QRT_TIME_STRING_LENGTH				\
  MY_MAX( (QRT_TIME_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TIME_STRING_NEGATIVE_POWER_LENGTH*/), \
       (sizeof(QRT_TIME_OVERFLOW) - 1) )

#define QRT_TOTAL_STRING_LENGTH				\
  MY_MAX( (QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TOTAL_STRING_NEGATIVE_POWER_LENGTH*/), \
       (sizeof(QRT_TIME_OVERFLOW) - 1) )

extern ST_SCHEMA_TABLE query_response_time_table;

enum QUERY_TYPE
{
  ANY=    0,                                    /* Total */
  READ=   1,                                    /* Only reads */
  WRITE=  2                                     /* Only writes */
};

#define QUERY_TYPES (QUERY_TYPE::WRITE+1)

typedef class Item COND;

#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
extern void query_response_time_init();
extern void query_response_time_free();
extern int query_response_time_flush_all();
extern int query_response_time_flush_read();
extern int query_response_time_flush_write();
extern void query_response_time_collect(QUERY_TYPE type, ulonglong query_time);
extern int  query_response_time_fill(THD* thd, TABLE_LIST *tables,
                                     COND *cond);
extern int  query_response_time_fill_read(THD* thd, TABLE_LIST *tables,
                                        COND *cond);
extern int  query_response_time_fill_write(THD* thd, TABLE_LIST *tables,
                                        COND *cond);
extern int  query_response_time_fill_read_write(THD* thd, TABLE_LIST *tables,
                                                COND *cond);

extern ulong   opt_query_response_time_range_base;
extern my_bool opt_query_response_time_stats;
#endif // HAVE_RESPONSE_TIME_DISTRIBUTION

#endif // QUERY_RESPONSE_TIME_H