Merge lp:~tsarev/percona-server/5.1_query_response_time_fix_bug_803867 into lp:percona-server/5.1

Proposed by Oleg Tsarev
Status: Merged
Merged at revision: 261
Proposed branch: lp:~tsarev/percona-server/5.1_query_response_time_fix_bug_803867
Merge into: lp:percona-server/5.1
Diff against target: 6553 lines (+3380/-2653)
19 files modified
fix-bug671764.patch (+2/-2)
mysql-test/have_response_time_distribution.inc (+0/-4)
mysql-test/have_response_time_distribution.require (+0/-2)
mysql-test/response-time-distribution.patch/percona_query_response_time-replication.result (+0/-67)
mysql-test/response-time-distribution.patch/percona_query_response_time-replication.test (+0/-59)
mysql-test/response-time-distribution.patch/percona_query_response_time-stored.result (+0/-313)
mysql-test/response-time-distribution.patch/percona_query_response_time-stored.test (+0/-90)
mysql-test/response-time-distribution.patch/percona_query_response_time.result (+0/-567)
mysql-test/response-time-distribution.patch/percona_query_response_time.test (+0/-68)
mysql-test/response-time-distribution.patch/percona_query_response_time_flush.inc (+0/-1)
mysql-test/response-time-distribution.patch/percona_query_response_time_show.inc (+0/-8)
mysql-test/response-time-distribution.patch/percona_query_response_time_sleep.inc (+0/-19)
percona_suite.patch (+12/-0)
response_time_distribution.patch (+3217/-1410)
series (+2/-1)
show_slave_status_nolock.patch (+2/-2)
show_temp_51.patch (+3/-3)
slow_extended.patch (+130/-25)
userstat.patch (+12/-12)
To merge this branch: bzr merge lp:~tsarev/percona-server/5.1_query_response_time_fix_bug_803867
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Alexey Kopytov Pending
Review via email: mp+67477@code.launchpad.net

This proposal supersedes a proposal from 2011-07-06.

Description of the change

http://jenkins.percona.com/view/Percona%20Server%205.1/job/percona-server-5.1-param/52/

Fixes for bugs #712393 #803867
1) I move query_response_time_collect call from intermediate of log_slow_statement to begin.
Reason of bug #712393 - log_slow_statement exit before call query_response_time_collect
2) I move all DBUG_EXECUTE_IF (what used in percona_query_response_time.test) from response_time_distribution.patch to slow_extended.patch
This functionality requires in the slow_extended sporadic fails
3) If we set "debug" variable:
    SET [SESSION|GLOBAL] debug="+d,query_exec_time_debug"
we can setup exact query_exec_time through set "debug" variable:
    SET [SESSION|GLOBAL] debug="+d,query_exec_time_TIMES";
where TIMES is [0.31|0.32|0.33|0.34|0.35|0.36|0.37|0.38|0.39|0.4|0.5|1.1|1.2|1.3|1.4|1.5|2.1|2.3|2.5]
After this commit we can also add special comment to the begin of query:
    /* query_exec_time="TIMES" */ QUERY;
This changes requires for test SQL_Slave_Thread query execution.
4) I replace logic:
/*----------------------------------------*/
    DBUG_EXECUTE_IF("query_exec_time_debug",
                    if (query_execution_time == 0)
                      opt_query_response_time_stats= 0;
                    else
                      opt_query_response_time_stats= 1;);
/*----------------------------------------*/
By following:
/*----------------------------------------*/
void query_response_time_collect_with_check(ulonglong query_exec_time)
{
  DBUG_ENTER("query_response_time_collect_with_check");
  bool collect= opt_query_response_time_stats;
  DBUG_EXECUTE_IF("query_exec_time_debug",
                  {
                    if (0 == query_exec_time)
                    {
                      collect= false;
                    }
                  });
  if(collect)
  {
    query_response_time_collect(query_exec_time);
  }
  DBUG_VOID_RETURN;
}
/*----------------------------------------*/
Otherwise debug-code has bad side-effect - set QUERY_RESPONSE_TIME_STATS to OFF if query shouldn't collect
5) I rewrite tests for response_time_distribution.patch, now all test unified and wouldn't have sporadic fails in the feature.
This change fixes the bug #803867.
6) I also remove mysql-test/response_time_distribution.patch and move to patch.
Now this is the suite "percona" and tests "query_response_time[-[stored|replication]]"
7) I also move have_response_time_distribution.[require|inc] to patch
8) I also add "percona_suite.patch" for include "percona" test suite to default suites list

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

* the patch adds a new file named response_time_distribution.patch.update. what is that for?

* we are going to move tests to the corresponding patches. so please change it so that all tests code to response_time_distribution.patch rather than a separate directory

* percona_query_response_time_show.inc: "\ No newline at end of file"

* percona_query_response_time_flush.inc: "\ No newline at end of file"

* too much conditional code in .inc files. It would actually be more simple and readable to move the _common_ code into .inc file(s) and let replication- and SP-related tests contain the rest.

* since most of the actual code changes occur in the response_time_distribution.patch.update which was apparently a mistake, I would like the above issues to be addressed before proceeding with review.

review: Needs Fixing
Revision history for this message
Stewart Smith (stewart) wrote :

minor style point:

0 == query_exec_time and similar, should be other way around, not having value first.

but am okay to merge this and see subsequent merge req fixing style.

Revision history for this message
Stewart Smith (stewart) wrote :

can approve merge req after Alexey okays it

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'fix-bug671764.patch'
2--- fix-bug671764.patch 2011-03-13 21:40:40 +0000
3+++ fix-bug671764.patch 2011-07-11 01:39:24 +0000
4@@ -8,7 +8,7 @@
5 diff -ruN a/configure.in b/configure.in
6 --- a/configure.in 2010-11-29 18:45:47.000000000 +0000
7 +++ b/configure.in 2010-11-29 18:45:51.000000000 +0000
8-@@ -2727,7 +2727,7 @@
9+@@ -2776,7 +2776,7 @@
10 MAN_DROP="$MAN_DROP embedded"
11 grep -v 'embedded' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
12 fi
13@@ -17,7 +17,7 @@
14 then
15 MAN_DROP="$MAN_DROP innodb"
16 grep -v 'inno' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
17-@@ -2806,7 +2806,7 @@
18+@@ -2855,7 +2855,7 @@
19 fi
20
21 # "innochecksum" is not in the "innobase/" subdirectory, but should be switched
22
23=== removed file 'mysql-test/have_response_time_distribution.inc'
24--- mysql-test/have_response_time_distribution.inc 2010-12-14 20:03:02 +0000
25+++ mysql-test/have_response_time_distribution.inc 1970-01-01 00:00:00 +0000
26@@ -1,4 +0,0 @@
27--- require r/have_response_time_distribution.require
28-disable_query_log;
29-show variables like 'have_response_time_distribution';
30-enable_query_log;
31
32=== removed file 'mysql-test/have_response_time_distribution.require'
33--- mysql-test/have_response_time_distribution.require 2010-12-14 20:03:02 +0000
34+++ mysql-test/have_response_time_distribution.require 1970-01-01 00:00:00 +0000
35@@ -1,2 +0,0 @@
36-Variable_name Value
37-have_response_time_distribution YES
38
39=== removed directory 'mysql-test/response-time-distribution.patch'
40=== removed file 'mysql-test/response-time-distribution.patch/percona_query_response_time-replication.result'
41--- mysql-test/response-time-distribution.patch/percona_query_response_time-replication.result 2011-05-26 11:10:25 +0000
42+++ mysql-test/response-time-distribution.patch/percona_query_response_time-replication.result 1970-01-01 00:00:00 +0000
43@@ -1,67 +0,0 @@
44-include/master-slave.inc
45-[connection master]
46-SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds";
47-DROP TABLE IF EXISTS t;
48-CREATE TABLE t(id INT);
49-SELECT * from t;
50-id
51-SELECT * from t;
52-id
53-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
54-Warnings:
55-Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
56-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
57-Variable_name Value
58-query_response_time_range_base 2
59-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
60-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
61-Variable_name Value
62-query_response_time_range_base 10
63-FLUSH QUERY_RESPONSE_TIME;
64-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=ON;
65-INSERT INTO t SELECT SLEEP(0.4);
66-Warnings:
67-Note 1592 Statement may not be safe to log in statement format.
68-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
69-SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
70-0
71-INSERT INTO t SELECT SLEEP(0.4);
72-Warnings:
73-Note 1592 Statement may not be safe to log in statement format.
74-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
75-SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
76-0
77-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
78-SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
79-2
80-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
81-SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
82-3
83-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
84-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
85-Variable_name Value
86-query_response_time_range_base 2
87-FLUSH QUERY_RESPONSE_TIME;
88-INSERT INTO t SELECT SLEEP(0.4);
89-Warnings:
90-Note 1592 Statement may not be safe to log in statement format.
91-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
92-SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
93-0
94-INSERT INTO t SELECT SLEEP(0.4);
95-Warnings:
96-Note 1592 Statement may not be safe to log in statement format.
97-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
98-SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
99-0
100-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
101-SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
102-2
103-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
104-SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
105-3
106-DROP TABLE IF EXISTS t;
107-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
108-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=OFF;
109-SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds";
110-include/rpl_end.inc
111
112=== removed file 'mysql-test/response-time-distribution.patch/percona_query_response_time-replication.test'
113--- mysql-test/response-time-distribution.patch/percona_query_response_time-replication.test 2011-05-26 11:10:25 +0000
114+++ mysql-test/response-time-distribution.patch/percona_query_response_time-replication.test 1970-01-01 00:00:00 +0000
115@@ -1,59 +0,0 @@
116---source include/have_response_time_distribution.inc
117---source include/master-slave.inc
118---source include/have_binlog_format_statement.inc
119---source include/have_debug.inc
120-SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds";
121-
122-connection master;
123--- disable_warnings
124-DROP TABLE IF EXISTS t;
125--- enable_warnings
126-CREATE TABLE t(id INT);
127-SELECT * from t;
128-
129-sync_slave_with_master;
130-
131-connection slave;
132-SELECT * from t;
133-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
134-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
135-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
136-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
137-source include/percona_query_response_time_flush.inc;
138-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=ON;
139-
140-connection master;
141-INSERT INTO t SELECT SLEEP(0.4);
142-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
143-INSERT INTO t SELECT SLEEP(0.4);
144-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
145-sync_slave_with_master;
146-
147-connection slave;
148-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
149-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
150-
151-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
152-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
153-source include/percona_query_response_time_flush.inc;
154-
155-connection master;
156-INSERT INTO t SELECT SLEEP(0.4);
157-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
158-INSERT INTO t SELECT SLEEP(0.4);
159-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
160-sync_slave_with_master;
161-
162-connection slave;
163-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
164-SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
165-
166-connection master;
167-DROP TABLE IF EXISTS t;
168-sync_slave_with_master;
169-connection slave;
170-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
171-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=OFF;
172-SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds";
173-
174---source include/rpl_end.inc
175
176=== removed file 'mysql-test/response-time-distribution.patch/percona_query_response_time-stored.result'
177--- mysql-test/response-time-distribution.patch/percona_query_response_time-stored.result 2010-12-06 03:08:42 +0000
178+++ mysql-test/response-time-distribution.patch/percona_query_response_time-stored.result 1970-01-01 00:00:00 +0000
179@@ -1,313 +0,0 @@
180-SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds";
181-CREATE FUNCTION test_f()
182-RETURNS CHAR(30) DETERMINISTIC
183-BEGIN
184-DECLARE first VARCHAR(5);
185-DECLARE second VARCHAR(5);
186-DECLARE result VARCHAR(20);
187-SELECT SLEEP(1.11) INTO first;
188-SET first= 'Hello';
189-SET second=', ';
190-SET result= CONCAT(first,second);
191-SET result= CONCAT(result,'world!');
192-RETURN result;
193-END/
194-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
195-Warnings:
196-Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
197-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
198-Variable_name Value
199-query_response_time_range_base 2
200-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
201-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
202-Variable_name Value
203-query_response_time_range_base 2
204-FLUSH QUERY_RESPONSE_TIME;
205-SELECT d.count,
206-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
207-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
208-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
209-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
210-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
211-count query_count query_total not_zero_region_count region_count
212-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
213-region_count
214-44
215-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
216-time
217- 0.000001
218- 0.000003
219- 0.000007
220- 0.000015
221- 0.000030
222- 0.000061
223- 0.000122
224- 0.000244
225- 0.000488
226- 0.000976
227- 0.001953
228- 0.003906
229- 0.007812
230- 0.015625
231- 0.031250
232- 0.062500
233- 0.125000
234- 0.250000
235- 0.500000
236- 1.000000
237- 2.000000
238- 4.000000
239- 8.000000
240- 16.000000
241- 32.000000
242- 64.000000
243- 128.000000
244- 256.000000
245- 512.000000
246- 1024.000000
247- 2048.000000
248- 4096.000000
249- 8192.000000
250- 16384.000000
251- 32768.000000
252- 65536.000000
253- 131072.000000
254- 262144.000000
255- 524288.000000
256- 1048576.00000
257- 2097152.00000
258- 4194304.00000
259- 8388608.00000
260-TOO LONG
261-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
262-SELECT test_f();
263-test_f()
264-Hello, world!
265-SELECT test_f();
266-test_f()
267-Hello, world!
268-SELECT test_f();
269-test_f()
270-Hello, world!
271-SELECT test_f();
272-test_f()
273-Hello, world!
274-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
275-SELECT d.count,
276-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
277-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
278-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
279-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
280-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
281-count query_count query_total not_zero_region_count region_count
282-4 4 4 1 44
283-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
284-region_count
285-44
286-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
287-time
288- 0.000001
289- 0.000003
290- 0.000007
291- 0.000015
292- 0.000030
293- 0.000061
294- 0.000122
295- 0.000244
296- 0.000488
297- 0.000976
298- 0.001953
299- 0.003906
300- 0.007812
301- 0.015625
302- 0.031250
303- 0.062500
304- 0.125000
305- 0.250000
306- 0.500000
307- 1.000000
308- 2.000000
309- 4.000000
310- 8.000000
311- 16.000000
312- 32.000000
313- 64.000000
314- 128.000000
315- 256.000000
316- 512.000000
317- 1024.000000
318- 2048.000000
319- 4096.000000
320- 8192.000000
321- 16384.000000
322- 32768.000000
323- 65536.000000
324- 131072.000000
325- 262144.000000
326- 524288.000000
327- 1048576.00000
328- 2097152.00000
329- 4194304.00000
330- 8388608.00000
331-TOO LONG
332-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
333-Variable_name Value
334-query_response_time_range_base 2
335-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
336-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
337-Variable_name Value
338-query_response_time_range_base 10
339-FLUSH QUERY_RESPONSE_TIME;
340-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
341-SELECT test_f();
342-test_f()
343-Hello, world!
344-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
345-SELECT d.count,
346-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
347-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
348-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
349-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
350-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
351-count query_count query_total not_zero_region_count region_count
352-1 1 1 1 14
353-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
354-region_count
355-14
356-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
357-time
358- 0.000001
359- 0.000010
360- 0.000100
361- 0.001000
362- 0.010000
363- 0.100000
364- 1.000000
365- 10.000000
366- 100.000000
367- 1000.000000
368- 10000.000000
369- 100000.000000
370- 1000000.00000
371-TOO LONG
372-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
373-Variable_name Value
374-query_response_time_range_base 10
375-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
376-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
377-Variable_name Value
378-query_response_time_range_base 7
379-FLUSH QUERY_RESPONSE_TIME;
380-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
381-SELECT test_f();
382-test_f()
383-Hello, world!
384-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
385-SELECT d.count,
386-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
387-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
388-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
389-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
390-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
391-count query_count query_total not_zero_region_count region_count
392-1 1 1 1 17
393-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
394-region_count
395-17
396-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
397-time
398- 0.000001
399- 0.000008
400- 0.000059
401- 0.000416
402- 0.002915
403- 0.020408
404- 0.142857
405- 1.000000
406- 7.000000
407- 49.000000
408- 343.000000
409- 2401.000000
410- 16807.000000
411- 117649.000000
412- 823543.000000
413- 5764801.00000
414-TOO LONG
415-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
416-Variable_name Value
417-query_response_time_range_base 7
418-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
419-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
420-Variable_name Value
421-query_response_time_range_base 156
422-FLUSH QUERY_RESPONSE_TIME;
423-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
424-SELECT test_f();
425-test_f()
426-Hello, world!
427-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
428-SELECT d.count,
429-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
430-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
431-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
432-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
433-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
434-count query_count query_total not_zero_region_count region_count
435-1 1 1 1 7
436-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
437-region_count
438-7
439-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
440-time
441- 0.000041
442- 0.006410
443- 1.000000
444- 156.000000
445- 24336.000000
446- 3796416.00000
447-TOO LONG
448-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
449-Variable_name Value
450-query_response_time_range_base 156
451-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
452-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
453-Variable_name Value
454-query_response_time_range_base 1000
455-FLUSH QUERY_RESPONSE_TIME;
456-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
457-SELECT test_f();
458-test_f()
459-Hello, world!
460-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
461-SELECT d.count,
462-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
463-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
464-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
465-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
466-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
467-count query_count query_total not_zero_region_count region_count
468-1 1 1 1 6
469-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
470-region_count
471-6
472-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
473-time
474- 0.000001
475- 0.001000
476- 1.000000
477- 1000.000000
478- 1000000.00000
479-TOO LONG
480-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
481-Variable_name Value
482-query_response_time_range_base 1000
483-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
484-Warnings:
485-Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
486-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
487-Variable_name Value
488-query_response_time_range_base 1000
489-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
490-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
491-DROP FUNCTION test_f;
492-SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds";
493
494=== removed file 'mysql-test/response-time-distribution.patch/percona_query_response_time-stored.test'
495--- mysql-test/response-time-distribution.patch/percona_query_response_time-stored.test 2010-12-14 20:03:02 +0000
496+++ mysql-test/response-time-distribution.patch/percona_query_response_time-stored.test 1970-01-01 00:00:00 +0000
497@@ -1,90 +0,0 @@
498---source include/have_response_time_distribution.inc
499---source include/have_debug.inc
500-SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds";
501-
502-delimiter /;
503-CREATE FUNCTION test_f()
504-RETURNS CHAR(30) DETERMINISTIC
505-BEGIN
506- DECLARE first VARCHAR(5);
507- DECLARE second VARCHAR(5);
508- DECLARE result VARCHAR(20);
509- SELECT SLEEP(1.11) INTO first;
510- SET first= 'Hello';
511- SET second=', ';
512- SET result= CONCAT(first,second);
513- SET result= CONCAT(result,'world!');
514- RETURN result;
515-END/
516-delimiter ;/
517-
518-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
519-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
520-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
521-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
522-
523-source include/percona_query_response_time_flush.inc;
524-source include/percona_query_response_time_show.inc;
525-
526-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
527-SELECT test_f();
528-SELECT test_f();
529-SELECT test_f();
530-SELECT test_f();
531-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
532-
533-source include/percona_query_response_time_show.inc;
534-
535-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
536-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
537-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
538-
539-source include/percona_query_response_time_flush.inc;
540-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
541-SELECT test_f();
542-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
543-
544-source include/percona_query_response_time_show.inc;
545-
546-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
547-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
548-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
549-
550-source include/percona_query_response_time_flush.inc;
551-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
552-SELECT test_f();
553-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
554-
555-source include/percona_query_response_time_show.inc;
556-
557-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
558-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
559-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
560-
561-source include/percona_query_response_time_flush.inc;
562-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
563-SELECT test_f();
564-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
565-
566-source include/percona_query_response_time_show.inc;
567-
568-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
569-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
570-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
571-
572-source include/percona_query_response_time_flush.inc;
573-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
574-SELECT test_f();
575-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
576-
577-source include/percona_query_response_time_show.inc;
578-
579-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
580-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
581-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
582-
583-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
584-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
585-
586-DROP FUNCTION test_f;
587-SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds";
588
589=== removed file 'mysql-test/response-time-distribution.patch/percona_query_response_time.result'
590--- mysql-test/response-time-distribution.patch/percona_query_response_time.result 2010-12-06 03:08:42 +0000
591+++ mysql-test/response-time-distribution.patch/percona_query_response_time.result 1970-01-01 00:00:00 +0000
592@@ -1,567 +0,0 @@
593-SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds";
594-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
595-Warnings:
596-Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
597-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
598-Variable_name Value
599-query_response_time_range_base 2
600-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
601-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
602-Variable_name Value
603-query_response_time_range_base 2
604-FLUSH QUERY_RESPONSE_TIME;
605-SELECT d.count,
606-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
607-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
608-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
609-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
610-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
611-count query_count query_total not_zero_region_count region_count
612-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
613-region_count
614-44
615-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
616-time
617- 0.000001
618- 0.000003
619- 0.000007
620- 0.000015
621- 0.000030
622- 0.000061
623- 0.000122
624- 0.000244
625- 0.000488
626- 0.000976
627- 0.001953
628- 0.003906
629- 0.007812
630- 0.015625
631- 0.031250
632- 0.062500
633- 0.125000
634- 0.250000
635- 0.500000
636- 1.000000
637- 2.000000
638- 4.000000
639- 8.000000
640- 16.000000
641- 32.000000
642- 64.000000
643- 128.000000
644- 256.000000
645- 512.000000
646- 1024.000000
647- 2048.000000
648- 4096.000000
649- 8192.000000
650- 16384.000000
651- 32768.000000
652- 65536.000000
653- 131072.000000
654- 262144.000000
655- 524288.000000
656- 1048576.00000
657- 2097152.00000
658- 4194304.00000
659- 8388608.00000
660-TOO LONG
661-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
662-SELECT SLEEP(0.31);
663-SLEEP(0.31)
664-0
665-SELECT SLEEP(0.32);
666-SLEEP(0.32)
667-0
668-SELECT SLEEP(0.33);
669-SLEEP(0.33)
670-0
671-SELECT SLEEP(0.34);
672-SLEEP(0.34)
673-0
674-SELECT SLEEP(0.35);
675-SLEEP(0.35)
676-0
677-SELECT SLEEP(0.36);
678-SLEEP(0.36)
679-0
680-SELECT SLEEP(0.37);
681-SLEEP(0.37)
682-0
683-SELECT SLEEP(0.38);
684-SLEEP(0.38)
685-0
686-SELECT SLEEP(0.39);
687-SLEEP(0.39)
688-0
689-SELECT SLEEP(0.40);
690-SLEEP(0.40)
691-0
692-SELECT SLEEP(1.1);
693-SLEEP(1.1)
694-0
695-SELECT SLEEP(1.2);
696-SLEEP(1.2)
697-0
698-SELECT SLEEP(1.3);
699-SLEEP(1.3)
700-0
701-SELECT SLEEP(1.5);
702-SLEEP(1.5)
703-0
704-SELECT SLEEP(1.4);
705-SLEEP(1.4)
706-0
707-SELECT SLEEP(0.5);
708-SLEEP(0.5)
709-0
710-SELECT SLEEP(2.1);
711-SLEEP(2.1)
712-0
713-SELECT SLEEP(2.3);
714-SLEEP(2.3)
715-0
716-SELECT SLEEP(2.5);
717-SLEEP(2.5)
718-0
719-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
720-SELECT d.count,
721-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
722-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
723-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
724-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
725-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
726-count query_count query_total not_zero_region_count region_count
727-10 19 15 4 44
728-1 19 15 4 44
729-5 19 15 4 44
730-3 19 15 4 44
731-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
732-region_count
733-44
734-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
735-time
736- 0.000001
737- 0.000003
738- 0.000007
739- 0.000015
740- 0.000030
741- 0.000061
742- 0.000122
743- 0.000244
744- 0.000488
745- 0.000976
746- 0.001953
747- 0.003906
748- 0.007812
749- 0.015625
750- 0.031250
751- 0.062500
752- 0.125000
753- 0.250000
754- 0.500000
755- 1.000000
756- 2.000000
757- 4.000000
758- 8.000000
759- 16.000000
760- 32.000000
761- 64.000000
762- 128.000000
763- 256.000000
764- 512.000000
765- 1024.000000
766- 2048.000000
767- 4096.000000
768- 8192.000000
769- 16384.000000
770- 32768.000000
771- 65536.000000
772- 131072.000000
773- 262144.000000
774- 524288.000000
775- 1048576.00000
776- 2097152.00000
777- 4194304.00000
778- 8388608.00000
779-TOO LONG
780-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
781-Variable_name Value
782-query_response_time_range_base 2
783-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
784-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
785-Variable_name Value
786-query_response_time_range_base 10
787-FLUSH QUERY_RESPONSE_TIME;
788-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
789-SELECT SLEEP(0.31);
790-SLEEP(0.31)
791-0
792-SELECT SLEEP(0.32);
793-SLEEP(0.32)
794-0
795-SELECT SLEEP(0.33);
796-SLEEP(0.33)
797-0
798-SELECT SLEEP(0.34);
799-SLEEP(0.34)
800-0
801-SELECT SLEEP(0.35);
802-SLEEP(0.35)
803-0
804-SELECT SLEEP(0.36);
805-SLEEP(0.36)
806-0
807-SELECT SLEEP(0.37);
808-SLEEP(0.37)
809-0
810-SELECT SLEEP(0.38);
811-SLEEP(0.38)
812-0
813-SELECT SLEEP(0.39);
814-SLEEP(0.39)
815-0
816-SELECT SLEEP(0.40);
817-SLEEP(0.40)
818-0
819-SELECT SLEEP(1.1);
820-SLEEP(1.1)
821-0
822-SELECT SLEEP(1.2);
823-SLEEP(1.2)
824-0
825-SELECT SLEEP(1.3);
826-SLEEP(1.3)
827-0
828-SELECT SLEEP(1.5);
829-SLEEP(1.5)
830-0
831-SELECT SLEEP(1.4);
832-SLEEP(1.4)
833-0
834-SELECT SLEEP(0.5);
835-SLEEP(0.5)
836-0
837-SELECT SLEEP(2.1);
838-SLEEP(2.1)
839-0
840-SELECT SLEEP(2.3);
841-SLEEP(2.3)
842-0
843-SELECT SLEEP(2.5);
844-SLEEP(2.5)
845-0
846-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
847-SELECT d.count,
848-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
849-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
850-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
851-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
852-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
853-count query_count query_total not_zero_region_count region_count
854-11 19 17 2 14
855-8 19 17 2 14
856-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
857-region_count
858-14
859-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
860-time
861- 0.000001
862- 0.000010
863- 0.000100
864- 0.001000
865- 0.010000
866- 0.100000
867- 1.000000
868- 10.000000
869- 100.000000
870- 1000.000000
871- 10000.000000
872- 100000.000000
873- 1000000.00000
874-TOO LONG
875-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
876-Variable_name Value
877-query_response_time_range_base 10
878-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
879-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
880-Variable_name Value
881-query_response_time_range_base 7
882-FLUSH QUERY_RESPONSE_TIME;
883-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
884-SELECT SLEEP(0.31);
885-SLEEP(0.31)
886-0
887-SELECT SLEEP(0.32);
888-SLEEP(0.32)
889-0
890-SELECT SLEEP(0.33);
891-SLEEP(0.33)
892-0
893-SELECT SLEEP(0.34);
894-SLEEP(0.34)
895-0
896-SELECT SLEEP(0.35);
897-SLEEP(0.35)
898-0
899-SELECT SLEEP(0.36);
900-SLEEP(0.36)
901-0
902-SELECT SLEEP(0.37);
903-SLEEP(0.37)
904-0
905-SELECT SLEEP(0.38);
906-SLEEP(0.38)
907-0
908-SELECT SLEEP(0.39);
909-SLEEP(0.39)
910-0
911-SELECT SLEEP(0.40);
912-SLEEP(0.40)
913-0
914-SELECT SLEEP(1.1);
915-SLEEP(1.1)
916-0
917-SELECT SLEEP(1.2);
918-SLEEP(1.2)
919-0
920-SELECT SLEEP(1.3);
921-SLEEP(1.3)
922-0
923-SELECT SLEEP(1.5);
924-SLEEP(1.5)
925-0
926-SELECT SLEEP(1.4);
927-SLEEP(1.4)
928-0
929-SELECT SLEEP(0.5);
930-SLEEP(0.5)
931-0
932-SELECT SLEEP(2.1);
933-SLEEP(2.1)
934-0
935-SELECT SLEEP(2.3);
936-SLEEP(2.3)
937-0
938-SELECT SLEEP(2.5);
939-SLEEP(2.5)
940-0
941-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
942-SELECT d.count,
943-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
944-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
945-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
946-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
947-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
948-count query_count query_total not_zero_region_count region_count
949-11 19 17 2 17
950-8 19 17 2 17
951-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
952-region_count
953-17
954-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
955-time
956- 0.000001
957- 0.000008
958- 0.000059
959- 0.000416
960- 0.002915
961- 0.020408
962- 0.142857
963- 1.000000
964- 7.000000
965- 49.000000
966- 343.000000
967- 2401.000000
968- 16807.000000
969- 117649.000000
970- 823543.000000
971- 5764801.00000
972-TOO LONG
973-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
974-Variable_name Value
975-query_response_time_range_base 7
976-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
977-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
978-Variable_name Value
979-query_response_time_range_base 156
980-FLUSH QUERY_RESPONSE_TIME;
981-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
982-SELECT SLEEP(0.31);
983-SLEEP(0.31)
984-0
985-SELECT SLEEP(0.32);
986-SLEEP(0.32)
987-0
988-SELECT SLEEP(0.33);
989-SLEEP(0.33)
990-0
991-SELECT SLEEP(0.34);
992-SLEEP(0.34)
993-0
994-SELECT SLEEP(0.35);
995-SLEEP(0.35)
996-0
997-SELECT SLEEP(0.36);
998-SLEEP(0.36)
999-0
1000-SELECT SLEEP(0.37);
1001-SLEEP(0.37)
1002-0
1003-SELECT SLEEP(0.38);
1004-SLEEP(0.38)
1005-0
1006-SELECT SLEEP(0.39);
1007-SLEEP(0.39)
1008-0
1009-SELECT SLEEP(0.40);
1010-SLEEP(0.40)
1011-0
1012-SELECT SLEEP(1.1);
1013-SLEEP(1.1)
1014-0
1015-SELECT SLEEP(1.2);
1016-SLEEP(1.2)
1017-0
1018-SELECT SLEEP(1.3);
1019-SLEEP(1.3)
1020-0
1021-SELECT SLEEP(1.5);
1022-SLEEP(1.5)
1023-0
1024-SELECT SLEEP(1.4);
1025-SLEEP(1.4)
1026-0
1027-SELECT SLEEP(0.5);
1028-SLEEP(0.5)
1029-0
1030-SELECT SLEEP(2.1);
1031-SLEEP(2.1)
1032-0
1033-SELECT SLEEP(2.3);
1034-SLEEP(2.3)
1035-0
1036-SELECT SLEEP(2.5);
1037-SLEEP(2.5)
1038-0
1039-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
1040-SELECT d.count,
1041-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
1042-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
1043-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
1044-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
1045-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
1046-count query_count query_total not_zero_region_count region_count
1047-11 19 17 2 7
1048-8 19 17 2 7
1049-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1050-region_count
1051-7
1052-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1053-time
1054- 0.000041
1055- 0.006410
1056- 1.000000
1057- 156.000000
1058- 24336.000000
1059- 3796416.00000
1060-TOO LONG
1061-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1062-Variable_name Value
1063-query_response_time_range_base 156
1064-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
1065-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1066-Variable_name Value
1067-query_response_time_range_base 1000
1068-FLUSH QUERY_RESPONSE_TIME;
1069-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
1070-SELECT SLEEP(0.31);
1071-SLEEP(0.31)
1072-0
1073-SELECT SLEEP(0.32);
1074-SLEEP(0.32)
1075-0
1076-SELECT SLEEP(0.33);
1077-SLEEP(0.33)
1078-0
1079-SELECT SLEEP(0.34);
1080-SLEEP(0.34)
1081-0
1082-SELECT SLEEP(0.35);
1083-SLEEP(0.35)
1084-0
1085-SELECT SLEEP(0.36);
1086-SLEEP(0.36)
1087-0
1088-SELECT SLEEP(0.37);
1089-SLEEP(0.37)
1090-0
1091-SELECT SLEEP(0.38);
1092-SLEEP(0.38)
1093-0
1094-SELECT SLEEP(0.39);
1095-SLEEP(0.39)
1096-0
1097-SELECT SLEEP(0.40);
1098-SLEEP(0.40)
1099-0
1100-SELECT SLEEP(1.1);
1101-SLEEP(1.1)
1102-0
1103-SELECT SLEEP(1.2);
1104-SLEEP(1.2)
1105-0
1106-SELECT SLEEP(1.3);
1107-SLEEP(1.3)
1108-0
1109-SELECT SLEEP(1.5);
1110-SLEEP(1.5)
1111-0
1112-SELECT SLEEP(1.4);
1113-SLEEP(1.4)
1114-0
1115-SELECT SLEEP(0.5);
1116-SLEEP(0.5)
1117-0
1118-SELECT SLEEP(2.1);
1119-SLEEP(2.1)
1120-0
1121-SELECT SLEEP(2.3);
1122-SLEEP(2.3)
1123-0
1124-SELECT SLEEP(2.5);
1125-SLEEP(2.5)
1126-0
1127-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
1128-SELECT d.count,
1129-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
1130-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
1131-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
1132-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
1133-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
1134-count query_count query_total not_zero_region_count region_count
1135-11 19 17 2 6
1136-8 19 17 2 6
1137-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1138-region_count
1139-6
1140-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1141-time
1142- 0.000001
1143- 0.001000
1144- 1.000000
1145- 1000.000000
1146- 1000000.00000
1147-TOO LONG
1148-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1149-Variable_name Value
1150-query_response_time_range_base 1000
1151-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
1152-Warnings:
1153-Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
1154-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1155-Variable_name Value
1156-query_response_time_range_base 1000
1157-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
1158-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
1159-SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds";
1160
1161=== removed file 'mysql-test/response-time-distribution.patch/percona_query_response_time.test'
1162--- mysql-test/response-time-distribution.patch/percona_query_response_time.test 2010-12-14 20:03:02 +0000
1163+++ mysql-test/response-time-distribution.patch/percona_query_response_time.test 1970-01-01 00:00:00 +0000
1164@@ -1,68 +0,0 @@
1165---source include/have_response_time_distribution.inc
1166---source include/have_debug.inc
1167-SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds";
1168-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
1169-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1170-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
1171-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1172-
1173-source include/percona_query_response_time_flush.inc;
1174-source include/percona_query_response_time_show.inc;
1175-
1176-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
1177-source include/percona_query_response_time_sleep.inc;
1178-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
1179-
1180-source include/percona_query_response_time_show.inc;
1181-
1182-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1183-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
1184-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1185-
1186-source include/percona_query_response_time_flush.inc;
1187-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
1188-source include/percona_query_response_time_sleep.inc;
1189-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
1190-
1191-source include/percona_query_response_time_show.inc;
1192-
1193-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1194-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
1195-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1196-
1197-source include/percona_query_response_time_flush.inc;
1198-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
1199-source include/percona_query_response_time_sleep.inc;
1200-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
1201-
1202-source include/percona_query_response_time_show.inc;
1203-
1204-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1205-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
1206-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1207-
1208-source include/percona_query_response_time_flush.inc;
1209-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
1210-source include/percona_query_response_time_sleep.inc;
1211-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
1212-
1213-source include/percona_query_response_time_show.inc;
1214-
1215-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1216-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
1217-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1218-
1219-source include/percona_query_response_time_flush.inc;
1220-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
1221-source include/percona_query_response_time_sleep.inc;
1222-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
1223-
1224-source include/percona_query_response_time_show.inc;
1225-
1226-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1227-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
1228-SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1229-
1230-SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
1231-SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
1232-SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds";
1233
1234=== removed file 'mysql-test/response-time-distribution.patch/percona_query_response_time_flush.inc'
1235--- mysql-test/response-time-distribution.patch/percona_query_response_time_flush.inc 2010-09-29 21:16:20 +0000
1236+++ mysql-test/response-time-distribution.patch/percona_query_response_time_flush.inc 1970-01-01 00:00:00 +0000
1237@@ -1,1 +0,0 @@
1238-FLUSH QUERY_RESPONSE_TIME;
1239
1240=== removed file 'mysql-test/response-time-distribution.patch/percona_query_response_time_show.inc'
1241--- mysql-test/response-time-distribution.patch/percona_query_response_time_show.inc 2010-09-29 21:16:20 +0000
1242+++ mysql-test/response-time-distribution.patch/percona_query_response_time_show.inc 1970-01-01 00:00:00 +0000
1243@@ -1,8 +0,0 @@
1244-SELECT d.count,
1245-(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
1246-(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
1247-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
1248-(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
1249-FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
1250-SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1251-SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1252
1253=== removed file 'mysql-test/response-time-distribution.patch/percona_query_response_time_sleep.inc'
1254--- mysql-test/response-time-distribution.patch/percona_query_response_time_sleep.inc 2010-09-29 21:16:20 +0000
1255+++ mysql-test/response-time-distribution.patch/percona_query_response_time_sleep.inc 1970-01-01 00:00:00 +0000
1256@@ -1,19 +0,0 @@
1257-SELECT SLEEP(0.31);
1258-SELECT SLEEP(0.32);
1259-SELECT SLEEP(0.33);
1260-SELECT SLEEP(0.34);
1261-SELECT SLEEP(0.35);
1262-SELECT SLEEP(0.36);
1263-SELECT SLEEP(0.37);
1264-SELECT SLEEP(0.38);
1265-SELECT SLEEP(0.39);
1266-SELECT SLEEP(0.40);
1267-SELECT SLEEP(1.1);
1268-SELECT SLEEP(1.2);
1269-SELECT SLEEP(1.3);
1270-SELECT SLEEP(1.5);
1271-SELECT SLEEP(1.4);
1272-SELECT SLEEP(0.5);
1273-SELECT SLEEP(2.1);
1274-SELECT SLEEP(2.3);
1275-SELECT SLEEP(2.5);
1276
1277=== added file 'percona_suite.patch'
1278--- percona_suite.patch 1970-01-01 00:00:00 +0000
1279+++ percona_suite.patch 2011-07-11 01:39:24 +0000
1280@@ -0,0 +1,12 @@
1281+diff -ruN a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
1282+--- a/mysql-test/mysql-test-run.pl 2011-04-12 15:11:40.000000000 +0300
1283++++ b/mysql-test/mysql-test-run.pl 2011-07-06 14:23:15.367219807 +0300
1284+@@ -157,7 +157,7 @@
1285+ # executables will be used by the test suite.
1286+ our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
1287+
1288+-my $DEFAULT_SUITES= "main,binlog,federated,rpl,rpl_ndb,ndb,innodb,innodb_plugin";
1289++my $DEFAULT_SUITES= "main,binlog,federated,rpl,rpl_ndb,ndb,innodb,innodb_plugin,percona";
1290+ my $opt_suites;
1291+
1292+ our $opt_verbose= 0; # Verbose output, enable with --verbose
1293
1294=== renamed file 'response-time-distribution.patch' => 'response_time_distribution.patch'
1295--- response-time-distribution.patch 2011-06-07 06:24:26 +0000
1296+++ response_time_distribution.patch 2011-07-11 01:39:24 +0000
1297@@ -1,13 +1,988 @@
1298-# name : response-time-distribution.patch
1299-# introduced : 12
1300-# maintainer : Oleg
1301-#
1302-#!!! notice !!!
1303-# Any small change to this file in the main branch
1304-# should be done or reviewed by the maintainer!
1305+diff -ruN a/configure.in b/configure.in
1306+--- a/configure.in 2011-07-11 04:31:52.859364018 +0300
1307++++ b/configure.in 2011-07-11 04:32:14.866520204 +0300
1308+@@ -1738,6 +1738,7 @@
1309+ int main()
1310+ {
1311+ int foo= -10; int bar= 10;
1312++ long long int foo64= -10; long long int bar64= 10;
1313+ if (!__sync_fetch_and_add(&foo, bar) || foo)
1314+ return -1;
1315+ bar= __sync_lock_test_and_set(&foo, bar);
1316+@@ -1746,6 +1747,14 @@
1317+ bar= __sync_val_compare_and_swap(&bar, foo, 15);
1318+ if (bar)
1319+ return -1;
1320++ if (!__sync_fetch_and_add(&foo64, bar64) || foo64)
1321++ return -1;
1322++ bar64= __sync_lock_test_and_set(&foo64, bar64);
1323++ if (bar64 || foo64 != 10)
1324++ return -1;
1325++ bar64= __sync_val_compare_and_swap(&bar64, foo, 15);
1326++ if (bar64)
1327++ return -1;
1328+ return 0;
1329+ }
1330+ ], [mysql_cv_gcc_atomic_builtins=yes],
1331+@@ -1757,6 +1766,46 @@
1332+ [Define to 1 if compiler provides atomic builtins.])
1333+ fi
1334+
1335++AC_CACHE_CHECK([whether the OS provides atomic_* functions like Solaris],
1336++ [mysql_cv_solaris_atomic],
1337++ [AC_RUN_IFELSE(
1338++ [AC_LANG_PROGRAM(
1339++ [[
1340++ #include <atomic.h>
1341++ ]],
1342++ [[
1343++ int foo = -10; int bar = 10;
1344++ int64_t foo64 = -10; int64_t bar64 = 10;
1345++ if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
1346++ return -1;
1347++ bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
1348++ if (bar || foo != 10)
1349++ return -1;
1350++ bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
1351++ if (bar)
1352++ return -1;
1353++ if (atomic_add_64_nv((volatile uint64_t *)&foo64, bar64) || foo64)
1354++ return -1;
1355++ bar64 = atomic_swap_64((volatile uint64_t *)&foo64, (uint64_t)bar64);
1356++ if (bar64 || foo64 != 10)
1357++ return -1;
1358++ bar64 = atomic_cas_64((volatile uint64_t *)&bar64, (uint_t)foo64, 15);
1359++ if (bar64)
1360++ return -1;
1361++ atomic_or_64((volatile uint64_t *)&bar64, 0);
1362++ return 0;
1363++ ]]
1364++ )],
1365++ [mysql_cv_solaris_atomic=yes],
1366++ [mysql_cv_solaris_atomic=no],
1367++ [mysql_cv_solaris_atomic=no]
1368++)])
1369++
1370++if test "x$mysql_cv_solaris_atomic" = xyes; then
1371++ AC_DEFINE(HAVE_SOLARIS_ATOMIC, 1,
1372++ [Define to 1 if OS provides atomic_* functions like Solaris.])
1373++fi
1374++
1375+ # Force static compilation to avoid linking problems/get more speed
1376+ AC_ARG_WITH(mysqld-ldflags,
1377+ [ --with-mysqld-ldflags Extra linking arguments for mysqld],
1378+@@ -2687,7 +2736,16 @@
1379+ AC_SUBST(readline_link)
1380+ AC_SUBST(readline_h_ln_cmd)
1381+
1382++AC_ARG_WITH(response_time_distribution,
1383++ AC_HELP_STRING([--without-response_time_distribution],[Disable response_time_distribution feature.]),
1384++ [with_response_time_distribution=$withval],
1385++ [with_response_time_distribution=yes]
1386++)
1387+
1388++if test "$with_response_time_distribution" = "yes"
1389++then
1390++ AC_DEFINE([HAVE_RESPONSE_TIME_DISTRIBUTION], [1], [If we want to have response_time_distribution])
1391++fi
1392+
1393+ # Include man pages, if desired, adapted to the configured parts.
1394+ if test X"$with_man" = Xyes
1395+diff -ruN a/include/atomic/gcc_builtins.h b/include/atomic/gcc_builtins.h
1396+--- a/include/atomic/gcc_builtins.h 1970-01-01 03:00:00.000000000 +0300
1397++++ b/include/atomic/gcc_builtins.h 2011-07-11 04:32:14.867520211 +0300
1398+@@ -0,0 +1,42 @@
1399++#ifndef ATOMIC_GCC_BUILTINS_INCLUDED
1400++#define ATOMIC_GCC_BUILTINS_INCLUDED
1401++
1402++/* Copyright (C) 2008 MySQL AB
1403++
1404++ This program is free software; you can redistribute it and/or modify
1405++ it under the terms of the GNU General Public License as published by
1406++ the Free Software Foundation; version 2 of the License.
1407++
1408++ This program is distributed in the hope that it will be useful,
1409++ but WITHOUT ANY WARRANTY; without even the implied warranty of
1410++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1411++ GNU General Public License for more details.
1412++
1413++ You should have received a copy of the GNU General Public License
1414++ along with this program; if not, write to the Free Software
1415++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1416++
1417++#define make_atomic_add_body(S) \
1418++ v= __sync_fetch_and_add(a, v);
1419++#define make_atomic_fas_body(S) \
1420++ v= __sync_lock_test_and_set(a, v);
1421++#define make_atomic_cas_body(S) \
1422++ int ## S sav; \
1423++ int ## S cmp_val= *cmp; \
1424++ sav= __sync_val_compare_and_swap(a, cmp_val, set);\
1425++ if (!(ret= (sav == cmp_val))) *cmp= sav
1426++
1427++#ifdef MY_ATOMIC_MODE_DUMMY
1428++#define make_atomic_load_body(S) ret= *a
1429++#define make_atomic_store_body(S) *a= v
1430++#define MY_ATOMIC_MODE "gcc-builtins-up"
1431++
1432++#else
1433++#define MY_ATOMIC_MODE "gcc-builtins-smp"
1434++#define make_atomic_load_body(S) \
1435++ ret= __sync_fetch_and_or(a, 0);
1436++#define make_atomic_store_body(S) \
1437++ (void) __sync_lock_test_and_set(a, v);
1438++#endif
1439++
1440++#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */
1441+diff -ruN a/include/atomic/generic-msvc.h b/include/atomic/generic-msvc.h
1442+--- a/include/atomic/generic-msvc.h 1970-01-01 03:00:00.000000000 +0300
1443++++ b/include/atomic/generic-msvc.h 2011-07-11 04:32:14.868520219 +0300
1444+@@ -0,0 +1,134 @@
1445++/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
1446++
1447++ This program is free software; you can redistribute it and/or modify
1448++ it under the terms of the GNU General Public License as published by
1449++ the Free Software Foundation; version 2 of the License.
1450++
1451++ This program is distributed in the hope that it will be useful,
1452++ but WITHOUT ANY WARRANTY; without even the implied warranty of
1453++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1454++ GNU General Public License for more details.
1455++
1456++ You should have received a copy of the GNU General Public License
1457++ along with this program; if not, write to the Free Software
1458++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1459++
1460++#ifndef _atomic_h_cleanup_
1461++#define _atomic_h_cleanup_ "atomic/generic-msvc.h"
1462++
1463++/*
1464++ We don't implement anything specific for MY_ATOMIC_MODE_DUMMY, always use
1465++ intrinsics.
1466++ 8 and 16-bit atomics are not implemented, but it can be done if necessary.
1467++*/
1468++#undef MY_ATOMIC_HAS_8_16
1469++
1470++#include <windows.h>
1471++/*
1472++ x86 compilers (both VS2003 or VS2005) never use instrinsics, but generate
1473++ function calls to kernel32 instead, even in the optimized build.
1474++ We force intrinsics as described in MSDN documentation for
1475++ _InterlockedCompareExchange.
1476++*/
1477++#ifdef _M_IX86
1478++
1479++#if (_MSC_VER >= 1500)
1480++#include <intrin.h>
1481++#else
1482++C_MODE_START
1483++/*Visual Studio 2003 and earlier do not have prototypes for atomic intrinsics*/
1484++LONG _InterlockedCompareExchange (LONG volatile *Target, LONG Value, LONG Comp);
1485++LONGLONG _InterlockedCompareExchange64 (LONGLONG volatile *Target,
1486++ LONGLONG Value, LONGLONG Comp);
1487++C_MODE_END
1488++
1489++#pragma intrinsic(_InterlockedCompareExchange)
1490++#pragma intrinsic(_InterlockedCompareExchange64)
1491++#endif
1492++
1493++#define InterlockedCompareExchange _InterlockedCompareExchange
1494++#define InterlockedCompareExchange64 _InterlockedCompareExchange64
1495++/*
1496++ No need to do something special for InterlockedCompareExchangePointer
1497++ as it is a #define to InterlockedCompareExchange. The same applies to
1498++ InterlockedExchangePointer.
1499++*/
1500++#endif /*_M_IX86*/
1501++
1502++#define MY_ATOMIC_MODE "msvc-intrinsics"
1503++/* Implement using CAS on WIN32 */
1504++#define IL_COMP_EXCHG32(X,Y,Z) \
1505++ InterlockedCompareExchange((volatile LONG *)(X),(Y),(Z))
1506++#define IL_COMP_EXCHG64(X,Y,Z) \
1507++ InterlockedCompareExchange64((volatile LONGLONG *)(X), \
1508++ (LONGLONG)(Y),(LONGLONG)(Z))
1509++#define IL_COMP_EXCHGptr InterlockedCompareExchangePointer
1510++
1511++#define make_atomic_cas_body(S) \
1512++ int ## S initial_cmp= *cmp; \
1513++ int ## S initial_a= IL_COMP_EXCHG ## S (a, set, initial_cmp); \
1514++ if (!(ret= (initial_a == initial_cmp))) *cmp= initial_a;
1515++
1516++#ifndef _M_IX86
1517++/* Use full set of optimised functions on WIN64 */
1518++#define IL_EXCHG_ADD32(X,Y) \
1519++ InterlockedExchangeAdd((volatile LONG *)(X),(Y))
1520++#define IL_EXCHG_ADD64(X,Y) \
1521++ InterlockedExchangeAdd64((volatile LONGLONG *)(X),(LONGLONG)(Y))
1522++#define IL_EXCHG32(X,Y) \
1523++ InterlockedExchange((volatile LONG *)(X),(Y))
1524++#define IL_EXCHG64(X,Y) \
1525++ InterlockedExchange64((volatile LONGLONG *)(X),(LONGLONG)(Y))
1526++#define IL_EXCHGptr InterlockedExchangePointer
1527++
1528++#define make_atomic_add_body(S) \
1529++ v= IL_EXCHG_ADD ## S (a, v)
1530++#define make_atomic_swap_body(S) \
1531++ v= IL_EXCHG ## S (a, v)
1532++#define make_atomic_load_body(S) \
1533++ ret= 0; /* avoid compiler warning */ \
1534++ ret= IL_COMP_EXCHG ## S (a, ret, ret);
1535++#endif
1536++/*
1537++ my_yield_processor (equivalent of x86 PAUSE instruction) should be used
1538++ to improve performance on hyperthreaded CPUs. Intel recommends to use it in
1539++ spin loops also on non-HT machines to reduce power consumption (see e.g
1540++ http://softwarecommunity.intel.com/articles/eng/2004.htm)
1541++
1542++ Running benchmarks for spinlocks implemented with InterlockedCompareExchange
1543++ and YieldProcessor shows that much better performance is achieved by calling
1544++ YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting
1545++ loop count in the range 200-300 brought best results.
1546++ */
1547++#ifndef YIELD_LOOPS
1548++#define YIELD_LOOPS 200
1549++#endif
1550++
1551++static __inline int my_yield_processor()
1552++{
1553++ int i;
1554++ for(i=0; i<YIELD_LOOPS; i++)
1555++ {
1556++#if (_MSC_VER <= 1310)
1557++ /* On older compilers YieldProcessor is not available, use inline assembly*/
1558++ __asm { rep nop }
1559++#else
1560++ YieldProcessor();
1561++#endif
1562++ }
1563++ return 1;
1564++}
1565++
1566++#define LF_BACKOFF my_yield_processor()
1567++#else /* cleanup */
1568++
1569++#undef IL_EXCHG_ADD32
1570++#undef IL_EXCHG_ADD64
1571++#undef IL_COMP_EXCHG32
1572++#undef IL_COMP_EXCHG64
1573++#undef IL_COMP_EXCHGptr
1574++#undef IL_EXCHG32
1575++#undef IL_EXCHG64
1576++#undef IL_EXCHGptr
1577++
1578++#endif
1579+diff -ruN a/include/atomic/nolock.h b/include/atomic/nolock.h
1580+--- a/include/atomic/nolock.h 1970-01-01 03:00:00.000000000 +0300
1581++++ b/include/atomic/nolock.h 2011-07-11 04:32:14.868520219 +0300
1582+@@ -0,0 +1,69 @@
1583++#ifndef ATOMIC_NOLOCK_INCLUDED
1584++#define ATOMIC_NOLOCK_INCLUDED
1585++
1586++/* Copyright (C) 2006 MySQL AB
1587++
1588++ This program is free software; you can redistribute it and/or modify
1589++ it under the terms of the GNU General Public License as published by
1590++ the Free Software Foundation; version 2 of the License.
1591++
1592++ This program is distributed in the hope that it will be useful,
1593++ but WITHOUT ANY WARRANTY; without even the implied warranty of
1594++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1595++ GNU General Public License for more details.
1596++
1597++ You should have received a copy of the GNU General Public License
1598++ along with this program; if not, write to the Free Software
1599++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1600++
1601++#if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \
1602++ || defined(HAVE_GCC_ATOMIC_BUILTINS) \
1603++ || defined(HAVE_SOLARIS_ATOMIC)
1604++
1605++# ifdef MY_ATOMIC_MODE_DUMMY
1606++# define LOCK_prefix ""
1607++# else
1608++# define LOCK_prefix "lock"
1609++# endif
1610++/*
1611++ We choose implementation as follows:
1612++ ------------------------------------
1613++ On Windows using Visual C++ the native implementation should be
1614++ preferrable. When using gcc we prefer the Solaris implementation
1615++ before the gcc because of stability preference, we choose gcc
1616++ builtins if available, otherwise we choose the somewhat broken
1617++ native x86 implementation. If neither Visual C++ or gcc we still
1618++ choose the Solaris implementation on Solaris (mainly for SunStudio
1619++ compilers).
1620++*/
1621++# if defined(_MSV_VER)
1622++# include "generic-msvc.h"
1623++# elif __GNUC__
1624++# if defined(HAVE_SOLARIS_ATOMIC)
1625++# include "solaris.h"
1626++# elif defined(HAVE_GCC_ATOMIC_BUILTINS)
1627++# include "gcc_builtins.h"
1628++# elif defined(__i386__) || defined(__x86_64__)
1629++# include "x86-gcc.h"
1630++# endif
1631++# elif defined(HAVE_SOLARIS_ATOMIC)
1632++# include "solaris.h"
1633++# endif
1634++#endif
1635++
1636++#if defined(make_atomic_cas_body)
1637++/*
1638++ Type not used so minimal size (emptry struct has different size between C
1639++ and C++, zero-length array is gcc-specific).
1640++*/
1641++typedef char my_atomic_rwlock_t __attribute__ ((unused));
1642++#define my_atomic_rwlock_destroy(name)
1643++#define my_atomic_rwlock_init(name)
1644++#define my_atomic_rwlock_rdlock(name)
1645++#define my_atomic_rwlock_wrlock(name)
1646++#define my_atomic_rwlock_rdunlock(name)
1647++#define my_atomic_rwlock_wrunlock(name)
1648++
1649++#endif
1650++
1651++#endif /* ATOMIC_NOLOCK_INCLUDED */
1652+diff -ruN a/include/atomic/rwlock.h b/include/atomic/rwlock.h
1653+--- a/include/atomic/rwlock.h 1970-01-01 03:00:00.000000000 +0300
1654++++ b/include/atomic/rwlock.h 2011-07-11 04:32:14.869520227 +0300
1655+@@ -0,0 +1,100 @@
1656++#ifndef ATOMIC_RWLOCK_INCLUDED
1657++#define ATOMIC_RWLOCK_INCLUDED
1658++
1659++/* Copyright (C) 2006 MySQL AB, 2009 Sun Microsystems, Inc.
1660++
1661++ This program is free software; you can redistribute it and/or modify
1662++ it under the terms of the GNU General Public License as published by
1663++ the Free Software Foundation; version 2 of the License.
1664++
1665++ This program is distributed in the hope that it will be useful,
1666++ but WITHOUT ANY WARRANTY; without even the implied warranty of
1667++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1668++ GNU General Public License for more details.
1669++
1670++ You should have received a copy of the GNU General Public License
1671++ along with this program; if not, write to the Free Software
1672++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1673++
1674++#define MY_ATOMIC_MODE_RWLOCKS 1
1675++
1676++#ifdef MY_ATOMIC_MODE_DUMMY
1677++/*
1678++ the following can never be enabled by ./configure, one need to put #define in
1679++ a source to trigger the following warning. The resulting code will be broken,
1680++ it only makes sense to do it to see now test_atomic detects broken
1681++ implementations (another way is to run a UP build on an SMP box).
1682++*/
1683++#warning MY_ATOMIC_MODE_DUMMY and MY_ATOMIC_MODE_RWLOCKS are incompatible
1684++
1685++typedef char my_atomic_rwlock_t;
1686++
1687++#define my_atomic_rwlock_destroy(name)
1688++#define my_atomic_rwlock_init(name)
1689++#define my_atomic_rwlock_rdlock(name)
1690++#define my_atomic_rwlock_wrlock(name)
1691++#define my_atomic_rwlock_rdunlock(name)
1692++#define my_atomic_rwlock_wrunlock(name)
1693++#define MY_ATOMIC_MODE "dummy (non-atomic)"
1694++#else /* not MY_ATOMIC_MODE_DUMMY */
1695++
1696++typedef struct {pthread_mutex_t rw;} my_atomic_rwlock_t;
1697++
1698++#ifndef SAFE_MUTEX
1699++
1700++/*
1701++ we're using read-write lock macros but map them to mutex locks, and they're
1702++ faster. Still, having semantically rich API we can change the
1703++ underlying implementation, if necessary.
1704++*/
1705++#define my_atomic_rwlock_destroy(name) pthread_mutex_destroy(& (name)->rw)
1706++#define my_atomic_rwlock_init(name) pthread_mutex_init(& (name)->rw, 0)
1707++#define my_atomic_rwlock_rdlock(name) pthread_mutex_lock(& (name)->rw)
1708++#define my_atomic_rwlock_wrlock(name) pthread_mutex_lock(& (name)->rw)
1709++#define my_atomic_rwlock_rdunlock(name) pthread_mutex_unlock(& (name)->rw)
1710++#define my_atomic_rwlock_wrunlock(name) pthread_mutex_unlock(& (name)->rw)
1711++
1712++#else /* SAFE_MUTEX */
1713++
1714++/*
1715++ SAFE_MUTEX pollutes the compiling name space with macros
1716++ that alter pthread_mutex_t, pthread_mutex_init, etc.
1717++ Atomic operations should never use the safe mutex wrappers.
1718++ Unfortunately, there is no way to have both:
1719++ - safe mutex macros expanding pthread_mutex_lock to safe_mutex_lock
1720++ - my_atomic macros expanding to unmodified pthread_mutex_lock
1721++ inlined in the same compilation unit.
1722++ So, in case of SAFE_MUTEX, a function call is required.
1723++ Given that SAFE_MUTEX is a debugging facility,
1724++ this extra function call is not a performance concern for
1725++ production builds.
1726++*/
1727++C_MODE_START
1728++extern void plain_pthread_mutex_init(safe_mutex_t *);
1729++extern void plain_pthread_mutex_destroy(safe_mutex_t *);
1730++extern void plain_pthread_mutex_lock(safe_mutex_t *);
1731++extern void plain_pthread_mutex_unlock(safe_mutex_t *);
1732++C_MODE_END
1733++
1734++#define my_atomic_rwlock_destroy(name) plain_pthread_mutex_destroy(&(name)->rw)
1735++#define my_atomic_rwlock_init(name) plain_pthread_mutex_init(&(name)->rw)
1736++#define my_atomic_rwlock_rdlock(name) plain_pthread_mutex_lock(&(name)->rw)
1737++#define my_atomic_rwlock_wrlock(name) plain_pthread_mutex_lock(&(name)->rw)
1738++#define my_atomic_rwlock_rdunlock(name) plain_pthread_mutex_unlock(&(name)->rw)
1739++#define my_atomic_rwlock_wrunlock(name) plain_pthread_mutex_unlock(&(name)->rw)
1740++
1741++#endif /* SAFE_MUTEX */
1742++
1743++#define MY_ATOMIC_MODE "mutex"
1744++#ifndef MY_ATOMIC_MODE_RWLOCKS
1745++#define MY_ATOMIC_MODE_RWLOCKS 1
1746++#endif
1747++#endif
1748++
1749++#define make_atomic_add_body(S) int ## S sav; sav= *a; *a+= v; v=sav;
1750++#define make_atomic_fas_body(S) int ## S sav; sav= *a; *a= v; v=sav;
1751++#define make_atomic_cas_body(S) if ((ret= (*a == *cmp))) *a= set; else *cmp=*a;
1752++#define make_atomic_load_body(S) ret= *a;
1753++#define make_atomic_store_body(S) *a= v;
1754++
1755++#endif /* ATOMIC_RWLOCK_INCLUDED */
1756+diff -ruN a/include/atomic/solaris.h b/include/atomic/solaris.h
1757+--- a/include/atomic/solaris.h 1970-01-01 03:00:00.000000000 +0300
1758++++ b/include/atomic/solaris.h 2011-07-11 04:32:14.869520227 +0300
1759+@@ -0,0 +1,72 @@
1760++/* Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc
1761++
1762++ This program is free software; you can redistribute it and/or modify
1763++ it under the terms of the GNU General Public License as published by
1764++ the Free Software Foundation; version 2 of the License.
1765++
1766++ This program is distributed in the hope that it will be useful,
1767++ but WITHOUT ANY WARRANTY; without even the implied warranty of
1768++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1769++ GNU General Public License for more details.
1770++
1771++ You should have received a copy of the GNU General Public License
1772++ along with this program; if not, write to the Free Software
1773++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1774++
1775++#ifndef _atomic_h_cleanup_
1776++#define _atomic_h_cleanup_ "atomic/solaris.h"
1777++
1778++#include <atomic.h>
1779++
1780++#define MY_ATOMIC_MODE "solaris-atomic"
1781++
1782++#if defined(__GNUC__)
1783++#define atomic_typeof(T,V) __typeof__(V)
1784++#else
1785++#define atomic_typeof(T,V) T
1786++#endif
1787++
1788++#define uintptr_t void *
1789++#define atomic_or_ptr_nv(X,Y) (void *)atomic_or_ulong_nv((volatile ulong_t *)X, Y)
1790++
1791++#define make_atomic_cas_body(S) \
1792++ atomic_typeof(uint ## S ## _t, *cmp) sav; \
1793++ sav = atomic_cas_ ## S( \
1794++ (volatile uint ## S ## _t *)a, \
1795++ (uint ## S ## _t)*cmp, \
1796++ (uint ## S ## _t)set); \
1797++ if (! (ret= (sav == *cmp))) \
1798++ *cmp= sav;
1799++
1800++#define make_atomic_add_body(S) \
1801++ int ## S nv; /* new value */ \
1802++ nv= atomic_add_ ## S ## _nv((volatile uint ## S ## _t *)a, v); \
1803++ v= nv - v
1804++
1805++/* ------------------------------------------------------------------------ */
1806++
1807++#ifdef MY_ATOMIC_MODE_DUMMY
1808++
1809++#define make_atomic_load_body(S) ret= *a
1810++#define make_atomic_store_body(S) *a= v
1811++
1812++#else /* MY_ATOMIC_MODE_DUMMY */
1813++
1814++#define make_atomic_load_body(S) \
1815++ ret= atomic_or_ ## S ## _nv((volatile uint ## S ## _t *)a, 0)
1816++
1817++#define make_atomic_store_body(S) \
1818++ (void) atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v)
1819++
1820++#endif
1821++
1822++#define make_atomic_fas_body(S) \
1823++ v= atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v)
1824++
1825++#else /* cleanup */
1826++
1827++#undef uintptr_t
1828++#undef atomic_or_ptr_nv
1829++
1830++#endif
1831++
1832+diff -ruN a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h
1833+--- a/include/atomic/x86-gcc.h 1970-01-01 03:00:00.000000000 +0300
1834++++ b/include/atomic/x86-gcc.h 2011-07-11 04:32:14.870520235 +0300
1835+@@ -0,0 +1,145 @@
1836++#ifndef ATOMIC_X86_GCC_INCLUDED
1837++#define ATOMIC_X86_GCC_INCLUDED
1838++
1839++/* Copyright (C) 2006 MySQL AB
1840++
1841++ This program is free software; you can redistribute it and/or modify
1842++ it under the terms of the GNU General Public License as published by
1843++ the Free Software Foundation; version 2 of the License.
1844++
1845++ This program is distributed in the hope that it will be useful,
1846++ but WITHOUT ANY WARRANTY; without even the implied warranty of
1847++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1848++ GNU General Public License for more details.
1849++
1850++ You should have received a copy of the GNU General Public License
1851++ along with this program; if not, write to the Free Software
1852++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1853++
1854++/*
1855++ XXX 64-bit atomic operations can be implemented using
1856++ cmpxchg8b, if necessary. Though I've heard that not all 64-bit
1857++ architectures support double-word (128-bit) cas.
1858++*/
1859++
1860++/*
1861++ No special support of 8 and 16 bit operations are implemented here
1862++ currently.
1863++*/
1864++#undef MY_ATOMIC_HAS_8_AND_16
1865++
1866++#ifdef __x86_64__
1867++# ifdef MY_ATOMIC_NO_XADD
1868++# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix "-no-xadd"
1869++# else
1870++# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix
1871++# endif
1872++#else
1873++# ifdef MY_ATOMIC_NO_XADD
1874++# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix "-no-xadd"
1875++# else
1876++# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix
1877++# endif
1878++#endif
1879++
1880++/* fix -ansi errors while maintaining readability */
1881++#ifndef asm
1882++#define asm __asm__
1883++#endif
1884++
1885++#ifndef MY_ATOMIC_NO_XADD
1886++#define make_atomic_add_body(S) make_atomic_add_body ## S
1887++#define make_atomic_cas_body(S) make_atomic_cas_body ## S
1888++#endif
1889++
1890++#define make_atomic_add_body32 \
1891++ asm volatile (LOCK_prefix "; xadd %0, %1;" \
1892++ : "+r" (v), "=m" (*a) \
1893++ : "m" (*a) \
1894++ : "memory")
1895++
1896++#define make_atomic_cas_body32 \
1897++ __typeof__(*cmp) sav; \
1898++ asm volatile (LOCK_prefix "; cmpxchg %3, %0; setz %2;" \
1899++ : "=m" (*a), "=a" (sav), "=q" (ret) \
1900++ : "r" (set), "m" (*a), "a" (*cmp) \
1901++ : "memory"); \
1902++ if (!ret) \
1903++ *cmp= sav
1904++
1905++#ifdef __x86_64__
1906++#define make_atomic_add_body64 make_atomic_add_body32
1907++#define make_atomic_cas_body64 make_atomic_cas_body32
1908++
1909++#define make_atomic_fas_body(S) \
1910++ asm volatile ("xchg %0, %1;" \
1911++ : "+r" (v), "=m" (*a) \
1912++ : "m" (*a) \
1913++ : "memory")
1914++
1915++/*
1916++ Actually 32/64-bit reads/writes are always atomic on x86_64,
1917++ nonetheless issue memory barriers as appropriate.
1918++*/
1919++#define make_atomic_load_body(S) \
1920++ /* Serialize prior load and store operations. */ \
1921++ asm volatile ("mfence" ::: "memory"); \
1922++ ret= *a; \
1923++ /* Prevent compiler from reordering instructions. */ \
1924++ asm volatile ("" ::: "memory")
1925++#define make_atomic_store_body(S) \
1926++ asm volatile ("; xchg %0, %1;" \
1927++ : "=m" (*a), "+r" (v) \
1928++ : "m" (*a) \
1929++ : "memory")
1930++
1931++#else
1932++/*
1933++ Use default implementations of 64-bit operations since we solved
1934++ the 64-bit problem on 32-bit platforms for CAS, no need to solve it
1935++ once more for ADD, LOAD, STORE and FAS as well.
1936++ Since we already added add32 support, we need to define add64
1937++ here, but we haven't defined fas, load and store at all, so
1938++ we can fallback on default implementations.
1939++*/
1940++#define make_atomic_add_body64 \
1941++ int64 tmp=*a; \
1942++ while (!my_atomic_cas64(a, &tmp, tmp+v)) ; \
1943++ v=tmp;
1944++
1945++/*
1946++ On some platforms (e.g. Mac OS X and Solaris) the ebx register
1947++ is held as a pointer to the global offset table. Thus we're not
1948++ allowed to use the b-register on those platforms when compiling
1949++ PIC code, to avoid this we push ebx and pop ebx. The new value
1950++ is copied directly from memory to avoid problems with a implicit
1951++ manipulation of the stack pointer by the push.
1952++
1953++ cmpxchg8b works on both 32-bit platforms and 64-bit platforms but
1954++ the code here is only used on 32-bit platforms, on 64-bit
1955++ platforms the much simpler make_atomic_cas_body32 will work
1956++ fine.
1957++*/
1958++#define make_atomic_cas_body64 \
1959++ asm volatile ("push %%ebx;" \
1960++ "movl (%%ecx), %%ebx;" \
1961++ "movl 4(%%ecx), %%ecx;" \
1962++ LOCK_prefix "; cmpxchg8b %0;" \
1963++ "setz %2; pop %%ebx" \
1964++ : "=m" (*a), "+A" (*cmp), "=c" (ret) \
1965++ : "c" (&set), "m" (*a) \
1966++ : "memory", "esp")
1967++#endif
1968++
1969++/*
1970++ The implementation of make_atomic_cas_body32 is adaptable to
1971++ the OS word size, so on 64-bit platforms it will automatically
1972++ adapt to 64-bits and so it will work also on 64-bit platforms
1973++*/
1974++#define make_atomic_cas_bodyptr make_atomic_cas_body32
1975++
1976++#ifdef MY_ATOMIC_MODE_DUMMY
1977++#define make_atomic_load_body(S) ret=*a
1978++#define make_atomic_store_body(S) *a=v
1979++#endif
1980++#endif /* ATOMIC_X86_GCC_INCLUDED */
1981+diff -ruN a/include/Makefile.am b/include/Makefile.am
1982+--- a/include/Makefile.am 2011-04-12 15:11:35.000000000 +0300
1983++++ b/include/Makefile.am 2011-07-11 04:32:14.870520235 +0300
1984+@@ -38,7 +38,10 @@
1985+ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
1986+ thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
1987+ my_compare.h my_time.h my_vle.h my_user.h \
1988+- my_libwrap.h my_stacktrace.h
1989++ my_libwrap.h my_stacktrace.h my_atomic.h \
1990++ atomic/gcc_builtins.h atomic/generic-msvc.h \
1991++ atomic/nolock.h atomic/rwlock.h atomic/solaris.h \
1992++ atomic/x86-gcc.h
1993+
1994+ EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp
1995+
1996+diff -ruN a/include/my_atomic.h b/include/my_atomic.h
1997+--- a/include/my_atomic.h 1970-01-01 03:00:00.000000000 +0300
1998++++ b/include/my_atomic.h 2011-07-11 04:32:14.872520248 +0300
1999+@@ -0,0 +1,287 @@
2000++#ifndef MY_ATOMIC_INCLUDED
2001++#define MY_ATOMIC_INCLUDED
2002++
2003++/* Copyright (C) 2006 MySQL AB
2004++
2005++ This program is free software; you can redistribute it and/or modify
2006++ it under the terms of the GNU General Public License as published by
2007++ the Free Software Foundation; version 2 of the License.
2008++
2009++ This program is distributed in the hope that it will be useful,
2010++ but WITHOUT ANY WARRANTY; without even the implied warranty of
2011++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2012++ GNU General Public License for more details.
2013++
2014++ You should have received a copy of the GNU General Public License
2015++ along with this program; if not, write to the Free Software
2016++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
2017++
2018++/*
2019++ This header defines five atomic operations:
2020++
2021++ my_atomic_add#(&var, what)
2022++ 'Fetch and Add'
2023++ add 'what' to *var, and return the old value of *var
2024++
2025++ my_atomic_fas#(&var, what)
2026++ 'Fetch And Store'
2027++ store 'what' in *var, and return the old value of *var
2028++
2029++ my_atomic_cas#(&var, &old, new)
2030++ An odd variation of 'Compare And Set/Swap'
2031++ if *var is equal to *old, then store 'new' in *var, and return TRUE
2032++ otherwise store *var in *old, and return FALSE
2033++ Usually, &old should not be accessed if the operation is successful.
2034++
2035++ my_atomic_load#(&var)
2036++ return *var
2037++
2038++ my_atomic_store#(&var, what)
2039++ store 'what' in *var
2040++
2041++ '#' is substituted by a size suffix - 8, 16, 32, 64, or ptr
2042++ (e.g. my_atomic_add8, my_atomic_fas32, my_atomic_casptr).
2043++
2044++ NOTE This operations are not always atomic, so they always must be
2045++ enclosed in my_atomic_rwlock_rdlock(lock)/my_atomic_rwlock_rdunlock(lock)
2046++ or my_atomic_rwlock_wrlock(lock)/my_atomic_rwlock_wrunlock(lock).
2047++ Hint: if a code block makes intensive use of atomic ops, it make sense
2048++ to take/release rwlock once for the whole block, not for every statement.
2049++
2050++ On architectures where these operations are really atomic, rwlocks will
2051++ be optimized away.
2052++ 8- and 16-bit atomics aren't implemented for windows (see generic-msvc.h),
2053++ but can be added, if necessary.
2054++*/
2055++
2056++#ifndef my_atomic_rwlock_init
2057++
2058++#define intptr void *
2059++/**
2060++ Currently we don't support 8-bit and 16-bit operations.
2061++ It can be added later if needed.
2062++*/
2063++#undef MY_ATOMIC_HAS_8_16
2064++
2065++#ifndef MY_ATOMIC_MODE_RWLOCKS
2066++/*
2067++ * Attempt to do atomic ops without locks
2068++ */
2069++#include "atomic/nolock.h"
2070++#endif
2071++
2072++#ifndef make_atomic_cas_body
2073++/* nolock.h was not able to generate even a CAS function, fall back */
2074++#include "atomic/rwlock.h"
2075++#endif
2076++
2077++/* define missing functions by using the already generated ones */
2078++#ifndef make_atomic_add_body
2079++#define make_atomic_add_body(S) \
2080++ int ## S tmp=*a; \
2081++ while (!my_atomic_cas ## S(a, &tmp, tmp+v)) ; \
2082++ v=tmp;
2083++#endif
2084++#ifndef make_atomic_fas_body
2085++#define make_atomic_fas_body(S) \
2086++ int ## S tmp=*a; \
2087++ while (!my_atomic_cas ## S(a, &tmp, v)) ; \
2088++ v=tmp;
2089++#endif
2090++#ifndef make_atomic_load_body
2091++#define make_atomic_load_body(S) \
2092++ ret= 0; /* avoid compiler warning */ \
2093++ (void)(my_atomic_cas ## S(a, &ret, ret));
2094++#endif
2095++#ifndef make_atomic_store_body
2096++#define make_atomic_store_body(S) \
2097++ (void)(my_atomic_fas ## S (a, v));
2098++#endif
2099++
2100++/*
2101++ transparent_union doesn't work in g++
2102++ Bug ?
2103++
2104++ Darwin's gcc doesn't want to put pointers in a transparent_union
2105++ when built with -arch ppc64. Complains:
2106++ warning: 'transparent_union' attribute ignored
2107++*/
2108++#if defined(__GNUC__) && !defined(__cplusplus) && \
2109++ ! (defined(__APPLE__) && (defined(_ARCH_PPC64) ||defined (_ARCH_PPC)))
2110++/*
2111++ we want to be able to use my_atomic_xxx functions with
2112++ both signed and unsigned integers. But gcc will issue a warning
2113++ "passing arg N of `my_atomic_XXX' as [un]signed due to prototype"
2114++ if the signedness of the argument doesn't match the prototype, or
2115++ "pointer targets in passing argument N of my_atomic_XXX differ in signedness"
2116++ if int* is used where uint* is expected (or vice versa).
2117++ Let's shut these warnings up
2118++*/
2119++#define make_transparent_unions(S) \
2120++ typedef union { \
2121++ int ## S i; \
2122++ uint ## S u; \
2123++ } U_ ## S __attribute__ ((transparent_union)); \
2124++ typedef union { \
2125++ int ## S volatile *i; \
2126++ uint ## S volatile *u; \
2127++ } Uv_ ## S __attribute__ ((transparent_union));
2128++#define uintptr intptr
2129++make_transparent_unions(8)
2130++make_transparent_unions(16)
2131++make_transparent_unions(32)
2132++make_transparent_unions(64)
2133++make_transparent_unions(ptr)
2134++#undef uintptr
2135++#undef make_transparent_unions
2136++#define a U_a.i
2137++#define cmp U_cmp.i
2138++#define v U_v.i
2139++#define set U_set.i
2140++#else
2141++#define U_8 int8
2142++#define U_16 int16
2143++#define U_32 int32
2144++#define U_64 int64
2145++#define U_ptr intptr
2146++#define Uv_8 int8
2147++#define Uv_16 int16
2148++#define Uv_32 int32
2149++#define Uv_64 int64
2150++#define Uv_ptr intptr
2151++#define U_a volatile *a
2152++#define U_cmp *cmp
2153++#define U_v v
2154++#define U_set set
2155++#endif /* __GCC__ transparent_union magic */
2156++
2157++#define make_atomic_cas(S) \
2158++static inline int my_atomic_cas ## S(Uv_ ## S U_a, \
2159++ Uv_ ## S U_cmp, U_ ## S U_set) \
2160++{ \
2161++ int8 ret; \
2162++ make_atomic_cas_body(S); \
2163++ return ret; \
2164++}
2165++
2166++#define make_atomic_add(S) \
2167++static inline int ## S my_atomic_add ## S( \
2168++ Uv_ ## S U_a, U_ ## S U_v) \
2169++{ \
2170++ make_atomic_add_body(S); \
2171++ return v; \
2172++}
2173++
2174++#define make_atomic_fas(S) \
2175++static inline int ## S my_atomic_fas ## S( \
2176++ Uv_ ## S U_a, U_ ## S U_v) \
2177++{ \
2178++ make_atomic_fas_body(S); \
2179++ return v; \
2180++}
2181++
2182++#define make_atomic_load(S) \
2183++static inline int ## S my_atomic_load ## S(Uv_ ## S U_a) \
2184++{ \
2185++ int ## S ret; \
2186++ make_atomic_load_body(S); \
2187++ return ret; \
2188++}
2189++
2190++#define make_atomic_store(S) \
2191++static inline void my_atomic_store ## S( \
2192++ Uv_ ## S U_a, U_ ## S U_v) \
2193++{ \
2194++ make_atomic_store_body(S); \
2195++}
2196++
2197++#ifdef MY_ATOMIC_HAS_8_16
2198++make_atomic_cas(8)
2199++make_atomic_cas(16)
2200++#endif
2201++make_atomic_cas(32)
2202++make_atomic_cas(64)
2203++make_atomic_cas(ptr)
2204++
2205++#ifdef MY_ATOMIC_HAS_8_16
2206++make_atomic_add(8)
2207++make_atomic_add(16)
2208++#endif
2209++make_atomic_add(32)
2210++make_atomic_add(64)
2211++
2212++#ifdef MY_ATOMIC_HAS_8_16
2213++make_atomic_load(8)
2214++make_atomic_load(16)
2215++#endif
2216++make_atomic_load(32)
2217++make_atomic_load(64)
2218++make_atomic_load(ptr)
2219++
2220++#ifdef MY_ATOMIC_HAS_8_16
2221++make_atomic_fas(8)
2222++make_atomic_fas(16)
2223++#endif
2224++make_atomic_fas(32)
2225++make_atomic_fas(64)
2226++make_atomic_fas(ptr)
2227++
2228++#ifdef MY_ATOMIC_HAS_8_16
2229++make_atomic_store(8)
2230++make_atomic_store(16)
2231++#endif
2232++make_atomic_store(32)
2233++make_atomic_store(64)
2234++make_atomic_store(ptr)
2235++
2236++#ifdef _atomic_h_cleanup_
2237++#include _atomic_h_cleanup_
2238++#undef _atomic_h_cleanup_
2239++#endif
2240++
2241++#undef U_8
2242++#undef U_16
2243++#undef U_32
2244++#undef U_64
2245++#undef U_ptr
2246++#undef Uv_8
2247++#undef Uv_16
2248++#undef Uv_32
2249++#undef Uv_64
2250++#undef Uv_ptr
2251++#undef a
2252++#undef cmp
2253++#undef v
2254++#undef set
2255++#undef U_a
2256++#undef U_cmp
2257++#undef U_v
2258++#undef U_set
2259++#undef make_atomic_add
2260++#undef make_atomic_cas
2261++#undef make_atomic_load
2262++#undef make_atomic_store
2263++#undef make_atomic_fas
2264++#undef make_atomic_add_body
2265++#undef make_atomic_cas_body
2266++#undef make_atomic_load_body
2267++#undef make_atomic_store_body
2268++#undef make_atomic_fas_body
2269++#undef intptr
2270++
2271++/*
2272++ the macro below defines (as an expression) the code that
2273++ will be run in spin-loops. Intel manuals recummend to have PAUSE there.
2274++ It is expected to be defined in include/atomic/ *.h files
2275++*/
2276++#ifndef LF_BACKOFF
2277++#define LF_BACKOFF (1)
2278++#endif
2279++
2280++#define MY_ATOMIC_OK 0
2281++#define MY_ATOMIC_NOT_1CPU 1
2282++extern int my_atomic_initialize();
2283++
2284++#endif
2285++
2286++#endif /* MY_ATOMIC_INCLUDED */
2287 diff -ruN a/include/mysql_com.h b/include/mysql_com.h
2288---- a/include/mysql_com.h 2010-11-01 08:43:53.000000000 +0000
2289-+++ b/include/mysql_com.h 2010-11-01 08:52:40.000000000 +0000
2290+--- a/include/mysql_com.h 2011-07-11 04:31:52.068358403 +0300
2291++++ b/include/mysql_com.h 2011-07-11 04:32:14.873520255 +0300
2292 @@ -128,10 +128,11 @@
2293 #define REFRESH_FAST 32768 /* Intern flag */
2294
2295@@ -24,9 +999,2161 @@
2296
2297 #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
2298 #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
2299+diff -ruN a/mysql-test/include/have_response_time_distribution.inc b/mysql-test/include/have_response_time_distribution.inc
2300+--- a/mysql-test/include/have_response_time_distribution.inc 1970-01-01 03:00:00.000000000 +0300
2301++++ b/mysql-test/include/have_response_time_distribution.inc 2011-07-11 04:32:55.637809581 +0300
2302+@@ -0,0 +1,4 @@
2303++-- require r/have_response_time_distribution.require
2304++disable_query_log;
2305++show variables like 'have_response_time_distribution';
2306++enable_query_log;
2307+diff -ruN a/mysql-test/r/have_response_time_distribution.require b/mysql-test/r/have_response_time_distribution.require
2308+--- a/mysql-test/r/have_response_time_distribution.require 1970-01-01 03:00:00.000000000 +0300
2309++++ b/mysql-test/r/have_response_time_distribution.require 2011-07-11 04:32:38.718689494 +0300
2310+@@ -0,0 +1,2 @@
2311++Variable_name Value
2312++have_response_time_distribution YES
2313+diff -ruN a/mysql-test/suite/percona/include/query_response_time.inc b/mysql-test/suite/percona/include/query_response_time.inc
2314+--- a/mysql-test/suite/percona/include/query_response_time.inc 1970-01-01 03:00:00.000000000 +0300
2315++++ b/mysql-test/suite/percona/include/query_response_time.inc 2011-07-11 04:32:14.873520256 +0300
2316+@@ -0,0 +1,33 @@
2317++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2318++EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base;
2319++FLUSH QUERY_RESPONSE_TIME;
2320++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2321++
2322++SET SESSION debug="+d,query_exec_time_0.31";
2323++SET SESSION debug="+d,query_exec_time_0.32";
2324++SET SESSION debug="+d,query_exec_time_0.33";
2325++SET SESSION debug="+d,query_exec_time_0.34";
2326++SET SESSION debug="+d,query_exec_time_0.35";
2327++SET SESSION debug="+d,query_exec_time_0.36";
2328++SET SESSION debug="+d,query_exec_time_0.37";
2329++SET SESSION debug="+d,query_exec_time_0.38";
2330++SET SESSION debug="+d,query_exec_time_0.39";
2331++SET SESSION debug="+d,query_exec_time_0.4";
2332++SET SESSION debug="+d,query_exec_time_1.1";
2333++SET SESSION debug="+d,query_exec_time_1.2";
2334++SET SESSION debug="+d,query_exec_time_1.3";
2335++SET SESSION debug="+d,query_exec_time_1.5";
2336++SET SESSION debug="+d,query_exec_time_1.4";
2337++SET SESSION debug="+d,query_exec_time_0.5";
2338++SET SESSION debug="+d,query_exec_time_2.1";
2339++SET SESSION debug="+d,query_exec_time_2.3";
2340++SET SESSION debug="+d,query_exec_time_2.5";
2341++SET SESSION debug="+d,query_exec_time_3.1";
2342++SET SESSION debug="+d,query_exec_time_4.1";
2343++SET SESSION debug="+d,query_exec_time_5.1";
2344++
2345++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2346++
2347++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2348++SHOW QUERY_RESPONSE_TIME;
2349++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2350+diff -ruN a/mysql-test/suite/percona/include/query_response_time-replication.inc b/mysql-test/suite/percona/include/query_response_time-replication.inc
2351+--- a/mysql-test/suite/percona/include/query_response_time-replication.inc 1970-01-01 03:00:00.000000000 +0300
2352++++ b/mysql-test/suite/percona/include/query_response_time-replication.inc 2011-07-11 04:32:14.873520256 +0300
2353+@@ -0,0 +1,41 @@
2354++connection slave;
2355++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2356++EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base;
2357++FLUSH QUERY_RESPONSE_TIME;
2358++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2359++
2360++connection master;
2361++--let i=0
2362++EVAL /* query_exec_time= "0.31" */ INSERT INTO t VALUES($i); inc $i;
2363++EVAL /* query_exec_time= "0.32" */ INSERT INTO t VALUES($i); inc $i;
2364++EVAL /* query_exec_time= "0.33" */ INSERT INTO t VALUES($i); inc $i;
2365++EVAL /* query_exec_time= "0.34" */ INSERT INTO t VALUES($i); inc $i;
2366++EVAL /* query_exec_time= "0.35" */ INSERT INTO t VALUES($i); inc $i;
2367++EVAL /* query_exec_time= "0.36" */ INSERT INTO t VALUES($i); inc $i;
2368++EVAL /* query_exec_time= "0.37" */ INSERT INTO t VALUES($i); inc $i;
2369++EVAL /* query_exec_time= "0.38" */ INSERT INTO t VALUES($i); inc $i;
2370++EVAL /* query_exec_time= "0.39" */ INSERT INTO t VALUES($i); inc $i;
2371++EVAL /* query_exec_time= "0.4" */ INSERT INTO t VALUES($i); inc $i;
2372++EVAL /* query_exec_time= "1.1" */ INSERT INTO t VALUES($i); inc $i;
2373++EVAL /* query_exec_time= "1.2" */ INSERT INTO t VALUES($i); inc $i;
2374++EVAL /* query_exec_time= "1.3" */ INSERT INTO t VALUES($i); inc $i;
2375++EVAL /* query_exec_time= "1.5" */ INSERT INTO t VALUES($i); inc $i;
2376++EVAL /* query_exec_time= "1.4" */ INSERT INTO t VALUES($i); inc $i;
2377++EVAL /* query_exec_time= "0.5" */ INSERT INTO t VALUES($i); inc $i;
2378++EVAL /* query_exec_time= "2.1" */ INSERT INTO t VALUES($i); inc $i;
2379++EVAL /* query_exec_time= "2.3" */ INSERT INTO t VALUES($i); inc $i;
2380++EVAL /* query_exec_time= "2.5" */ INSERT INTO t VALUES($i); inc $i;
2381++EVAL /* query_exec_time= "3.1" */ INSERT INTO t VALUES($i); inc $i;
2382++EVAL /* query_exec_time= "4.1" */ INSERT INTO t VALUES($i); inc $i;
2383++EVAL /* query_exec_time= "5.1" */ INSERT INTO t VALUES($i); inc $i;
2384++sync_slave_with_master;
2385++
2386++connection master;
2387++DELETE FROM t;
2388++sync_slave_with_master;
2389++
2390++connection slave;
2391++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2392++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2393++SHOW QUERY_RESPONSE_TIME;
2394++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2395+diff -ruN a/mysql-test/suite/percona/include/query_response_time-stored.inc b/mysql-test/suite/percona/include/query_response_time-stored.inc
2396+--- a/mysql-test/suite/percona/include/query_response_time-stored.inc 1970-01-01 03:00:00.000000000 +0300
2397++++ b/mysql-test/suite/percona/include/query_response_time-stored.inc 2011-07-11 04:32:14.875520269 +0300
2398+@@ -0,0 +1,33 @@
2399++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2400++EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base;
2401++FLUSH QUERY_RESPONSE_TIME;
2402++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2403++
2404++CALL test_f("0.31");
2405++CALL test_f("0.32");
2406++CALL test_f("0.33");
2407++CALL test_f("0.34");
2408++CALL test_f("0.35");
2409++CALL test_f("0.36");
2410++CALL test_f("0.37");
2411++CALL test_f("0.38");
2412++CALL test_f("0.39");
2413++CALL test_f("0.4");
2414++CALL test_f("1.1");
2415++CALL test_f("1.2");
2416++CALL test_f("1.3");
2417++CALL test_f("1.5");
2418++CALL test_f("1.4");
2419++CALL test_f("0.5");
2420++CALL test_f("2.1");
2421++CALL test_f("2.3");
2422++CALL test_f("2.5");
2423++CALL test_f("3.1");
2424++CALL test_f("4.1");
2425++CALL test_f("5.1");
2426++
2427++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2428++
2429++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2430++SHOW QUERY_RESPONSE_TIME;
2431++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2432+diff -ruN a/mysql-test/suite/percona/r/query_response_time-replication.result b/mysql-test/suite/percona/r/query_response_time-replication.result
2433+--- a/mysql-test/suite/percona/r/query_response_time-replication.result 1970-01-01 03:00:00.000000000 +0300
2434++++ b/mysql-test/suite/percona/r/query_response_time-replication.result 2011-07-11 04:32:14.875520270 +0300
2435+@@ -0,0 +1,528 @@
2436++include/master-slave.inc
2437++[connection master]
2438++DROP TABLE IF EXISTS t;
2439++CREATE TABLE t(id INT);
2440++SET GLOBAL debug="+d,query_exec_time_debug";
2441++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2442++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
2443++Warnings:
2444++Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
2445++FLUSH QUERY_RESPONSE_TIME;
2446++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2447++SET SESSION debug="+d,query_exec_time_0.31";
2448++SET SESSION debug="+d,query_exec_time_0.32";
2449++SET SESSION debug="+d,query_exec_time_0.33";
2450++SET SESSION debug="+d,query_exec_time_0.34";
2451++SET SESSION debug="+d,query_exec_time_0.35";
2452++SET SESSION debug="+d,query_exec_time_0.36";
2453++SET SESSION debug="+d,query_exec_time_0.37";
2454++SET SESSION debug="+d,query_exec_time_0.38";
2455++SET SESSION debug="+d,query_exec_time_0.39";
2456++SET SESSION debug="+d,query_exec_time_0.4";
2457++SET SESSION debug="+d,query_exec_time_1.1";
2458++SET SESSION debug="+d,query_exec_time_1.2";
2459++SET SESSION debug="+d,query_exec_time_1.3";
2460++SET SESSION debug="+d,query_exec_time_1.5";
2461++SET SESSION debug="+d,query_exec_time_1.4";
2462++SET SESSION debug="+d,query_exec_time_0.5";
2463++SET SESSION debug="+d,query_exec_time_2.1";
2464++SET SESSION debug="+d,query_exec_time_2.3";
2465++SET SESSION debug="+d,query_exec_time_2.5";
2466++SET SESSION debug="+d,query_exec_time_3.1";
2467++SET SESSION debug="+d,query_exec_time_4.1";
2468++SET SESSION debug="+d,query_exec_time_5.1";
2469++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2470++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2471++Variable_name Value
2472++query_response_time_range_base 2
2473++SHOW QUERY_RESPONSE_TIME;
2474++
2475++ 0.000001 0 0.000000
2476++ 0.000003 0 0.000000
2477++ 0.000007 0 0.000000
2478++ 0.000015 0 0.000000
2479++ 0.000030 0 0.000000
2480++ 0.000061 0 0.000000
2481++ 0.000122 0 0.000000
2482++ 0.000244 0 0.000000
2483++ 0.000488 0 0.000000
2484++ 0.000976 0 0.000000
2485++ 0.001953 0 0.000000
2486++ 0.003906 0 0.000000
2487++ 0.007812 0 0.000000
2488++ 0.015625 0 0.000000
2489++ 0.031250 0 0.000000
2490++ 0.062500 0 0.000000
2491++ 0.125000 0 0.000000
2492++ 0.250000 0 0.000000
2493++ 0.500000 10 3.550000
2494++ 1.000000 1 0.500000
2495++ 2.000000 5 6.500000
2496++ 4.000000 4 10.000000
2497++ 8.000000 2 9.200000
2498++ 16.000000 0 0.000000
2499++ 32.000000 0 0.000000
2500++ 64.000000 0 0.000000
2501++ 128.000000 0 0.000000
2502++ 256.000000 0 0.000000
2503++ 512.000000 0 0.000000
2504++ 1024.000000 0 0.000000
2505++ 2048.000000 0 0.000000
2506++ 4096.000000 0 0.000000
2507++ 8192.000000 0 0.000000
2508++ 16384.000000 0 0.000000
2509++ 32768.000000 0 0.000000
2510++ 65536.000000 0 0.000000
2511++ 131072.000000 0 0.000000
2512++ 262144.000000 0 0.000000
2513++ 524288.000000 0 0.000000
2514++ 1048576.00000 0 0.000000
2515++ 2097152.00000 0 0.000000
2516++ 4194304.00000 0 0.000000
2517++ 8388608.00000 0 0.000000
2518++TOO LONG 0 TOO LONG
2519++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2520++time count total
2521++ 0.000001 0 0.000000
2522++ 0.000003 0 0.000000
2523++ 0.000007 0 0.000000
2524++ 0.000015 0 0.000000
2525++ 0.000030 0 0.000000
2526++ 0.000061 0 0.000000
2527++ 0.000122 0 0.000000
2528++ 0.000244 0 0.000000
2529++ 0.000488 0 0.000000
2530++ 0.000976 0 0.000000
2531++ 0.001953 0 0.000000
2532++ 0.003906 0 0.000000
2533++ 0.007812 0 0.000000
2534++ 0.015625 0 0.000000
2535++ 0.031250 0 0.000000
2536++ 0.062500 0 0.000000
2537++ 0.125000 0 0.000000
2538++ 0.250000 0 0.000000
2539++ 0.500000 10 3.550000
2540++ 1.000000 1 0.500000
2541++ 2.000000 5 6.500000
2542++ 4.000000 4 10.000000
2543++ 8.000000 2 9.200000
2544++ 16.000000 0 0.000000
2545++ 32.000000 0 0.000000
2546++ 64.000000 0 0.000000
2547++ 128.000000 0 0.000000
2548++ 256.000000 0 0.000000
2549++ 512.000000 0 0.000000
2550++ 1024.000000 0 0.000000
2551++ 2048.000000 0 0.000000
2552++ 4096.000000 0 0.000000
2553++ 8192.000000 0 0.000000
2554++ 16384.000000 0 0.000000
2555++ 32768.000000 0 0.000000
2556++ 65536.000000 0 0.000000
2557++ 131072.000000 0 0.000000
2558++ 262144.000000 0 0.000000
2559++ 524288.000000 0 0.000000
2560++ 1048576.00000 0 0.000000
2561++ 2097152.00000 0 0.000000
2562++ 4194304.00000 0 0.000000
2563++ 8388608.00000 0 0.000000
2564++TOO LONG 0 TOO LONG
2565++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2566++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
2567++FLUSH QUERY_RESPONSE_TIME;
2568++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2569++SET SESSION debug="+d,query_exec_time_0.31";
2570++SET SESSION debug="+d,query_exec_time_0.32";
2571++SET SESSION debug="+d,query_exec_time_0.33";
2572++SET SESSION debug="+d,query_exec_time_0.34";
2573++SET SESSION debug="+d,query_exec_time_0.35";
2574++SET SESSION debug="+d,query_exec_time_0.36";
2575++SET SESSION debug="+d,query_exec_time_0.37";
2576++SET SESSION debug="+d,query_exec_time_0.38";
2577++SET SESSION debug="+d,query_exec_time_0.39";
2578++SET SESSION debug="+d,query_exec_time_0.4";
2579++SET SESSION debug="+d,query_exec_time_1.1";
2580++SET SESSION debug="+d,query_exec_time_1.2";
2581++SET SESSION debug="+d,query_exec_time_1.3";
2582++SET SESSION debug="+d,query_exec_time_1.5";
2583++SET SESSION debug="+d,query_exec_time_1.4";
2584++SET SESSION debug="+d,query_exec_time_0.5";
2585++SET SESSION debug="+d,query_exec_time_2.1";
2586++SET SESSION debug="+d,query_exec_time_2.3";
2587++SET SESSION debug="+d,query_exec_time_2.5";
2588++SET SESSION debug="+d,query_exec_time_3.1";
2589++SET SESSION debug="+d,query_exec_time_4.1";
2590++SET SESSION debug="+d,query_exec_time_5.1";
2591++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2592++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2593++Variable_name Value
2594++query_response_time_range_base 2
2595++SHOW QUERY_RESPONSE_TIME;
2596++
2597++ 0.000001 0 0.000000
2598++ 0.000003 0 0.000000
2599++ 0.000007 0 0.000000
2600++ 0.000015 0 0.000000
2601++ 0.000030 0 0.000000
2602++ 0.000061 0 0.000000
2603++ 0.000122 0 0.000000
2604++ 0.000244 0 0.000000
2605++ 0.000488 0 0.000000
2606++ 0.000976 0 0.000000
2607++ 0.001953 0 0.000000
2608++ 0.003906 0 0.000000
2609++ 0.007812 0 0.000000
2610++ 0.015625 0 0.000000
2611++ 0.031250 0 0.000000
2612++ 0.062500 0 0.000000
2613++ 0.125000 0 0.000000
2614++ 0.250000 0 0.000000
2615++ 0.500000 10 3.550000
2616++ 1.000000 1 0.500000
2617++ 2.000000 5 6.500000
2618++ 4.000000 4 10.000000
2619++ 8.000000 2 9.200000
2620++ 16.000000 0 0.000000
2621++ 32.000000 0 0.000000
2622++ 64.000000 0 0.000000
2623++ 128.000000 0 0.000000
2624++ 256.000000 0 0.000000
2625++ 512.000000 0 0.000000
2626++ 1024.000000 0 0.000000
2627++ 2048.000000 0 0.000000
2628++ 4096.000000 0 0.000000
2629++ 8192.000000 0 0.000000
2630++ 16384.000000 0 0.000000
2631++ 32768.000000 0 0.000000
2632++ 65536.000000 0 0.000000
2633++ 131072.000000 0 0.000000
2634++ 262144.000000 0 0.000000
2635++ 524288.000000 0 0.000000
2636++ 1048576.00000 0 0.000000
2637++ 2097152.00000 0 0.000000
2638++ 4194304.00000 0 0.000000
2639++ 8388608.00000 0 0.000000
2640++TOO LONG 0 TOO LONG
2641++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2642++time count total
2643++ 0.000001 0 0.000000
2644++ 0.000003 0 0.000000
2645++ 0.000007 0 0.000000
2646++ 0.000015 0 0.000000
2647++ 0.000030 0 0.000000
2648++ 0.000061 0 0.000000
2649++ 0.000122 0 0.000000
2650++ 0.000244 0 0.000000
2651++ 0.000488 0 0.000000
2652++ 0.000976 0 0.000000
2653++ 0.001953 0 0.000000
2654++ 0.003906 0 0.000000
2655++ 0.007812 0 0.000000
2656++ 0.015625 0 0.000000
2657++ 0.031250 0 0.000000
2658++ 0.062500 0 0.000000
2659++ 0.125000 0 0.000000
2660++ 0.250000 0 0.000000
2661++ 0.500000 10 3.550000
2662++ 1.000000 1 0.500000
2663++ 2.000000 5 6.500000
2664++ 4.000000 4 10.000000
2665++ 8.000000 2 9.200000
2666++ 16.000000 0 0.000000
2667++ 32.000000 0 0.000000
2668++ 64.000000 0 0.000000
2669++ 128.000000 0 0.000000
2670++ 256.000000 0 0.000000
2671++ 512.000000 0 0.000000
2672++ 1024.000000 0 0.000000
2673++ 2048.000000 0 0.000000
2674++ 4096.000000 0 0.000000
2675++ 8192.000000 0 0.000000
2676++ 16384.000000 0 0.000000
2677++ 32768.000000 0 0.000000
2678++ 65536.000000 0 0.000000
2679++ 131072.000000 0 0.000000
2680++ 262144.000000 0 0.000000
2681++ 524288.000000 0 0.000000
2682++ 1048576.00000 0 0.000000
2683++ 2097152.00000 0 0.000000
2684++ 4194304.00000 0 0.000000
2685++ 8388608.00000 0 0.000000
2686++TOO LONG 0 TOO LONG
2687++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2688++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
2689++FLUSH QUERY_RESPONSE_TIME;
2690++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2691++SET SESSION debug="+d,query_exec_time_0.31";
2692++SET SESSION debug="+d,query_exec_time_0.32";
2693++SET SESSION debug="+d,query_exec_time_0.33";
2694++SET SESSION debug="+d,query_exec_time_0.34";
2695++SET SESSION debug="+d,query_exec_time_0.35";
2696++SET SESSION debug="+d,query_exec_time_0.36";
2697++SET SESSION debug="+d,query_exec_time_0.37";
2698++SET SESSION debug="+d,query_exec_time_0.38";
2699++SET SESSION debug="+d,query_exec_time_0.39";
2700++SET SESSION debug="+d,query_exec_time_0.4";
2701++SET SESSION debug="+d,query_exec_time_1.1";
2702++SET SESSION debug="+d,query_exec_time_1.2";
2703++SET SESSION debug="+d,query_exec_time_1.3";
2704++SET SESSION debug="+d,query_exec_time_1.5";
2705++SET SESSION debug="+d,query_exec_time_1.4";
2706++SET SESSION debug="+d,query_exec_time_0.5";
2707++SET SESSION debug="+d,query_exec_time_2.1";
2708++SET SESSION debug="+d,query_exec_time_2.3";
2709++SET SESSION debug="+d,query_exec_time_2.5";
2710++SET SESSION debug="+d,query_exec_time_3.1";
2711++SET SESSION debug="+d,query_exec_time_4.1";
2712++SET SESSION debug="+d,query_exec_time_5.1";
2713++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2714++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2715++Variable_name Value
2716++query_response_time_range_base 10
2717++SHOW QUERY_RESPONSE_TIME;
2718++
2719++ 0.000001 0 0.000000
2720++ 0.000010 0 0.000000
2721++ 0.000100 0 0.000000
2722++ 0.001000 0 0.000000
2723++ 0.010000 0 0.000000
2724++ 0.100000 0 0.000000
2725++ 1.000000 11 4.050000
2726++ 10.000000 11 25.700000
2727++ 100.000000 0 0.000000
2728++ 1000.000000 0 0.000000
2729++ 10000.000000 0 0.000000
2730++ 100000.000000 0 0.000000
2731++ 1000000.00000 0 0.000000
2732++TOO LONG 0 TOO LONG
2733++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2734++time count total
2735++ 0.000001 0 0.000000
2736++ 0.000010 0 0.000000
2737++ 0.000100 0 0.000000
2738++ 0.001000 0 0.000000
2739++ 0.010000 0 0.000000
2740++ 0.100000 0 0.000000
2741++ 1.000000 11 4.050000
2742++ 10.000000 11 25.700000
2743++ 100.000000 0 0.000000
2744++ 1000.000000 0 0.000000
2745++ 10000.000000 0 0.000000
2746++ 100000.000000 0 0.000000
2747++ 1000000.00000 0 0.000000
2748++TOO LONG 0 TOO LONG
2749++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2750++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
2751++FLUSH QUERY_RESPONSE_TIME;
2752++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2753++SET SESSION debug="+d,query_exec_time_0.31";
2754++SET SESSION debug="+d,query_exec_time_0.32";
2755++SET SESSION debug="+d,query_exec_time_0.33";
2756++SET SESSION debug="+d,query_exec_time_0.34";
2757++SET SESSION debug="+d,query_exec_time_0.35";
2758++SET SESSION debug="+d,query_exec_time_0.36";
2759++SET SESSION debug="+d,query_exec_time_0.37";
2760++SET SESSION debug="+d,query_exec_time_0.38";
2761++SET SESSION debug="+d,query_exec_time_0.39";
2762++SET SESSION debug="+d,query_exec_time_0.4";
2763++SET SESSION debug="+d,query_exec_time_1.1";
2764++SET SESSION debug="+d,query_exec_time_1.2";
2765++SET SESSION debug="+d,query_exec_time_1.3";
2766++SET SESSION debug="+d,query_exec_time_1.5";
2767++SET SESSION debug="+d,query_exec_time_1.4";
2768++SET SESSION debug="+d,query_exec_time_0.5";
2769++SET SESSION debug="+d,query_exec_time_2.1";
2770++SET SESSION debug="+d,query_exec_time_2.3";
2771++SET SESSION debug="+d,query_exec_time_2.5";
2772++SET SESSION debug="+d,query_exec_time_3.1";
2773++SET SESSION debug="+d,query_exec_time_4.1";
2774++SET SESSION debug="+d,query_exec_time_5.1";
2775++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2776++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2777++Variable_name Value
2778++query_response_time_range_base 7
2779++SHOW QUERY_RESPONSE_TIME;
2780++
2781++ 0.000001 0 0.000000
2782++ 0.000008 0 0.000000
2783++ 0.000059 0 0.000000
2784++ 0.000416 0 0.000000
2785++ 0.002915 0 0.000000
2786++ 0.020408 0 0.000000
2787++ 0.142857 0 0.000000
2788++ 1.000000 11 4.050000
2789++ 7.000000 11 25.700000
2790++ 49.000000 0 0.000000
2791++ 343.000000 0 0.000000
2792++ 2401.000000 0 0.000000
2793++ 16807.000000 0 0.000000
2794++ 117649.000000 0 0.000000
2795++ 823543.000000 0 0.000000
2796++ 5764801.00000 0 0.000000
2797++TOO LONG 0 TOO LONG
2798++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2799++time count total
2800++ 0.000001 0 0.000000
2801++ 0.000008 0 0.000000
2802++ 0.000059 0 0.000000
2803++ 0.000416 0 0.000000
2804++ 0.002915 0 0.000000
2805++ 0.020408 0 0.000000
2806++ 0.142857 0 0.000000
2807++ 1.000000 11 4.050000
2808++ 7.000000 11 25.700000
2809++ 49.000000 0 0.000000
2810++ 343.000000 0 0.000000
2811++ 2401.000000 0 0.000000
2812++ 16807.000000 0 0.000000
2813++ 117649.000000 0 0.000000
2814++ 823543.000000 0 0.000000
2815++ 5764801.00000 0 0.000000
2816++TOO LONG 0 TOO LONG
2817++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2818++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
2819++FLUSH QUERY_RESPONSE_TIME;
2820++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2821++SET SESSION debug="+d,query_exec_time_0.31";
2822++SET SESSION debug="+d,query_exec_time_0.32";
2823++SET SESSION debug="+d,query_exec_time_0.33";
2824++SET SESSION debug="+d,query_exec_time_0.34";
2825++SET SESSION debug="+d,query_exec_time_0.35";
2826++SET SESSION debug="+d,query_exec_time_0.36";
2827++SET SESSION debug="+d,query_exec_time_0.37";
2828++SET SESSION debug="+d,query_exec_time_0.38";
2829++SET SESSION debug="+d,query_exec_time_0.39";
2830++SET SESSION debug="+d,query_exec_time_0.4";
2831++SET SESSION debug="+d,query_exec_time_1.1";
2832++SET SESSION debug="+d,query_exec_time_1.2";
2833++SET SESSION debug="+d,query_exec_time_1.3";
2834++SET SESSION debug="+d,query_exec_time_1.5";
2835++SET SESSION debug="+d,query_exec_time_1.4";
2836++SET SESSION debug="+d,query_exec_time_0.5";
2837++SET SESSION debug="+d,query_exec_time_2.1";
2838++SET SESSION debug="+d,query_exec_time_2.3";
2839++SET SESSION debug="+d,query_exec_time_2.5";
2840++SET SESSION debug="+d,query_exec_time_3.1";
2841++SET SESSION debug="+d,query_exec_time_4.1";
2842++SET SESSION debug="+d,query_exec_time_5.1";
2843++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2844++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2845++Variable_name Value
2846++query_response_time_range_base 156
2847++SHOW QUERY_RESPONSE_TIME;
2848++
2849++ 0.000041 0 0.000000
2850++ 0.006410 0 0.000000
2851++ 1.000000 11 4.050000
2852++ 156.000000 11 25.700000
2853++ 24336.000000 0 0.000000
2854++ 3796416.00000 0 0.000000
2855++TOO LONG 0 TOO LONG
2856++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2857++time count total
2858++ 0.000041 0 0.000000
2859++ 0.006410 0 0.000000
2860++ 1.000000 11 4.050000
2861++ 156.000000 11 25.700000
2862++ 24336.000000 0 0.000000
2863++ 3796416.00000 0 0.000000
2864++TOO LONG 0 TOO LONG
2865++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2866++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
2867++FLUSH QUERY_RESPONSE_TIME;
2868++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2869++SET SESSION debug="+d,query_exec_time_0.31";
2870++SET SESSION debug="+d,query_exec_time_0.32";
2871++SET SESSION debug="+d,query_exec_time_0.33";
2872++SET SESSION debug="+d,query_exec_time_0.34";
2873++SET SESSION debug="+d,query_exec_time_0.35";
2874++SET SESSION debug="+d,query_exec_time_0.36";
2875++SET SESSION debug="+d,query_exec_time_0.37";
2876++SET SESSION debug="+d,query_exec_time_0.38";
2877++SET SESSION debug="+d,query_exec_time_0.39";
2878++SET SESSION debug="+d,query_exec_time_0.4";
2879++SET SESSION debug="+d,query_exec_time_1.1";
2880++SET SESSION debug="+d,query_exec_time_1.2";
2881++SET SESSION debug="+d,query_exec_time_1.3";
2882++SET SESSION debug="+d,query_exec_time_1.5";
2883++SET SESSION debug="+d,query_exec_time_1.4";
2884++SET SESSION debug="+d,query_exec_time_0.5";
2885++SET SESSION debug="+d,query_exec_time_2.1";
2886++SET SESSION debug="+d,query_exec_time_2.3";
2887++SET SESSION debug="+d,query_exec_time_2.5";
2888++SET SESSION debug="+d,query_exec_time_3.1";
2889++SET SESSION debug="+d,query_exec_time_4.1";
2890++SET SESSION debug="+d,query_exec_time_5.1";
2891++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2892++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2893++Variable_name Value
2894++query_response_time_range_base 1000
2895++SHOW QUERY_RESPONSE_TIME;
2896++
2897++ 0.000001 0 0.000000
2898++ 0.001000 0 0.000000
2899++ 1.000000 11 4.050000
2900++ 1000.000000 11 25.700000
2901++ 1000000.00000 0 0.000000
2902++TOO LONG 0 TOO LONG
2903++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2904++time count total
2905++ 0.000001 0 0.000000
2906++ 0.001000 0 0.000000
2907++ 1.000000 11 4.050000
2908++ 1000.000000 11 25.700000
2909++ 1000000.00000 0 0.000000
2910++TOO LONG 0 TOO LONG
2911++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2912++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
2913++Warnings:
2914++Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
2915++FLUSH QUERY_RESPONSE_TIME;
2916++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2917++SET SESSION debug="+d,query_exec_time_0.31";
2918++SET SESSION debug="+d,query_exec_time_0.32";
2919++SET SESSION debug="+d,query_exec_time_0.33";
2920++SET SESSION debug="+d,query_exec_time_0.34";
2921++SET SESSION debug="+d,query_exec_time_0.35";
2922++SET SESSION debug="+d,query_exec_time_0.36";
2923++SET SESSION debug="+d,query_exec_time_0.37";
2924++SET SESSION debug="+d,query_exec_time_0.38";
2925++SET SESSION debug="+d,query_exec_time_0.39";
2926++SET SESSION debug="+d,query_exec_time_0.4";
2927++SET SESSION debug="+d,query_exec_time_1.1";
2928++SET SESSION debug="+d,query_exec_time_1.2";
2929++SET SESSION debug="+d,query_exec_time_1.3";
2930++SET SESSION debug="+d,query_exec_time_1.5";
2931++SET SESSION debug="+d,query_exec_time_1.4";
2932++SET SESSION debug="+d,query_exec_time_0.5";
2933++SET SESSION debug="+d,query_exec_time_2.1";
2934++SET SESSION debug="+d,query_exec_time_2.3";
2935++SET SESSION debug="+d,query_exec_time_2.5";
2936++SET SESSION debug="+d,query_exec_time_3.1";
2937++SET SESSION debug="+d,query_exec_time_4.1";
2938++SET SESSION debug="+d,query_exec_time_5.1";
2939++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2940++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2941++Variable_name Value
2942++query_response_time_range_base 1000
2943++SHOW QUERY_RESPONSE_TIME;
2944++
2945++ 0.000001 0 0.000000
2946++ 0.001000 0 0.000000
2947++ 1.000000 11 4.050000
2948++ 1000.000000 11 25.700000
2949++ 1000000.00000 0 0.000000
2950++TOO LONG 0 TOO LONG
2951++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2952++time count total
2953++ 0.000001 0 0.000000
2954++ 0.001000 0 0.000000
2955++ 1.000000 11 4.050000
2956++ 1000.000000 11 25.700000
2957++ 1000000.00000 0 0.000000
2958++TOO LONG 0 TOO LONG
2959++SET GLOBAL debug="";
2960++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
2961++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=default;
2962++DROP TABLE t;
2963++include/rpl_end.inc
2964+diff -ruN a/mysql-test/suite/percona/r/query_response_time.result b/mysql-test/suite/percona/r/query_response_time.result
2965+--- a/mysql-test/suite/percona/r/query_response_time.result 1970-01-01 03:00:00.000000000 +0300
2966++++ b/mysql-test/suite/percona/r/query_response_time.result 2011-07-11 04:32:14.875520270 +0300
2967+@@ -0,0 +1,522 @@
2968++SET GLOBAL debug="+d,query_exec_time_debug";
2969++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2970++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
2971++Warnings:
2972++Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
2973++FLUSH QUERY_RESPONSE_TIME;
2974++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
2975++SET SESSION debug="+d,query_exec_time_0.31";
2976++SET SESSION debug="+d,query_exec_time_0.32";
2977++SET SESSION debug="+d,query_exec_time_0.33";
2978++SET SESSION debug="+d,query_exec_time_0.34";
2979++SET SESSION debug="+d,query_exec_time_0.35";
2980++SET SESSION debug="+d,query_exec_time_0.36";
2981++SET SESSION debug="+d,query_exec_time_0.37";
2982++SET SESSION debug="+d,query_exec_time_0.38";
2983++SET SESSION debug="+d,query_exec_time_0.39";
2984++SET SESSION debug="+d,query_exec_time_0.4";
2985++SET SESSION debug="+d,query_exec_time_1.1";
2986++SET SESSION debug="+d,query_exec_time_1.2";
2987++SET SESSION debug="+d,query_exec_time_1.3";
2988++SET SESSION debug="+d,query_exec_time_1.5";
2989++SET SESSION debug="+d,query_exec_time_1.4";
2990++SET SESSION debug="+d,query_exec_time_0.5";
2991++SET SESSION debug="+d,query_exec_time_2.1";
2992++SET SESSION debug="+d,query_exec_time_2.3";
2993++SET SESSION debug="+d,query_exec_time_2.5";
2994++SET SESSION debug="+d,query_exec_time_3.1";
2995++SET SESSION debug="+d,query_exec_time_4.1";
2996++SET SESSION debug="+d,query_exec_time_5.1";
2997++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
2998++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2999++Variable_name Value
3000++query_response_time_range_base 2
3001++SHOW QUERY_RESPONSE_TIME;
3002++
3003++ 0.000001 0 0.000000
3004++ 0.000003 0 0.000000
3005++ 0.000007 0 0.000000
3006++ 0.000015 0 0.000000
3007++ 0.000030 0 0.000000
3008++ 0.000061 0 0.000000
3009++ 0.000122 0 0.000000
3010++ 0.000244 0 0.000000
3011++ 0.000488 0 0.000000
3012++ 0.000976 0 0.000000
3013++ 0.001953 0 0.000000
3014++ 0.003906 0 0.000000
3015++ 0.007812 0 0.000000
3016++ 0.015625 0 0.000000
3017++ 0.031250 0 0.000000
3018++ 0.062500 0 0.000000
3019++ 0.125000 0 0.000000
3020++ 0.250000 0 0.000000
3021++ 0.500000 10 3.550000
3022++ 1.000000 1 0.500000
3023++ 2.000000 5 6.500000
3024++ 4.000000 4 10.000000
3025++ 8.000000 2 9.200000
3026++ 16.000000 0 0.000000
3027++ 32.000000 0 0.000000
3028++ 64.000000 0 0.000000
3029++ 128.000000 0 0.000000
3030++ 256.000000 0 0.000000
3031++ 512.000000 0 0.000000
3032++ 1024.000000 0 0.000000
3033++ 2048.000000 0 0.000000
3034++ 4096.000000 0 0.000000
3035++ 8192.000000 0 0.000000
3036++ 16384.000000 0 0.000000
3037++ 32768.000000 0 0.000000
3038++ 65536.000000 0 0.000000
3039++ 131072.000000 0 0.000000
3040++ 262144.000000 0 0.000000
3041++ 524288.000000 0 0.000000
3042++ 1048576.00000 0 0.000000
3043++ 2097152.00000 0 0.000000
3044++ 4194304.00000 0 0.000000
3045++ 8388608.00000 0 0.000000
3046++TOO LONG 0 TOO LONG
3047++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3048++time count total
3049++ 0.000001 0 0.000000
3050++ 0.000003 0 0.000000
3051++ 0.000007 0 0.000000
3052++ 0.000015 0 0.000000
3053++ 0.000030 0 0.000000
3054++ 0.000061 0 0.000000
3055++ 0.000122 0 0.000000
3056++ 0.000244 0 0.000000
3057++ 0.000488 0 0.000000
3058++ 0.000976 0 0.000000
3059++ 0.001953 0 0.000000
3060++ 0.003906 0 0.000000
3061++ 0.007812 0 0.000000
3062++ 0.015625 0 0.000000
3063++ 0.031250 0 0.000000
3064++ 0.062500 0 0.000000
3065++ 0.125000 0 0.000000
3066++ 0.250000 0 0.000000
3067++ 0.500000 10 3.550000
3068++ 1.000000 1 0.500000
3069++ 2.000000 5 6.500000
3070++ 4.000000 4 10.000000
3071++ 8.000000 2 9.200000
3072++ 16.000000 0 0.000000
3073++ 32.000000 0 0.000000
3074++ 64.000000 0 0.000000
3075++ 128.000000 0 0.000000
3076++ 256.000000 0 0.000000
3077++ 512.000000 0 0.000000
3078++ 1024.000000 0 0.000000
3079++ 2048.000000 0 0.000000
3080++ 4096.000000 0 0.000000
3081++ 8192.000000 0 0.000000
3082++ 16384.000000 0 0.000000
3083++ 32768.000000 0 0.000000
3084++ 65536.000000 0 0.000000
3085++ 131072.000000 0 0.000000
3086++ 262144.000000 0 0.000000
3087++ 524288.000000 0 0.000000
3088++ 1048576.00000 0 0.000000
3089++ 2097152.00000 0 0.000000
3090++ 4194304.00000 0 0.000000
3091++ 8388608.00000 0 0.000000
3092++TOO LONG 0 TOO LONG
3093++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3094++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
3095++FLUSH QUERY_RESPONSE_TIME;
3096++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3097++SET SESSION debug="+d,query_exec_time_0.31";
3098++SET SESSION debug="+d,query_exec_time_0.32";
3099++SET SESSION debug="+d,query_exec_time_0.33";
3100++SET SESSION debug="+d,query_exec_time_0.34";
3101++SET SESSION debug="+d,query_exec_time_0.35";
3102++SET SESSION debug="+d,query_exec_time_0.36";
3103++SET SESSION debug="+d,query_exec_time_0.37";
3104++SET SESSION debug="+d,query_exec_time_0.38";
3105++SET SESSION debug="+d,query_exec_time_0.39";
3106++SET SESSION debug="+d,query_exec_time_0.4";
3107++SET SESSION debug="+d,query_exec_time_1.1";
3108++SET SESSION debug="+d,query_exec_time_1.2";
3109++SET SESSION debug="+d,query_exec_time_1.3";
3110++SET SESSION debug="+d,query_exec_time_1.5";
3111++SET SESSION debug="+d,query_exec_time_1.4";
3112++SET SESSION debug="+d,query_exec_time_0.5";
3113++SET SESSION debug="+d,query_exec_time_2.1";
3114++SET SESSION debug="+d,query_exec_time_2.3";
3115++SET SESSION debug="+d,query_exec_time_2.5";
3116++SET SESSION debug="+d,query_exec_time_3.1";
3117++SET SESSION debug="+d,query_exec_time_4.1";
3118++SET SESSION debug="+d,query_exec_time_5.1";
3119++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3120++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3121++Variable_name Value
3122++query_response_time_range_base 2
3123++SHOW QUERY_RESPONSE_TIME;
3124++
3125++ 0.000001 0 0.000000
3126++ 0.000003 0 0.000000
3127++ 0.000007 0 0.000000
3128++ 0.000015 0 0.000000
3129++ 0.000030 0 0.000000
3130++ 0.000061 0 0.000000
3131++ 0.000122 0 0.000000
3132++ 0.000244 0 0.000000
3133++ 0.000488 0 0.000000
3134++ 0.000976 0 0.000000
3135++ 0.001953 0 0.000000
3136++ 0.003906 0 0.000000
3137++ 0.007812 0 0.000000
3138++ 0.015625 0 0.000000
3139++ 0.031250 0 0.000000
3140++ 0.062500 0 0.000000
3141++ 0.125000 0 0.000000
3142++ 0.250000 0 0.000000
3143++ 0.500000 10 3.550000
3144++ 1.000000 1 0.500000
3145++ 2.000000 5 6.500000
3146++ 4.000000 4 10.000000
3147++ 8.000000 2 9.200000
3148++ 16.000000 0 0.000000
3149++ 32.000000 0 0.000000
3150++ 64.000000 0 0.000000
3151++ 128.000000 0 0.000000
3152++ 256.000000 0 0.000000
3153++ 512.000000 0 0.000000
3154++ 1024.000000 0 0.000000
3155++ 2048.000000 0 0.000000
3156++ 4096.000000 0 0.000000
3157++ 8192.000000 0 0.000000
3158++ 16384.000000 0 0.000000
3159++ 32768.000000 0 0.000000
3160++ 65536.000000 0 0.000000
3161++ 131072.000000 0 0.000000
3162++ 262144.000000 0 0.000000
3163++ 524288.000000 0 0.000000
3164++ 1048576.00000 0 0.000000
3165++ 2097152.00000 0 0.000000
3166++ 4194304.00000 0 0.000000
3167++ 8388608.00000 0 0.000000
3168++TOO LONG 0 TOO LONG
3169++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3170++time count total
3171++ 0.000001 0 0.000000
3172++ 0.000003 0 0.000000
3173++ 0.000007 0 0.000000
3174++ 0.000015 0 0.000000
3175++ 0.000030 0 0.000000
3176++ 0.000061 0 0.000000
3177++ 0.000122 0 0.000000
3178++ 0.000244 0 0.000000
3179++ 0.000488 0 0.000000
3180++ 0.000976 0 0.000000
3181++ 0.001953 0 0.000000
3182++ 0.003906 0 0.000000
3183++ 0.007812 0 0.000000
3184++ 0.015625 0 0.000000
3185++ 0.031250 0 0.000000
3186++ 0.062500 0 0.000000
3187++ 0.125000 0 0.000000
3188++ 0.250000 0 0.000000
3189++ 0.500000 10 3.550000
3190++ 1.000000 1 0.500000
3191++ 2.000000 5 6.500000
3192++ 4.000000 4 10.000000
3193++ 8.000000 2 9.200000
3194++ 16.000000 0 0.000000
3195++ 32.000000 0 0.000000
3196++ 64.000000 0 0.000000
3197++ 128.000000 0 0.000000
3198++ 256.000000 0 0.000000
3199++ 512.000000 0 0.000000
3200++ 1024.000000 0 0.000000
3201++ 2048.000000 0 0.000000
3202++ 4096.000000 0 0.000000
3203++ 8192.000000 0 0.000000
3204++ 16384.000000 0 0.000000
3205++ 32768.000000 0 0.000000
3206++ 65536.000000 0 0.000000
3207++ 131072.000000 0 0.000000
3208++ 262144.000000 0 0.000000
3209++ 524288.000000 0 0.000000
3210++ 1048576.00000 0 0.000000
3211++ 2097152.00000 0 0.000000
3212++ 4194304.00000 0 0.000000
3213++ 8388608.00000 0 0.000000
3214++TOO LONG 0 TOO LONG
3215++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3216++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
3217++FLUSH QUERY_RESPONSE_TIME;
3218++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3219++SET SESSION debug="+d,query_exec_time_0.31";
3220++SET SESSION debug="+d,query_exec_time_0.32";
3221++SET SESSION debug="+d,query_exec_time_0.33";
3222++SET SESSION debug="+d,query_exec_time_0.34";
3223++SET SESSION debug="+d,query_exec_time_0.35";
3224++SET SESSION debug="+d,query_exec_time_0.36";
3225++SET SESSION debug="+d,query_exec_time_0.37";
3226++SET SESSION debug="+d,query_exec_time_0.38";
3227++SET SESSION debug="+d,query_exec_time_0.39";
3228++SET SESSION debug="+d,query_exec_time_0.4";
3229++SET SESSION debug="+d,query_exec_time_1.1";
3230++SET SESSION debug="+d,query_exec_time_1.2";
3231++SET SESSION debug="+d,query_exec_time_1.3";
3232++SET SESSION debug="+d,query_exec_time_1.5";
3233++SET SESSION debug="+d,query_exec_time_1.4";
3234++SET SESSION debug="+d,query_exec_time_0.5";
3235++SET SESSION debug="+d,query_exec_time_2.1";
3236++SET SESSION debug="+d,query_exec_time_2.3";
3237++SET SESSION debug="+d,query_exec_time_2.5";
3238++SET SESSION debug="+d,query_exec_time_3.1";
3239++SET SESSION debug="+d,query_exec_time_4.1";
3240++SET SESSION debug="+d,query_exec_time_5.1";
3241++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3242++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3243++Variable_name Value
3244++query_response_time_range_base 10
3245++SHOW QUERY_RESPONSE_TIME;
3246++
3247++ 0.000001 0 0.000000
3248++ 0.000010 0 0.000000
3249++ 0.000100 0 0.000000
3250++ 0.001000 0 0.000000
3251++ 0.010000 0 0.000000
3252++ 0.100000 0 0.000000
3253++ 1.000000 11 4.050000
3254++ 10.000000 11 25.700000
3255++ 100.000000 0 0.000000
3256++ 1000.000000 0 0.000000
3257++ 10000.000000 0 0.000000
3258++ 100000.000000 0 0.000000
3259++ 1000000.00000 0 0.000000
3260++TOO LONG 0 TOO LONG
3261++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3262++time count total
3263++ 0.000001 0 0.000000
3264++ 0.000010 0 0.000000
3265++ 0.000100 0 0.000000
3266++ 0.001000 0 0.000000
3267++ 0.010000 0 0.000000
3268++ 0.100000 0 0.000000
3269++ 1.000000 11 4.050000
3270++ 10.000000 11 25.700000
3271++ 100.000000 0 0.000000
3272++ 1000.000000 0 0.000000
3273++ 10000.000000 0 0.000000
3274++ 100000.000000 0 0.000000
3275++ 1000000.00000 0 0.000000
3276++TOO LONG 0 TOO LONG
3277++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3278++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
3279++FLUSH QUERY_RESPONSE_TIME;
3280++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3281++SET SESSION debug="+d,query_exec_time_0.31";
3282++SET SESSION debug="+d,query_exec_time_0.32";
3283++SET SESSION debug="+d,query_exec_time_0.33";
3284++SET SESSION debug="+d,query_exec_time_0.34";
3285++SET SESSION debug="+d,query_exec_time_0.35";
3286++SET SESSION debug="+d,query_exec_time_0.36";
3287++SET SESSION debug="+d,query_exec_time_0.37";
3288++SET SESSION debug="+d,query_exec_time_0.38";
3289++SET SESSION debug="+d,query_exec_time_0.39";
3290++SET SESSION debug="+d,query_exec_time_0.4";
3291++SET SESSION debug="+d,query_exec_time_1.1";
3292++SET SESSION debug="+d,query_exec_time_1.2";
3293++SET SESSION debug="+d,query_exec_time_1.3";
3294++SET SESSION debug="+d,query_exec_time_1.5";
3295++SET SESSION debug="+d,query_exec_time_1.4";
3296++SET SESSION debug="+d,query_exec_time_0.5";
3297++SET SESSION debug="+d,query_exec_time_2.1";
3298++SET SESSION debug="+d,query_exec_time_2.3";
3299++SET SESSION debug="+d,query_exec_time_2.5";
3300++SET SESSION debug="+d,query_exec_time_3.1";
3301++SET SESSION debug="+d,query_exec_time_4.1";
3302++SET SESSION debug="+d,query_exec_time_5.1";
3303++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3304++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3305++Variable_name Value
3306++query_response_time_range_base 7
3307++SHOW QUERY_RESPONSE_TIME;
3308++
3309++ 0.000001 0 0.000000
3310++ 0.000008 0 0.000000
3311++ 0.000059 0 0.000000
3312++ 0.000416 0 0.000000
3313++ 0.002915 0 0.000000
3314++ 0.020408 0 0.000000
3315++ 0.142857 0 0.000000
3316++ 1.000000 11 4.050000
3317++ 7.000000 11 25.700000
3318++ 49.000000 0 0.000000
3319++ 343.000000 0 0.000000
3320++ 2401.000000 0 0.000000
3321++ 16807.000000 0 0.000000
3322++ 117649.000000 0 0.000000
3323++ 823543.000000 0 0.000000
3324++ 5764801.00000 0 0.000000
3325++TOO LONG 0 TOO LONG
3326++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3327++time count total
3328++ 0.000001 0 0.000000
3329++ 0.000008 0 0.000000
3330++ 0.000059 0 0.000000
3331++ 0.000416 0 0.000000
3332++ 0.002915 0 0.000000
3333++ 0.020408 0 0.000000
3334++ 0.142857 0 0.000000
3335++ 1.000000 11 4.050000
3336++ 7.000000 11 25.700000
3337++ 49.000000 0 0.000000
3338++ 343.000000 0 0.000000
3339++ 2401.000000 0 0.000000
3340++ 16807.000000 0 0.000000
3341++ 117649.000000 0 0.000000
3342++ 823543.000000 0 0.000000
3343++ 5764801.00000 0 0.000000
3344++TOO LONG 0 TOO LONG
3345++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3346++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
3347++FLUSH QUERY_RESPONSE_TIME;
3348++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3349++SET SESSION debug="+d,query_exec_time_0.31";
3350++SET SESSION debug="+d,query_exec_time_0.32";
3351++SET SESSION debug="+d,query_exec_time_0.33";
3352++SET SESSION debug="+d,query_exec_time_0.34";
3353++SET SESSION debug="+d,query_exec_time_0.35";
3354++SET SESSION debug="+d,query_exec_time_0.36";
3355++SET SESSION debug="+d,query_exec_time_0.37";
3356++SET SESSION debug="+d,query_exec_time_0.38";
3357++SET SESSION debug="+d,query_exec_time_0.39";
3358++SET SESSION debug="+d,query_exec_time_0.4";
3359++SET SESSION debug="+d,query_exec_time_1.1";
3360++SET SESSION debug="+d,query_exec_time_1.2";
3361++SET SESSION debug="+d,query_exec_time_1.3";
3362++SET SESSION debug="+d,query_exec_time_1.5";
3363++SET SESSION debug="+d,query_exec_time_1.4";
3364++SET SESSION debug="+d,query_exec_time_0.5";
3365++SET SESSION debug="+d,query_exec_time_2.1";
3366++SET SESSION debug="+d,query_exec_time_2.3";
3367++SET SESSION debug="+d,query_exec_time_2.5";
3368++SET SESSION debug="+d,query_exec_time_3.1";
3369++SET SESSION debug="+d,query_exec_time_4.1";
3370++SET SESSION debug="+d,query_exec_time_5.1";
3371++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3372++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3373++Variable_name Value
3374++query_response_time_range_base 156
3375++SHOW QUERY_RESPONSE_TIME;
3376++
3377++ 0.000041 0 0.000000
3378++ 0.006410 0 0.000000
3379++ 1.000000 11 4.050000
3380++ 156.000000 11 25.700000
3381++ 24336.000000 0 0.000000
3382++ 3796416.00000 0 0.000000
3383++TOO LONG 0 TOO LONG
3384++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3385++time count total
3386++ 0.000041 0 0.000000
3387++ 0.006410 0 0.000000
3388++ 1.000000 11 4.050000
3389++ 156.000000 11 25.700000
3390++ 24336.000000 0 0.000000
3391++ 3796416.00000 0 0.000000
3392++TOO LONG 0 TOO LONG
3393++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3394++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
3395++FLUSH QUERY_RESPONSE_TIME;
3396++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3397++SET SESSION debug="+d,query_exec_time_0.31";
3398++SET SESSION debug="+d,query_exec_time_0.32";
3399++SET SESSION debug="+d,query_exec_time_0.33";
3400++SET SESSION debug="+d,query_exec_time_0.34";
3401++SET SESSION debug="+d,query_exec_time_0.35";
3402++SET SESSION debug="+d,query_exec_time_0.36";
3403++SET SESSION debug="+d,query_exec_time_0.37";
3404++SET SESSION debug="+d,query_exec_time_0.38";
3405++SET SESSION debug="+d,query_exec_time_0.39";
3406++SET SESSION debug="+d,query_exec_time_0.4";
3407++SET SESSION debug="+d,query_exec_time_1.1";
3408++SET SESSION debug="+d,query_exec_time_1.2";
3409++SET SESSION debug="+d,query_exec_time_1.3";
3410++SET SESSION debug="+d,query_exec_time_1.5";
3411++SET SESSION debug="+d,query_exec_time_1.4";
3412++SET SESSION debug="+d,query_exec_time_0.5";
3413++SET SESSION debug="+d,query_exec_time_2.1";
3414++SET SESSION debug="+d,query_exec_time_2.3";
3415++SET SESSION debug="+d,query_exec_time_2.5";
3416++SET SESSION debug="+d,query_exec_time_3.1";
3417++SET SESSION debug="+d,query_exec_time_4.1";
3418++SET SESSION debug="+d,query_exec_time_5.1";
3419++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3420++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3421++Variable_name Value
3422++query_response_time_range_base 1000
3423++SHOW QUERY_RESPONSE_TIME;
3424++
3425++ 0.000001 0 0.000000
3426++ 0.001000 0 0.000000
3427++ 1.000000 11 4.050000
3428++ 1000.000000 11 25.700000
3429++ 1000000.00000 0 0.000000
3430++TOO LONG 0 TOO LONG
3431++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3432++time count total
3433++ 0.000001 0 0.000000
3434++ 0.001000 0 0.000000
3435++ 1.000000 11 4.050000
3436++ 1000.000000 11 25.700000
3437++ 1000000.00000 0 0.000000
3438++TOO LONG 0 TOO LONG
3439++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3440++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
3441++Warnings:
3442++Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
3443++FLUSH QUERY_RESPONSE_TIME;
3444++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3445++SET SESSION debug="+d,query_exec_time_0.31";
3446++SET SESSION debug="+d,query_exec_time_0.32";
3447++SET SESSION debug="+d,query_exec_time_0.33";
3448++SET SESSION debug="+d,query_exec_time_0.34";
3449++SET SESSION debug="+d,query_exec_time_0.35";
3450++SET SESSION debug="+d,query_exec_time_0.36";
3451++SET SESSION debug="+d,query_exec_time_0.37";
3452++SET SESSION debug="+d,query_exec_time_0.38";
3453++SET SESSION debug="+d,query_exec_time_0.39";
3454++SET SESSION debug="+d,query_exec_time_0.4";
3455++SET SESSION debug="+d,query_exec_time_1.1";
3456++SET SESSION debug="+d,query_exec_time_1.2";
3457++SET SESSION debug="+d,query_exec_time_1.3";
3458++SET SESSION debug="+d,query_exec_time_1.5";
3459++SET SESSION debug="+d,query_exec_time_1.4";
3460++SET SESSION debug="+d,query_exec_time_0.5";
3461++SET SESSION debug="+d,query_exec_time_2.1";
3462++SET SESSION debug="+d,query_exec_time_2.3";
3463++SET SESSION debug="+d,query_exec_time_2.5";
3464++SET SESSION debug="+d,query_exec_time_3.1";
3465++SET SESSION debug="+d,query_exec_time_4.1";
3466++SET SESSION debug="+d,query_exec_time_5.1";
3467++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3468++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3469++Variable_name Value
3470++query_response_time_range_base 1000
3471++SHOW QUERY_RESPONSE_TIME;
3472++
3473++ 0.000001 0 0.000000
3474++ 0.001000 0 0.000000
3475++ 1.000000 11 4.050000
3476++ 1000.000000 11 25.700000
3477++ 1000000.00000 0 0.000000
3478++TOO LONG 0 TOO LONG
3479++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3480++time count total
3481++ 0.000001 0 0.000000
3482++ 0.001000 0 0.000000
3483++ 1.000000 11 4.050000
3484++ 1000.000000 11 25.700000
3485++ 1000000.00000 0 0.000000
3486++TOO LONG 0 TOO LONG
3487++SET GLOBAL debug="";
3488++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
3489++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=default;
3490+diff -ruN a/mysql-test/suite/percona/r/query_response_time-stored.result b/mysql-test/suite/percona/r/query_response_time-stored.result
3491+--- a/mysql-test/suite/percona/r/query_response_time-stored.result 1970-01-01 03:00:00.000000000 +0300
3492++++ b/mysql-test/suite/percona/r/query_response_time-stored.result 2011-07-11 04:32:14.877520284 +0300
3493+@@ -0,0 +1,529 @@
3494++CREATE PROCEDURE test_f(time VARCHAR(5),i INT)
3495++BEGIN
3496++SET SESSION debug=CONCAT("+d,query_exec_time_", time);
3497++/* query_exec_time= time */ INSERT INTO t VALUES(i);
3498++DELETE FROM t;
3499++END^
3500++SET GLOBAL debug="+d,query_exec_time_debug";
3501++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3502++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
3503++Warnings:
3504++Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
3505++FLUSH QUERY_RESPONSE_TIME;
3506++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3507++SET SESSION debug="+d,query_exec_time_0.31";
3508++SET SESSION debug="+d,query_exec_time_0.32";
3509++SET SESSION debug="+d,query_exec_time_0.33";
3510++SET SESSION debug="+d,query_exec_time_0.34";
3511++SET SESSION debug="+d,query_exec_time_0.35";
3512++SET SESSION debug="+d,query_exec_time_0.36";
3513++SET SESSION debug="+d,query_exec_time_0.37";
3514++SET SESSION debug="+d,query_exec_time_0.38";
3515++SET SESSION debug="+d,query_exec_time_0.39";
3516++SET SESSION debug="+d,query_exec_time_0.4";
3517++SET SESSION debug="+d,query_exec_time_1.1";
3518++SET SESSION debug="+d,query_exec_time_1.2";
3519++SET SESSION debug="+d,query_exec_time_1.3";
3520++SET SESSION debug="+d,query_exec_time_1.5";
3521++SET SESSION debug="+d,query_exec_time_1.4";
3522++SET SESSION debug="+d,query_exec_time_0.5";
3523++SET SESSION debug="+d,query_exec_time_2.1";
3524++SET SESSION debug="+d,query_exec_time_2.3";
3525++SET SESSION debug="+d,query_exec_time_2.5";
3526++SET SESSION debug="+d,query_exec_time_3.1";
3527++SET SESSION debug="+d,query_exec_time_4.1";
3528++SET SESSION debug="+d,query_exec_time_5.1";
3529++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3530++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3531++Variable_name Value
3532++query_response_time_range_base 2
3533++SHOW QUERY_RESPONSE_TIME;
3534++
3535++ 0.000001 0 0.000000
3536++ 0.000003 0 0.000000
3537++ 0.000007 0 0.000000
3538++ 0.000015 0 0.000000
3539++ 0.000030 0 0.000000
3540++ 0.000061 0 0.000000
3541++ 0.000122 0 0.000000
3542++ 0.000244 0 0.000000
3543++ 0.000488 0 0.000000
3544++ 0.000976 0 0.000000
3545++ 0.001953 0 0.000000
3546++ 0.003906 0 0.000000
3547++ 0.007812 0 0.000000
3548++ 0.015625 0 0.000000
3549++ 0.031250 0 0.000000
3550++ 0.062500 0 0.000000
3551++ 0.125000 0 0.000000
3552++ 0.250000 0 0.000000
3553++ 0.500000 10 3.550000
3554++ 1.000000 1 0.500000
3555++ 2.000000 5 6.500000
3556++ 4.000000 4 10.000000
3557++ 8.000000 2 9.200000
3558++ 16.000000 0 0.000000
3559++ 32.000000 0 0.000000
3560++ 64.000000 0 0.000000
3561++ 128.000000 0 0.000000
3562++ 256.000000 0 0.000000
3563++ 512.000000 0 0.000000
3564++ 1024.000000 0 0.000000
3565++ 2048.000000 0 0.000000
3566++ 4096.000000 0 0.000000
3567++ 8192.000000 0 0.000000
3568++ 16384.000000 0 0.000000
3569++ 32768.000000 0 0.000000
3570++ 65536.000000 0 0.000000
3571++ 131072.000000 0 0.000000
3572++ 262144.000000 0 0.000000
3573++ 524288.000000 0 0.000000
3574++ 1048576.00000 0 0.000000
3575++ 2097152.00000 0 0.000000
3576++ 4194304.00000 0 0.000000
3577++ 8388608.00000 0 0.000000
3578++TOO LONG 0 TOO LONG
3579++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3580++time count total
3581++ 0.000001 0 0.000000
3582++ 0.000003 0 0.000000
3583++ 0.000007 0 0.000000
3584++ 0.000015 0 0.000000
3585++ 0.000030 0 0.000000
3586++ 0.000061 0 0.000000
3587++ 0.000122 0 0.000000
3588++ 0.000244 0 0.000000
3589++ 0.000488 0 0.000000
3590++ 0.000976 0 0.000000
3591++ 0.001953 0 0.000000
3592++ 0.003906 0 0.000000
3593++ 0.007812 0 0.000000
3594++ 0.015625 0 0.000000
3595++ 0.031250 0 0.000000
3596++ 0.062500 0 0.000000
3597++ 0.125000 0 0.000000
3598++ 0.250000 0 0.000000
3599++ 0.500000 10 3.550000
3600++ 1.000000 1 0.500000
3601++ 2.000000 5 6.500000
3602++ 4.000000 4 10.000000
3603++ 8.000000 2 9.200000
3604++ 16.000000 0 0.000000
3605++ 32.000000 0 0.000000
3606++ 64.000000 0 0.000000
3607++ 128.000000 0 0.000000
3608++ 256.000000 0 0.000000
3609++ 512.000000 0 0.000000
3610++ 1024.000000 0 0.000000
3611++ 2048.000000 0 0.000000
3612++ 4096.000000 0 0.000000
3613++ 8192.000000 0 0.000000
3614++ 16384.000000 0 0.000000
3615++ 32768.000000 0 0.000000
3616++ 65536.000000 0 0.000000
3617++ 131072.000000 0 0.000000
3618++ 262144.000000 0 0.000000
3619++ 524288.000000 0 0.000000
3620++ 1048576.00000 0 0.000000
3621++ 2097152.00000 0 0.000000
3622++ 4194304.00000 0 0.000000
3623++ 8388608.00000 0 0.000000
3624++TOO LONG 0 TOO LONG
3625++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3626++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
3627++FLUSH QUERY_RESPONSE_TIME;
3628++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3629++SET SESSION debug="+d,query_exec_time_0.31";
3630++SET SESSION debug="+d,query_exec_time_0.32";
3631++SET SESSION debug="+d,query_exec_time_0.33";
3632++SET SESSION debug="+d,query_exec_time_0.34";
3633++SET SESSION debug="+d,query_exec_time_0.35";
3634++SET SESSION debug="+d,query_exec_time_0.36";
3635++SET SESSION debug="+d,query_exec_time_0.37";
3636++SET SESSION debug="+d,query_exec_time_0.38";
3637++SET SESSION debug="+d,query_exec_time_0.39";
3638++SET SESSION debug="+d,query_exec_time_0.4";
3639++SET SESSION debug="+d,query_exec_time_1.1";
3640++SET SESSION debug="+d,query_exec_time_1.2";
3641++SET SESSION debug="+d,query_exec_time_1.3";
3642++SET SESSION debug="+d,query_exec_time_1.5";
3643++SET SESSION debug="+d,query_exec_time_1.4";
3644++SET SESSION debug="+d,query_exec_time_0.5";
3645++SET SESSION debug="+d,query_exec_time_2.1";
3646++SET SESSION debug="+d,query_exec_time_2.3";
3647++SET SESSION debug="+d,query_exec_time_2.5";
3648++SET SESSION debug="+d,query_exec_time_3.1";
3649++SET SESSION debug="+d,query_exec_time_4.1";
3650++SET SESSION debug="+d,query_exec_time_5.1";
3651++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3652++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3653++Variable_name Value
3654++query_response_time_range_base 2
3655++SHOW QUERY_RESPONSE_TIME;
3656++
3657++ 0.000001 0 0.000000
3658++ 0.000003 0 0.000000
3659++ 0.000007 0 0.000000
3660++ 0.000015 0 0.000000
3661++ 0.000030 0 0.000000
3662++ 0.000061 0 0.000000
3663++ 0.000122 0 0.000000
3664++ 0.000244 0 0.000000
3665++ 0.000488 0 0.000000
3666++ 0.000976 0 0.000000
3667++ 0.001953 0 0.000000
3668++ 0.003906 0 0.000000
3669++ 0.007812 0 0.000000
3670++ 0.015625 0 0.000000
3671++ 0.031250 0 0.000000
3672++ 0.062500 0 0.000000
3673++ 0.125000 0 0.000000
3674++ 0.250000 0 0.000000
3675++ 0.500000 10 3.550000
3676++ 1.000000 1 0.500000
3677++ 2.000000 5 6.500000
3678++ 4.000000 4 10.000000
3679++ 8.000000 2 9.200000
3680++ 16.000000 0 0.000000
3681++ 32.000000 0 0.000000
3682++ 64.000000 0 0.000000
3683++ 128.000000 0 0.000000
3684++ 256.000000 0 0.000000
3685++ 512.000000 0 0.000000
3686++ 1024.000000 0 0.000000
3687++ 2048.000000 0 0.000000
3688++ 4096.000000 0 0.000000
3689++ 8192.000000 0 0.000000
3690++ 16384.000000 0 0.000000
3691++ 32768.000000 0 0.000000
3692++ 65536.000000 0 0.000000
3693++ 131072.000000 0 0.000000
3694++ 262144.000000 0 0.000000
3695++ 524288.000000 0 0.000000
3696++ 1048576.00000 0 0.000000
3697++ 2097152.00000 0 0.000000
3698++ 4194304.00000 0 0.000000
3699++ 8388608.00000 0 0.000000
3700++TOO LONG 0 TOO LONG
3701++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3702++time count total
3703++ 0.000001 0 0.000000
3704++ 0.000003 0 0.000000
3705++ 0.000007 0 0.000000
3706++ 0.000015 0 0.000000
3707++ 0.000030 0 0.000000
3708++ 0.000061 0 0.000000
3709++ 0.000122 0 0.000000
3710++ 0.000244 0 0.000000
3711++ 0.000488 0 0.000000
3712++ 0.000976 0 0.000000
3713++ 0.001953 0 0.000000
3714++ 0.003906 0 0.000000
3715++ 0.007812 0 0.000000
3716++ 0.015625 0 0.000000
3717++ 0.031250 0 0.000000
3718++ 0.062500 0 0.000000
3719++ 0.125000 0 0.000000
3720++ 0.250000 0 0.000000
3721++ 0.500000 10 3.550000
3722++ 1.000000 1 0.500000
3723++ 2.000000 5 6.500000
3724++ 4.000000 4 10.000000
3725++ 8.000000 2 9.200000
3726++ 16.000000 0 0.000000
3727++ 32.000000 0 0.000000
3728++ 64.000000 0 0.000000
3729++ 128.000000 0 0.000000
3730++ 256.000000 0 0.000000
3731++ 512.000000 0 0.000000
3732++ 1024.000000 0 0.000000
3733++ 2048.000000 0 0.000000
3734++ 4096.000000 0 0.000000
3735++ 8192.000000 0 0.000000
3736++ 16384.000000 0 0.000000
3737++ 32768.000000 0 0.000000
3738++ 65536.000000 0 0.000000
3739++ 131072.000000 0 0.000000
3740++ 262144.000000 0 0.000000
3741++ 524288.000000 0 0.000000
3742++ 1048576.00000 0 0.000000
3743++ 2097152.00000 0 0.000000
3744++ 4194304.00000 0 0.000000
3745++ 8388608.00000 0 0.000000
3746++TOO LONG 0 TOO LONG
3747++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3748++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
3749++FLUSH QUERY_RESPONSE_TIME;
3750++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3751++SET SESSION debug="+d,query_exec_time_0.31";
3752++SET SESSION debug="+d,query_exec_time_0.32";
3753++SET SESSION debug="+d,query_exec_time_0.33";
3754++SET SESSION debug="+d,query_exec_time_0.34";
3755++SET SESSION debug="+d,query_exec_time_0.35";
3756++SET SESSION debug="+d,query_exec_time_0.36";
3757++SET SESSION debug="+d,query_exec_time_0.37";
3758++SET SESSION debug="+d,query_exec_time_0.38";
3759++SET SESSION debug="+d,query_exec_time_0.39";
3760++SET SESSION debug="+d,query_exec_time_0.4";
3761++SET SESSION debug="+d,query_exec_time_1.1";
3762++SET SESSION debug="+d,query_exec_time_1.2";
3763++SET SESSION debug="+d,query_exec_time_1.3";
3764++SET SESSION debug="+d,query_exec_time_1.5";
3765++SET SESSION debug="+d,query_exec_time_1.4";
3766++SET SESSION debug="+d,query_exec_time_0.5";
3767++SET SESSION debug="+d,query_exec_time_2.1";
3768++SET SESSION debug="+d,query_exec_time_2.3";
3769++SET SESSION debug="+d,query_exec_time_2.5";
3770++SET SESSION debug="+d,query_exec_time_3.1";
3771++SET SESSION debug="+d,query_exec_time_4.1";
3772++SET SESSION debug="+d,query_exec_time_5.1";
3773++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3774++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3775++Variable_name Value
3776++query_response_time_range_base 10
3777++SHOW QUERY_RESPONSE_TIME;
3778++
3779++ 0.000001 0 0.000000
3780++ 0.000010 0 0.000000
3781++ 0.000100 0 0.000000
3782++ 0.001000 0 0.000000
3783++ 0.010000 0 0.000000
3784++ 0.100000 0 0.000000
3785++ 1.000000 11 4.050000
3786++ 10.000000 11 25.700000
3787++ 100.000000 0 0.000000
3788++ 1000.000000 0 0.000000
3789++ 10000.000000 0 0.000000
3790++ 100000.000000 0 0.000000
3791++ 1000000.00000 0 0.000000
3792++TOO LONG 0 TOO LONG
3793++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3794++time count total
3795++ 0.000001 0 0.000000
3796++ 0.000010 0 0.000000
3797++ 0.000100 0 0.000000
3798++ 0.001000 0 0.000000
3799++ 0.010000 0 0.000000
3800++ 0.100000 0 0.000000
3801++ 1.000000 11 4.050000
3802++ 10.000000 11 25.700000
3803++ 100.000000 0 0.000000
3804++ 1000.000000 0 0.000000
3805++ 10000.000000 0 0.000000
3806++ 100000.000000 0 0.000000
3807++ 1000000.00000 0 0.000000
3808++TOO LONG 0 TOO LONG
3809++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3810++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
3811++FLUSH QUERY_RESPONSE_TIME;
3812++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3813++SET SESSION debug="+d,query_exec_time_0.31";
3814++SET SESSION debug="+d,query_exec_time_0.32";
3815++SET SESSION debug="+d,query_exec_time_0.33";
3816++SET SESSION debug="+d,query_exec_time_0.34";
3817++SET SESSION debug="+d,query_exec_time_0.35";
3818++SET SESSION debug="+d,query_exec_time_0.36";
3819++SET SESSION debug="+d,query_exec_time_0.37";
3820++SET SESSION debug="+d,query_exec_time_0.38";
3821++SET SESSION debug="+d,query_exec_time_0.39";
3822++SET SESSION debug="+d,query_exec_time_0.4";
3823++SET SESSION debug="+d,query_exec_time_1.1";
3824++SET SESSION debug="+d,query_exec_time_1.2";
3825++SET SESSION debug="+d,query_exec_time_1.3";
3826++SET SESSION debug="+d,query_exec_time_1.5";
3827++SET SESSION debug="+d,query_exec_time_1.4";
3828++SET SESSION debug="+d,query_exec_time_0.5";
3829++SET SESSION debug="+d,query_exec_time_2.1";
3830++SET SESSION debug="+d,query_exec_time_2.3";
3831++SET SESSION debug="+d,query_exec_time_2.5";
3832++SET SESSION debug="+d,query_exec_time_3.1";
3833++SET SESSION debug="+d,query_exec_time_4.1";
3834++SET SESSION debug="+d,query_exec_time_5.1";
3835++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3836++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3837++Variable_name Value
3838++query_response_time_range_base 7
3839++SHOW QUERY_RESPONSE_TIME;
3840++
3841++ 0.000001 0 0.000000
3842++ 0.000008 0 0.000000
3843++ 0.000059 0 0.000000
3844++ 0.000416 0 0.000000
3845++ 0.002915 0 0.000000
3846++ 0.020408 0 0.000000
3847++ 0.142857 0 0.000000
3848++ 1.000000 11 4.050000
3849++ 7.000000 11 25.700000
3850++ 49.000000 0 0.000000
3851++ 343.000000 0 0.000000
3852++ 2401.000000 0 0.000000
3853++ 16807.000000 0 0.000000
3854++ 117649.000000 0 0.000000
3855++ 823543.000000 0 0.000000
3856++ 5764801.00000 0 0.000000
3857++TOO LONG 0 TOO LONG
3858++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3859++time count total
3860++ 0.000001 0 0.000000
3861++ 0.000008 0 0.000000
3862++ 0.000059 0 0.000000
3863++ 0.000416 0 0.000000
3864++ 0.002915 0 0.000000
3865++ 0.020408 0 0.000000
3866++ 0.142857 0 0.000000
3867++ 1.000000 11 4.050000
3868++ 7.000000 11 25.700000
3869++ 49.000000 0 0.000000
3870++ 343.000000 0 0.000000
3871++ 2401.000000 0 0.000000
3872++ 16807.000000 0 0.000000
3873++ 117649.000000 0 0.000000
3874++ 823543.000000 0 0.000000
3875++ 5764801.00000 0 0.000000
3876++TOO LONG 0 TOO LONG
3877++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3878++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
3879++FLUSH QUERY_RESPONSE_TIME;
3880++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3881++SET SESSION debug="+d,query_exec_time_0.31";
3882++SET SESSION debug="+d,query_exec_time_0.32";
3883++SET SESSION debug="+d,query_exec_time_0.33";
3884++SET SESSION debug="+d,query_exec_time_0.34";
3885++SET SESSION debug="+d,query_exec_time_0.35";
3886++SET SESSION debug="+d,query_exec_time_0.36";
3887++SET SESSION debug="+d,query_exec_time_0.37";
3888++SET SESSION debug="+d,query_exec_time_0.38";
3889++SET SESSION debug="+d,query_exec_time_0.39";
3890++SET SESSION debug="+d,query_exec_time_0.4";
3891++SET SESSION debug="+d,query_exec_time_1.1";
3892++SET SESSION debug="+d,query_exec_time_1.2";
3893++SET SESSION debug="+d,query_exec_time_1.3";
3894++SET SESSION debug="+d,query_exec_time_1.5";
3895++SET SESSION debug="+d,query_exec_time_1.4";
3896++SET SESSION debug="+d,query_exec_time_0.5";
3897++SET SESSION debug="+d,query_exec_time_2.1";
3898++SET SESSION debug="+d,query_exec_time_2.3";
3899++SET SESSION debug="+d,query_exec_time_2.5";
3900++SET SESSION debug="+d,query_exec_time_3.1";
3901++SET SESSION debug="+d,query_exec_time_4.1";
3902++SET SESSION debug="+d,query_exec_time_5.1";
3903++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3904++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3905++Variable_name Value
3906++query_response_time_range_base 156
3907++SHOW QUERY_RESPONSE_TIME;
3908++
3909++ 0.000041 0 0.000000
3910++ 0.006410 0 0.000000
3911++ 1.000000 11 4.050000
3912++ 156.000000 11 25.700000
3913++ 24336.000000 0 0.000000
3914++ 3796416.00000 0 0.000000
3915++TOO LONG 0 TOO LONG
3916++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3917++time count total
3918++ 0.000041 0 0.000000
3919++ 0.006410 0 0.000000
3920++ 1.000000 11 4.050000
3921++ 156.000000 11 25.700000
3922++ 24336.000000 0 0.000000
3923++ 3796416.00000 0 0.000000
3924++TOO LONG 0 TOO LONG
3925++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3926++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
3927++FLUSH QUERY_RESPONSE_TIME;
3928++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3929++SET SESSION debug="+d,query_exec_time_0.31";
3930++SET SESSION debug="+d,query_exec_time_0.32";
3931++SET SESSION debug="+d,query_exec_time_0.33";
3932++SET SESSION debug="+d,query_exec_time_0.34";
3933++SET SESSION debug="+d,query_exec_time_0.35";
3934++SET SESSION debug="+d,query_exec_time_0.36";
3935++SET SESSION debug="+d,query_exec_time_0.37";
3936++SET SESSION debug="+d,query_exec_time_0.38";
3937++SET SESSION debug="+d,query_exec_time_0.39";
3938++SET SESSION debug="+d,query_exec_time_0.4";
3939++SET SESSION debug="+d,query_exec_time_1.1";
3940++SET SESSION debug="+d,query_exec_time_1.2";
3941++SET SESSION debug="+d,query_exec_time_1.3";
3942++SET SESSION debug="+d,query_exec_time_1.5";
3943++SET SESSION debug="+d,query_exec_time_1.4";
3944++SET SESSION debug="+d,query_exec_time_0.5";
3945++SET SESSION debug="+d,query_exec_time_2.1";
3946++SET SESSION debug="+d,query_exec_time_2.3";
3947++SET SESSION debug="+d,query_exec_time_2.5";
3948++SET SESSION debug="+d,query_exec_time_3.1";
3949++SET SESSION debug="+d,query_exec_time_4.1";
3950++SET SESSION debug="+d,query_exec_time_5.1";
3951++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3952++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
3953++Variable_name Value
3954++query_response_time_range_base 1000
3955++SHOW QUERY_RESPONSE_TIME;
3956++
3957++ 0.000001 0 0.000000
3958++ 0.001000 0 0.000000
3959++ 1.000000 11 4.050000
3960++ 1000.000000 11 25.700000
3961++ 1000000.00000 0 0.000000
3962++TOO LONG 0 TOO LONG
3963++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
3964++time count total
3965++ 0.000001 0 0.000000
3966++ 0.001000 0 0.000000
3967++ 1.000000 11 4.050000
3968++ 1000.000000 11 25.700000
3969++ 1000000.00000 0 0.000000
3970++TOO LONG 0 TOO LONG
3971++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
3972++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
3973++Warnings:
3974++Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
3975++FLUSH QUERY_RESPONSE_TIME;
3976++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
3977++SET SESSION debug="+d,query_exec_time_0.31";
3978++SET SESSION debug="+d,query_exec_time_0.32";
3979++SET SESSION debug="+d,query_exec_time_0.33";
3980++SET SESSION debug="+d,query_exec_time_0.34";
3981++SET SESSION debug="+d,query_exec_time_0.35";
3982++SET SESSION debug="+d,query_exec_time_0.36";
3983++SET SESSION debug="+d,query_exec_time_0.37";
3984++SET SESSION debug="+d,query_exec_time_0.38";
3985++SET SESSION debug="+d,query_exec_time_0.39";
3986++SET SESSION debug="+d,query_exec_time_0.4";
3987++SET SESSION debug="+d,query_exec_time_1.1";
3988++SET SESSION debug="+d,query_exec_time_1.2";
3989++SET SESSION debug="+d,query_exec_time_1.3";
3990++SET SESSION debug="+d,query_exec_time_1.5";
3991++SET SESSION debug="+d,query_exec_time_1.4";
3992++SET SESSION debug="+d,query_exec_time_0.5";
3993++SET SESSION debug="+d,query_exec_time_2.1";
3994++SET SESSION debug="+d,query_exec_time_2.3";
3995++SET SESSION debug="+d,query_exec_time_2.5";
3996++SET SESSION debug="+d,query_exec_time_3.1";
3997++SET SESSION debug="+d,query_exec_time_4.1";
3998++SET SESSION debug="+d,query_exec_time_5.1";
3999++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
4000++SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
4001++Variable_name Value
4002++query_response_time_range_base 1000
4003++SHOW QUERY_RESPONSE_TIME;
4004++
4005++ 0.000001 0 0.000000
4006++ 0.001000 0 0.000000
4007++ 1.000000 11 4.050000
4008++ 1000.000000 11 25.700000
4009++ 1000000.00000 0 0.000000
4010++TOO LONG 0 TOO LONG
4011++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
4012++time count total
4013++ 0.000001 0 0.000000
4014++ 0.001000 0 0.000000
4015++ 1.000000 11 4.050000
4016++ 1000.000000 11 25.700000
4017++ 1000000.00000 0 0.000000
4018++TOO LONG 0 TOO LONG
4019++SET GLOBAL debug="";
4020++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
4021++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=default;
4022++DROP PROCEDURE test_f;
4023+diff -ruN a/mysql-test/suite/percona/t/query_response_time-replication.test b/mysql-test/suite/percona/t/query_response_time-replication.test
4024+--- a/mysql-test/suite/percona/t/query_response_time-replication.test 1970-01-01 03:00:00.000000000 +0300
4025++++ b/mysql-test/suite/percona/t/query_response_time-replication.test 2011-07-11 04:32:14.877520284 +0300
4026+@@ -0,0 +1,40 @@
4027++--source include/have_response_time_distribution.inc
4028++--source include/have_debug.inc
4029++--source include/have_binlog_format_statement.inc
4030++--source include/master-slave.inc
4031++
4032++connection master;
4033++--disable_warnings
4034++DROP TABLE IF EXISTS t;
4035++--enable_warnings
4036++CREATE TABLE t(id INT);
4037++sync_slave_with_master;
4038++
4039++connection slave;
4040++SET GLOBAL debug="+d,query_exec_time_debug";
4041++
4042++--let base=1
4043++--source suite/percona/include/query_response_time.inc
4044++--let base=2
4045++--source suite/percona/include/query_response_time.inc
4046++--let base=10
4047++--source suite/percona/include/query_response_time.inc
4048++--let base=7
4049++--source suite/percona/include/query_response_time.inc
4050++--let base=156
4051++--source suite/percona/include/query_response_time.inc
4052++--let base=1000
4053++--source suite/percona/include/query_response_time.inc
4054++--let base=1001
4055++--source suite/percona/include/query_response_time.inc
4056++
4057++connection slave;
4058++SET GLOBAL debug="";
4059++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
4060++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=default;
4061++
4062++connection master;
4063++DROP TABLE t;
4064++sync_slave_with_master;
4065++
4066++--source include/rpl_end.inc
4067+diff -ruN a/mysql-test/suite/percona/t/query_response_time-stored.test b/mysql-test/suite/percona/t/query_response_time-stored.test
4068+--- a/mysql-test/suite/percona/t/query_response_time-stored.test 1970-01-01 03:00:00.000000000 +0300
4069++++ b/mysql-test/suite/percona/t/query_response_time-stored.test 2011-07-11 04:32:14.877520284 +0300
4070+@@ -0,0 +1,34 @@
4071++--source include/have_response_time_distribution.inc
4072++--source include/have_debug.inc
4073++
4074++delimiter ^;
4075++CREATE PROCEDURE test_f(time VARCHAR(5),i INT)
4076++BEGIN
4077++ SET SESSION debug=CONCAT("+d,query_exec_time_", time);
4078++ /* query_exec_time= time */ INSERT INTO t VALUES(i);
4079++ DELETE FROM t;
4080++END^
4081++delimiter ;^
4082++
4083++SET GLOBAL debug="+d,query_exec_time_debug";
4084++
4085++--let base=1
4086++--source suite/percona/include/query_response_time.inc
4087++--let base=2
4088++--source suite/percona/include/query_response_time.inc
4089++--let base=10
4090++--source suite/percona/include/query_response_time.inc
4091++--let base=7
4092++--source suite/percona/include/query_response_time.inc
4093++--let base=156
4094++--source suite/percona/include/query_response_time.inc
4095++--let base=1000
4096++--source suite/percona/include/query_response_time.inc
4097++--let base=1001
4098++--source suite/percona/include/query_response_time.inc
4099++
4100++SET GLOBAL debug="";
4101++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
4102++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=default;
4103++
4104++DROP PROCEDURE test_f;
4105+diff -ruN a/mysql-test/suite/percona/t/query_response_time.test b/mysql-test/suite/percona/t/query_response_time.test
4106+--- a/mysql-test/suite/percona/t/query_response_time.test 1970-01-01 03:00:00.000000000 +0300
4107++++ b/mysql-test/suite/percona/t/query_response_time.test 2011-07-11 04:32:14.879520299 +0300
4108+@@ -0,0 +1,23 @@
4109++--source include/have_response_time_distribution.inc
4110++--source include/have_debug.inc
4111++
4112++SET GLOBAL debug="+d,query_exec_time_debug";
4113++
4114++--let base=1
4115++--source suite/percona/include/query_response_time.inc
4116++--let base=2
4117++--source suite/percona/include/query_response_time.inc
4118++--let base=10
4119++--source suite/percona/include/query_response_time.inc
4120++--let base=7
4121++--source suite/percona/include/query_response_time.inc
4122++--let base=156
4123++--source suite/percona/include/query_response_time.inc
4124++--let base=1000
4125++--source suite/percona/include/query_response_time.inc
4126++--let base=1001
4127++--source suite/percona/include/query_response_time.inc
4128++
4129++SET GLOBAL debug="";
4130++SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
4131++SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=default;
4132+diff -ruN a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
4133+--- a/mysys/CMakeLists.txt 2011-04-12 15:11:35.000000000 +0300
4134++++ b/mysys/CMakeLists.txt 2011-07-11 04:32:14.879520299 +0300
4135+@@ -41,7 +41,8 @@
4136+ my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c my_wincond.c
4137+ my_windac.c my_winthread.c my_write.c ptr_cmp.c queues.c stacktrace.c
4138+ rijndael.c safemalloc.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
4139+- thr_rwlock.c tree.c typelib.c my_vle.c base64.c my_memmem.c my_getpagesize.c)
4140++ thr_rwlock.c tree.c typelib.c my_vle.c base64.c my_memmem.c my_getpagesize.c
4141++ my_atomic.c)
4142+
4143+ IF(NOT SOURCE_SUBLIBS)
4144+ ADD_LIBRARY(mysys ${MYSYS_SOURCES})
4145+diff -ruN a/mysys/Makefile.am b/mysys/Makefile.am
4146+--- a/mysys/Makefile.am 2011-04-12 15:11:35.000000000 +0300
4147++++ b/mysys/Makefile.am 2011-07-11 04:32:14.879520300 +0300
4148+@@ -51,7 +51,8 @@
4149+ rijndael.c my_aes.c sha1.c \
4150+ my_compare.c my_netware.c my_largepage.c \
4151+ my_memmem.c stacktrace.c \
4152+- my_windac.c my_access.c base64.c my_libwrap.c
4153++ my_windac.c my_access.c base64.c my_libwrap.c \
4154++ my_atomic.c
4155+
4156+ if NEED_THREAD
4157+ # mf_keycache is used only in the server, so it is safe to leave the file
4158+diff -ruN a/mysys/my_atomic.c b/mysys/my_atomic.c
4159+--- a/mysys/my_atomic.c 1970-01-01 03:00:00.000000000 +0300
4160++++ b/mysys/my_atomic.c 2011-07-11 04:32:14.879520300 +0300
4161+@@ -0,0 +1,289 @@
4162++#ifndef MY_ATOMIC_INCLUDED
4163++#define MY_ATOMIC_INCLUDED
4164++
4165++/* Copyright (C) 2006 MySQL AB
4166++
4167++ This program is free software; you can redistribute it and/or modify
4168++ it under the terms of the GNU General Public License as published by
4169++ the Free Software Foundation; version 2 of the License.
4170++
4171++ This program is distributed in the hope that it will be useful,
4172++ but WITHOUT ANY WARRANTY; without even the implied warranty of
4173++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4174++ GNU General Public License for more details.
4175++
4176++ You should have received a copy of the GNU General Public License
4177++ along with this program; if not, write to the Free Software
4178++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
4179++
4180++/*
4181++ This header defines five atomic operations:
4182++
4183++ my_atomic_add#(&var, what)
4184++ 'Fetch and Add'
4185++ add 'what' to *var, and return the old value of *var
4186++
4187++ my_atomic_fas#(&var, what)
4188++ 'Fetch And Store'
4189++ store 'what' in *var, and return the old value of *var
4190++
4191++ my_atomic_cas#(&var, &old, new)
4192++ An odd variation of 'Compare And Set/Swap'
4193++ if *var is equal to *old, then store 'new' in *var, and return TRUE
4194++ otherwise store *var in *old, and return FALSE
4195++ Usually, &old should not be accessed if the operation is successful.
4196++
4197++ my_atomic_load#(&var)
4198++ return *var
4199++
4200++ my_atomic_store#(&var, what)
4201++ store 'what' in *var
4202++
4203++ '#' is substituted by a size suffix - 8, 16, 32, 64, or ptr
4204++ (e.g. my_atomic_add8, my_atomic_fas32, my_atomic_casptr).
4205++
4206++ NOTE This operations are not always atomic, so they always must be
4207++ enclosed in my_atomic_rwlock_rdlock(lock)/my_atomic_rwlock_rdunlock(lock)
4208++ or my_atomic_rwlock_wrlock(lock)/my_atomic_rwlock_wrunlock(lock).
4209++ Hint: if a code block makes intensive use of atomic ops, it make sense
4210++ to take/release rwlock once for the whole block, not for every statement.
4211++
4212++ On architectures where these operations are really atomic, rwlocks will
4213++ be optimized away.
4214++ 8- and 16-bit atomics aren't implemented for windows (see generic-msvc.h),
4215++ but can be added, if necessary.
4216++*/
4217++
4218++#include "my_global.h"
4219++
4220++#ifndef my_atomic_rwlock_init
4221++
4222++#define intptr void *
4223++/**
4224++ Currently we don't support 8-bit and 16-bit operations.
4225++ It can be added later if needed.
4226++*/
4227++#undef MY_ATOMIC_HAS_8_16
4228++
4229++#ifndef MY_ATOMIC_MODE_RWLOCKS
4230++/*
4231++ * Attempt to do atomic ops without locks
4232++ */
4233++#include "atomic/nolock.h"
4234++#endif
4235++
4236++#ifndef make_atomic_cas_body
4237++/* nolock.h was not able to generate even a CAS function, fall back */
4238++#include "atomic/rwlock.h"
4239++#endif
4240++
4241++/* define missing functions by using the already generated ones */
4242++#ifndef make_atomic_add_body
4243++#define make_atomic_add_body(S) \
4244++ int ## S tmp=*a; \
4245++ while (!my_atomic_cas ## S(a, &tmp, tmp+v)) ; \
4246++ v=tmp;
4247++#endif
4248++#ifndef make_atomic_fas_body
4249++#define make_atomic_fas_body(S) \
4250++ int ## S tmp=*a; \
4251++ while (!my_atomic_cas ## S(a, &tmp, v)) ; \
4252++ v=tmp;
4253++#endif
4254++#ifndef make_atomic_load_body
4255++#define make_atomic_load_body(S) \
4256++ ret= 0; /* avoid compiler warning */ \
4257++ (void)(my_atomic_cas ## S(a, &ret, ret));
4258++#endif
4259++#ifndef make_atomic_store_body
4260++#define make_atomic_store_body(S) \
4261++ (void)(my_atomic_fas ## S (a, v));
4262++#endif
4263++
4264++/*
4265++ transparent_union doesn't work in g++
4266++ Bug ?
4267++
4268++ Darwin's gcc doesn't want to put pointers in a transparent_union
4269++ when built with -arch ppc64. Complains:
4270++ warning: 'transparent_union' attribute ignored
4271++*/
4272++#if defined(__GNUC__) && !defined(__cplusplus) && \
4273++ ! (defined(__APPLE__) && (defined(_ARCH_PPC64) ||defined (_ARCH_PPC)))
4274++/*
4275++ we want to be able to use my_atomic_xxx functions with
4276++ both signed and unsigned integers. But gcc will issue a warning
4277++ "passing arg N of `my_atomic_XXX' as [un]signed due to prototype"
4278++ if the signedness of the argument doesn't match the prototype, or
4279++ "pointer targets in passing argument N of my_atomic_XXX differ in signedness"
4280++ if int* is used where uint* is expected (or vice versa).
4281++ Let's shut these warnings up
4282++*/
4283++#define make_transparent_unions(S) \
4284++ typedef union { \
4285++ int ## S i; \
4286++ uint ## S u; \
4287++ } U_ ## S __attribute__ ((transparent_union)); \
4288++ typedef union { \
4289++ int ## S volatile *i; \
4290++ uint ## S volatile *u; \
4291++ } Uv_ ## S __attribute__ ((transparent_union));
4292++#define uintptr intptr
4293++make_transparent_unions(8)
4294++make_transparent_unions(16)
4295++make_transparent_unions(32)
4296++make_transparent_unions(64)
4297++make_transparent_unions(ptr)
4298++#undef uintptr
4299++#undef make_transparent_unions
4300++#define a U_a.i
4301++#define cmp U_cmp.i
4302++#define v U_v.i
4303++#define set U_set.i
4304++#else
4305++#define U_8 int8
4306++#define U_16 int16
4307++#define U_32 int32
4308++#define U_64 int64
4309++#define U_ptr intptr
4310++#define Uv_8 int8
4311++#define Uv_16 int16
4312++#define Uv_32 int32
4313++#define Uv_64 int64
4314++#define Uv_ptr intptr
4315++#define U_a volatile *a
4316++#define U_cmp *cmp
4317++#define U_v v
4318++#define U_set set
4319++#endif /* __GCC__ transparent_union magic */
4320++
4321++#define make_atomic_cas(S) \
4322++static inline int my_atomic_cas ## S(Uv_ ## S U_a, \
4323++ Uv_ ## S U_cmp, U_ ## S U_set) \
4324++{ \
4325++ int8 ret; \
4326++ make_atomic_cas_body(S); \
4327++ return ret; \
4328++}
4329++
4330++#define make_atomic_add(S) \
4331++static inline int ## S my_atomic_add ## S( \
4332++ Uv_ ## S U_a, U_ ## S U_v) \
4333++{ \
4334++ make_atomic_add_body(S); \
4335++ return v; \
4336++}
4337++
4338++#define make_atomic_fas(S) \
4339++static inline int ## S my_atomic_fas ## S( \
4340++ Uv_ ## S U_a, U_ ## S U_v) \
4341++{ \
4342++ make_atomic_fas_body(S); \
4343++ return v; \
4344++}
4345++
4346++#define make_atomic_load(S) \
4347++static inline int ## S my_atomic_load ## S(Uv_ ## S U_a) \
4348++{ \
4349++ int ## S ret; \
4350++ make_atomic_load_body(S); \
4351++ return ret; \
4352++}
4353++
4354++#define make_atomic_store(S) \
4355++static inline void my_atomic_store ## S( \
4356++ Uv_ ## S U_a, U_ ## S U_v) \
4357++{ \
4358++ make_atomic_store_body(S); \
4359++}
4360++
4361++#ifdef MY_ATOMIC_HAS_8_16
4362++make_atomic_cas(8)
4363++make_atomic_cas(16)
4364++#endif
4365++make_atomic_cas(32)
4366++make_atomic_cas(64)
4367++make_atomic_cas(ptr)
4368++
4369++#ifdef MY_ATOMIC_HAS_8_16
4370++make_atomic_add(8)
4371++make_atomic_add(16)
4372++#endif
4373++make_atomic_add(32)
4374++make_atomic_add(64)
4375++
4376++#ifdef MY_ATOMIC_HAS_8_16
4377++make_atomic_load(8)
4378++make_atomic_load(16)
4379++#endif
4380++make_atomic_load(32)
4381++make_atomic_load(64)
4382++make_atomic_load(ptr)
4383++
4384++#ifdef MY_ATOMIC_HAS_8_16
4385++make_atomic_fas(8)
4386++make_atomic_fas(16)
4387++#endif
4388++make_atomic_fas(32)
4389++make_atomic_fas(64)
4390++make_atomic_fas(ptr)
4391++
4392++#ifdef MY_ATOMIC_HAS_8_16
4393++make_atomic_store(8)
4394++make_atomic_store(16)
4395++#endif
4396++make_atomic_store(32)
4397++make_atomic_store(64)
4398++make_atomic_store(ptr)
4399++
4400++#ifdef _atomic_h_cleanup_
4401++#include _atomic_h_cleanup_
4402++#undef _atomic_h_cleanup_
4403++#endif
4404++
4405++#undef U_8
4406++#undef U_16
4407++#undef U_32
4408++#undef U_64
4409++#undef U_ptr
4410++#undef Uv_8
4411++#undef Uv_16
4412++#undef Uv_32
4413++#undef Uv_64
4414++#undef Uv_ptr
4415++#undef a
4416++#undef cmp
4417++#undef v
4418++#undef set
4419++#undef U_a
4420++#undef U_cmp
4421++#undef U_v
4422++#undef U_set
4423++#undef make_atomic_add
4424++#undef make_atomic_cas
4425++#undef make_atomic_load
4426++#undef make_atomic_store
4427++#undef make_atomic_fas
4428++#undef make_atomic_add_body
4429++#undef make_atomic_cas_body
4430++#undef make_atomic_load_body
4431++#undef make_atomic_store_body
4432++#undef make_atomic_fas_body
4433++#undef intptr
4434++
4435++/*
4436++ the macro below defines (as an expression) the code that
4437++ will be run in spin-loops. Intel manuals recummend to have PAUSE there.
4438++ It is expected to be defined in include/atomic/ *.h files
4439++*/
4440++#ifndef LF_BACKOFF
4441++#define LF_BACKOFF (1)
4442++#endif
4443++
4444++#define MY_ATOMIC_OK 0
4445++#define MY_ATOMIC_NOT_1CPU 1
4446++extern int my_atomic_initialize();
4447++
4448++#endif
4449++
4450++#endif /* MY_ATOMIC_INCLUDED */
4451 diff -ruN a/patch_info/response-time-distribution.info b/patch_info/response-time-distribution.info
4452---- a/patch_info/response-time-distribution.info 1970-01-01 00:00:00.000000000 +0000
4453-+++ b/patch_info/response-time-distribution.info 2010-11-01 08:52:40.000000000 +0000
4454+--- a/patch_info/response-time-distribution.info 1970-01-01 03:00:00.000000000 +0300
4455++++ b/patch_info/response-time-distribution.info 2011-07-11 04:32:14.881520312 +0300
4456 @@ -0,0 +1,9 @@
4457 +File=response-time-distribution.patch
4458 +Name=Response time distribution
4459@@ -37,9 +3164,20 @@
4460 +Changelog
4461 +2010-07-02 first version avaliable
4462 +2010-09-15 add column 'total'
4463+diff -ruN a/sql/lex.h b/sql/lex.h
4464+--- a/sql/lex.h 2011-07-11 04:31:52.073358439 +0300
4465++++ b/sql/lex.h 2011-07-11 04:32:14.881520312 +0300
4466+@@ -415,6 +415,7 @@
4467+ { "PURGE", SYM(PURGE)},
4468+ { "QUARTER", SYM(QUARTER_SYM)},
4469+ { "QUERY", SYM(QUERY_SYM)},
4470++ { "QUERY_RESPONSE_TIME", SYM(QUERY_RESPONSE_TIME_SYM)},
4471+ { "QUICK", SYM(QUICK)},
4472+ { "RANGE", SYM(RANGE_SYM)},
4473+ { "READ", SYM(READ_SYM)},
4474 diff -ruN a/sql/Makefile.am b/sql/Makefile.am
4475---- a/sql/Makefile.am 2010-11-01 08:43:52.000000000 +0000
4476-+++ b/sql/Makefile.am 2010-11-01 08:52:40.000000000 +0000
4477+--- a/sql/Makefile.am 2011-07-11 04:31:51.907357261 +0300
4478++++ b/sql/Makefile.am 2011-07-11 04:32:14.881520313 +0300
4479 @@ -66,7 +66,7 @@
4480 sql_repl.h slave.h rpl_filter.h rpl_injector.h \
4481 log_event.h rpl_record.h \
4482@@ -59,8 +3197,8 @@
4483 sql_profile.cc \
4484 sql_prepare.cc sql_error.cc sql_locale.cc \
4485 diff -ruN a/sql/Makefile.in b/sql/Makefile.in
4486---- a/sql/Makefile.in 2010-11-01 08:43:52.000000000 +0000
4487-+++ b/sql/Makefile.in 2010-11-01 08:52:40.000000000 +0000
4488+--- a/sql/Makefile.in 2011-07-11 04:31:51.909357275 +0300
4489++++ b/sql/Makefile.in 2011-07-11 04:32:14.883520326 +0300
4490 @@ -122,7 +122,7 @@
4491 sql_string.$(OBJEXT) sql_manager.$(OBJEXT) sql_map.$(OBJEXT) \
4492 mysqld.$(OBJEXT) password.$(OBJEXT) hash_filo.$(OBJEXT) \
4493@@ -96,35 +3234,9 @@
4494 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/records.Po@am__quote@
4495 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/repl_failsafe.Po@am__quote@
4496 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpl_filter.Po@am__quote@
4497-diff -ruN a/sql/lex.h b/sql/lex.h
4498---- a/sql/lex.h 2010-11-01 08:43:53.000000000 +0000
4499-+++ b/sql/lex.h 2010-11-01 08:52:40.000000000 +0000
4500-@@ -415,6 +415,7 @@
4501- { "PURGE", SYM(PURGE)},
4502- { "QUARTER", SYM(QUARTER_SYM)},
4503- { "QUERY", SYM(QUERY_SYM)},
4504-+ { "QUERY_RESPONSE_TIME", SYM(QUERY_RESPONSE_TIME_SYM)},
4505- { "QUICK", SYM(QUICK)},
4506- { "RANGE", SYM(RANGE_SYM)},
4507- { "READ", SYM(READ_SYM)},
4508-diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h
4509---- a/sql/mysql_priv.h 2010-11-01 08:43:57.000000000 +0000
4510-+++ b/sql/mysql_priv.h 2010-11-01 08:52:40.000000000 +0000
4511-@@ -2121,6 +2121,11 @@
4512- extern my_bool opt_query_cache_strip_comments;
4513- extern my_bool opt_use_global_long_query_time;
4514- extern my_bool opt_slow_query_log_microseconds_timestamp;
4515-+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
4516-+extern ulong opt_query_response_time_range_base;
4517-+extern my_bool opt_enable_query_response_time_stats;
4518-+#endif /* HAVE_RESPONSE_TIME_DISTRIBUTION */
4519-+extern SHOW_COMP_OPTION have_response_time_distribution;
4520- extern my_bool sp_automatic_privileges, opt_noacl;
4521- extern my_bool opt_old_style_user_limits, trust_function_creators;
4522- extern uint opt_crash_binlog_innodb;
4523 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
4524---- a/sql/mysqld.cc 2010-11-01 08:43:57.000000000 +0000
4525-+++ b/sql/mysqld.cc 2010-11-01 08:52:40.000000000 +0000
4526+--- a/sql/mysqld.cc 2011-07-11 04:31:52.948364649 +0300
4527++++ b/sql/mysqld.cc 2011-07-11 04:32:14.886520348 +0300
4528 @@ -32,6 +32,7 @@
4529
4530 #include "rpl_injector.h"
4531@@ -219,9 +3331,24 @@
4532 #ifdef HAVE_SPATIAL
4533 have_geometry=SHOW_OPTION_YES;
4534 #else
4535+diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h
4536+--- a/sql/mysql_priv.h 2011-07-11 04:31:52.901364315 +0300
4537++++ b/sql/mysql_priv.h 2011-07-11 04:32:14.891520383 +0300
4538+@@ -2121,6 +2121,11 @@
4539+ extern my_bool opt_query_cache_strip_comments;
4540+ extern my_bool opt_use_global_long_query_time;
4541+ extern my_bool opt_slow_query_log_microseconds_timestamp;
4542++#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
4543++extern ulong opt_query_response_time_range_base;
4544++extern my_bool opt_enable_query_response_time_stats;
4545++#endif /* HAVE_RESPONSE_TIME_DISTRIBUTION */
4546++extern SHOW_COMP_OPTION have_response_time_distribution;
4547+ extern my_bool sp_automatic_privileges, opt_noacl;
4548+ extern my_bool opt_old_style_user_limits, trust_function_creators;
4549+ extern uint opt_crash_binlog_innodb;
4550 diff -ruN a/sql/query_response_time.cc b/sql/query_response_time.cc
4551---- a/sql/query_response_time.cc 1970-01-01 00:00:00.000000000 +0000
4552-+++ b/sql/query_response_time.cc 2010-11-02 15:34:52.000000000 +0000
4553+--- a/sql/query_response_time.cc 1970-01-01 03:00:00.000000000 +0300
4554++++ b/sql/query_response_time.cc 2011-07-11 04:32:14.891520384 +0300
4555 @@ -0,0 +1,313 @@
4556 +#include "my_global.h"
4557 +#include "my_atomic.h"
4558@@ -537,8 +3664,8 @@
4559 +}
4560 +#endif /* HAVE_RESPONSE_TIME_DISTRIBUTION */
4561 diff -ruN a/sql/query_response_time.h b/sql/query_response_time.h
4562---- a/sql/query_response_time.h 1970-01-01 00:00:00.000000000 +0000
4563-+++ b/sql/query_response_time.h 2010-11-01 08:52:40.000000000 +0000
4564+--- a/sql/query_response_time.h 1970-01-01 03:00:00.000000000 +0300
4565++++ b/sql/query_response_time.h 2011-07-11 04:32:14.891520384 +0300
4566 @@ -0,0 +1,71 @@
4567 +#ifndef QUERY_RESPONSE_TIME_H
4568 +#define QUERY_RESPONSE_TIME_H
4569@@ -612,8 +3739,8 @@
4570 +
4571 +#endif // QUERY_RESPONSE_TIME_H
4572 diff -ruN a/sql/set_var.cc b/sql/set_var.cc
4573---- a/sql/set_var.cc 2010-11-01 08:43:57.000000000 +0000
4574-+++ b/sql/set_var.cc 2010-11-01 08:52:40.000000000 +0000
4575+--- a/sql/set_var.cc 2011-07-11 04:31:52.930364522 +0300
4576++++ b/sql/set_var.cc 2011-07-11 04:32:14.894520404 +0300
4577 @@ -1017,6 +1017,14 @@
4578 static sys_var_use_global_long_query_time sys_use_global_long_query_time;
4579 static sys_var_bool_ptr sys_slow_query_log_microseconds_timestamp(&vars, "slow_query_log_microseconds_timestamp",
4580@@ -630,8 +3757,8 @@
4581 static sys_var_log_state sys_var_log_slow(&vars, "log_slow_queries",
4582 &opt_slow_log, QUERY_LOG_SLOW);
4583 diff -ruN a/sql/sql_parse.cc b/sql/sql_parse.cc
4584---- a/sql/sql_parse.cc 2010-11-01 08:43:57.000000000 +0000
4585-+++ b/sql/sql_parse.cc 2010-11-01 08:52:40.000000000 +0000
4586+--- a/sql/sql_parse.cc 2011-07-11 04:31:52.853363975 +0300
4587++++ b/sql/sql_parse.cc 2011-07-11 04:32:14.897520426 +0300
4588 @@ -28,6 +28,7 @@
4589 #include "events.h"
4590 #include "sql_trigger.h"
4591@@ -640,58 +3767,39 @@
4592
4593 /**
4594 @defgroup Runtime_Environment Runtime Environment
4595-@@ -1764,23 +1765,37 @@
4596- Do not log administrative statements unless the appropriate option is
4597- set.
4598- */
4599-+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
4600-+ if (opt_enable_query_response_time_stats || thd->enable_slow_log)
4601-+#else /* HAVE_RESPONSE_TIME_DISTRIBUTION */
4602- if (thd->enable_slow_log)
4603-+#endif /* HAVE_RESPONSE_TIME_DISTRIBUTION */
4604- {
4605-- ulonglong end_utime_of_query= thd->current_utime();
4606-- thd_proc_info(thd, "logging slow query");
4607--
4608-- if (((end_utime_of_query - thd->utime_after_lock) >
4609-- thd->variables.long_query_time ||
4610-- ((thd->server_status &
4611-- (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
4612-- opt_log_queries_not_using_indexes &&
4613-- !(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND))) &&
4614-- thd->examined_row_count >= thd->variables.min_examined_row_limit)
4615-+ ulonglong end_utime_of_query = thd->current_utime();
4616-+ ulonglong query_execution_time = end_utime_of_query - thd->utime_after_lock;
4617-+ #ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
4618-+ if(opt_enable_query_response_time_stats)
4619-+ {
4620-+ query_response_time_collect(query_execution_time);
4621-+ }
4622-+ #endif /* HAVE_RESPONSE_TIME_DISTRIBUTION */
4623-+ if (thd->enable_slow_log)
4624- {
4625- thd_proc_info(thd, "logging slow query");
4626-- thd->status_var.long_query_count++;
4627-- slow_log_print(thd, thd->query(), thd->query_length(),
4628-- end_utime_of_query);
4629+@@ -1773,12 +1774,31 @@
4630+ DBUG_RETURN(query_exec_time);
4631+ }
4632+
4633++void query_response_time_collect_with_check(ulonglong query_exec_time)
4634++{
4635++ DBUG_ENTER("query_response_time_collect_with_check");
4636++ bool collect= opt_enable_query_response_time_stats;
4637++ DBUG_EXECUTE_IF("query_exec_time_debug",
4638++ {
4639++ if (0 == query_exec_time)
4640++ {
4641++ collect= false;
4642++ }
4643++ });
4644++ if(collect)
4645++ {
4646++ query_response_time_collect(query_exec_time);
4647++ }
4648++ DBUG_VOID_RETURN;
4649++}
4650 +
4651-+ if ((query_execution_time >
4652-+ thd->variables.long_query_time ||
4653-+ ((thd->server_status &
4654-+ (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
4655-+ opt_log_queries_not_using_indexes &&
4656-+ !(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND))) &&
4657-+ thd->examined_row_count >= thd->variables.min_examined_row_limit)
4658-+ {
4659-+ thd_proc_info(thd, "logging slow query");
4660-+ thd->status_var.long_query_count++;
4661-+ slow_log_print(thd, thd->query(), thd->query_length(),
4662-+ end_utime_of_query);
4663-+ }
4664- }
4665- }
4666- DBUG_VOID_RETURN;
4667-@@ -1905,6 +1920,7 @@
4668+ void log_slow_statement(THD *thd)
4669+ {
4670+ DBUG_ENTER("log_slow_statement");
4671+
4672+ ulonglong end_utime_of_query= thd->current_utime();
4673+ ulonglong query_exec_time= ::query_exec_time(thd, end_utime_of_query);
4674++ query_response_time_collect_with_check(query_exec_time);
4675+
4676+ /*
4677+ The following should never be true with our current code base,
4678+@@ -1971,6 +1991,7 @@
4679 case SCH_CHARSETS:
4680 case SCH_ENGINES:
4681 case SCH_COLLATIONS:
4682@@ -699,7 +3807,7 @@
4683 case SCH_COLLATION_CHARACTER_SET_APPLICABILITY:
4684 case SCH_USER_PRIVILEGES:
4685 case SCH_SCHEMA_PRIVILEGES:
4686-@@ -7265,6 +7281,12 @@
4687+@@ -7331,6 +7352,12 @@
4688 init_global_index_stats();
4689 pthread_mutex_unlock(&LOCK_global_index_stats);
4690 }
4691@@ -713,8 +3821,8 @@
4692 {
4693 pthread_mutex_lock(&LOCK_global_user_client_stats);
4694 diff -ruN a/sql/sql_show.cc b/sql/sql_show.cc
4695---- a/sql/sql_show.cc 2010-11-01 08:43:53.000000000 +0000
4696-+++ b/sql/sql_show.cc 2010-11-01 08:52:40.000000000 +0000
4697+--- a/sql/sql_show.cc 2011-07-11 04:31:52.197359319 +0300
4698++++ b/sql/sql_show.cc 2011-07-11 04:32:14.903520469 +0300
4699 @@ -31,6 +31,7 @@
4700 #include "event_data_objects.h"
4701 #endif
4702@@ -752,8 +3860,8 @@
4703 fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0},
4704 {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
4705 diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
4706---- a/sql/sql_yacc.yy 2010-11-01 08:43:53.000000000 +0000
4707-+++ b/sql/sql_yacc.yy 2010-11-01 08:52:40.000000000 +0000
4708+--- a/sql/sql_yacc.yy 2011-07-11 04:31:52.203359362 +0300
4709++++ b/sql/sql_yacc.yy 2011-07-11 04:32:14.907520495 +0300
4710 @@ -1079,6 +1079,7 @@
4711 %token PURGE
4712 %token QUARTER_SYM
4713@@ -800,8 +3908,8 @@
4714 | READ_ONLY_SYM {}
4715 | REBUILD_SYM {}
4716 diff -ruN a/sql/table.h b/sql/table.h
4717---- a/sql/table.h 2010-11-01 08:43:53.000000000 +0000
4718-+++ b/sql/table.h 2010-11-01 08:52:40.000000000 +0000
4719+--- a/sql/table.h 2011-07-11 04:31:52.207359390 +0300
4720++++ b/sql/table.h 2011-07-11 04:32:14.913520540 +0300
4721 @@ -964,6 +964,7 @@
4722 SCH_PROFILES,
4723 SCH_REFERENTIAL_CONSTRAINTS,
4724@@ -810,1304 +3918,3 @@
4725 SCH_SCHEMATA,
4726 SCH_SCHEMA_PRIVILEGES,
4727 SCH_SESSION_STATUS,
4728-diff -ruN a/configure.in b/configure.in
4729---- a/configure.in 2010-12-07 19:19:42.000000000 +0300
4730-+++ b/configure.in 2010-12-07 19:21:39.000000000 +0300
4731-@@ -1738,6 +1738,7 @@
4732- int main()
4733- {
4734- int foo= -10; int bar= 10;
4735-+ long long int foo64= -10; long long int bar64= 10;
4736- if (!__sync_fetch_and_add(&foo, bar) || foo)
4737- return -1;
4738- bar= __sync_lock_test_and_set(&foo, bar);
4739-@@ -1746,6 +1747,14 @@
4740- bar= __sync_val_compare_and_swap(&bar, foo, 15);
4741- if (bar)
4742- return -1;
4743-+ if (!__sync_fetch_and_add(&foo64, bar64) || foo64)
4744-+ return -1;
4745-+ bar64= __sync_lock_test_and_set(&foo64, bar64);
4746-+ if (bar64 || foo64 != 10)
4747-+ return -1;
4748-+ bar64= __sync_val_compare_and_swap(&bar64, foo, 15);
4749-+ if (bar64)
4750-+ return -1;
4751- return 0;
4752- }
4753- ], [mysql_cv_gcc_atomic_builtins=yes],
4754-@@ -1757,6 +1766,46 @@
4755- [Define to 1 if compiler provides atomic builtins.])
4756- fi
4757-
4758-+AC_CACHE_CHECK([whether the OS provides atomic_* functions like Solaris],
4759-+ [mysql_cv_solaris_atomic],
4760-+ [AC_RUN_IFELSE(
4761-+ [AC_LANG_PROGRAM(
4762-+ [[
4763-+ #include <atomic.h>
4764-+ ]],
4765-+ [[
4766-+ int foo = -10; int bar = 10;
4767-+ int64_t foo64 = -10; int64_t bar64 = 10;
4768-+ if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
4769-+ return -1;
4770-+ bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
4771-+ if (bar || foo != 10)
4772-+ return -1;
4773-+ bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
4774-+ if (bar)
4775-+ return -1;
4776-+ if (atomic_add_64_nv((volatile uint64_t *)&foo64, bar64) || foo64)
4777-+ return -1;
4778-+ bar64 = atomic_swap_64((volatile uint64_t *)&foo64, (uint64_t)bar64);
4779-+ if (bar64 || foo64 != 10)
4780-+ return -1;
4781-+ bar64 = atomic_cas_64((volatile uint64_t *)&bar64, (uint_t)foo64, 15);
4782-+ if (bar64)
4783-+ return -1;
4784-+ atomic_or_64((volatile uint64_t *)&bar64, 0);
4785-+ return 0;
4786-+ ]]
4787-+ )],
4788-+ [mysql_cv_solaris_atomic=yes],
4789-+ [mysql_cv_solaris_atomic=no],
4790-+ [mysql_cv_solaris_atomic=no]
4791-+)])
4792-+
4793-+if test "x$mysql_cv_solaris_atomic" = xyes; then
4794-+ AC_DEFINE(HAVE_SOLARIS_ATOMIC, 1,
4795-+ [Define to 1 if OS provides atomic_* functions like Solaris.])
4796-+fi
4797-+
4798- # Force static compilation to avoid linking problems/get more speed
4799- AC_ARG_WITH(mysqld-ldflags,
4800- [ --with-mysqld-ldflags Extra linking arguments for mysqld],
4801-@@ -2687,7 +2736,16 @@
4802- AC_SUBST(readline_link)
4803- AC_SUBST(readline_h_ln_cmd)
4804-
4805-+AC_ARG_WITH(response_time_distribution,
4806-+ AC_HELP_STRING([--without-response_time_distribution],[Disable response_time_distribution feature.]),
4807-+ [with_response_time_distribution=$withval],
4808-+ [with_response_time_distribution=yes]
4809-+)
4810-
4811-+if test "$with_response_time_distribution" = "yes"
4812-+then
4813-+ AC_DEFINE([HAVE_RESPONSE_TIME_DISTRIBUTION], [1], [If we want to have response_time_distribution])
4814-+fi
4815-
4816- # Include man pages, if desired, adapted to the configured parts.
4817- if test X"$with_man" = Xyes
4818-diff -ruN /dev/null b/include/my_atomic.h
4819---- /dev/null 1970-01-01 00:00:00.000000000 +0000
4820-+++ b/include/my_atomic.h 2011-06-07 08:59:00.000000000 +0300
4821-@@ -0,0 +1,287 @@
4822-+#ifndef MY_ATOMIC_INCLUDED
4823-+#define MY_ATOMIC_INCLUDED
4824-+
4825-+/* Copyright (C) 2006 MySQL AB
4826-+
4827-+ This program is free software; you can redistribute it and/or modify
4828-+ it under the terms of the GNU General Public License as published by
4829-+ the Free Software Foundation; version 2 of the License.
4830-+
4831-+ This program is distributed in the hope that it will be useful,
4832-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4833-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4834-+ GNU General Public License for more details.
4835-+
4836-+ You should have received a copy of the GNU General Public License
4837-+ along with this program; if not, write to the Free Software
4838-+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
4839-+
4840-+/*
4841-+ This header defines five atomic operations:
4842-+
4843-+ my_atomic_add#(&var, what)
4844-+ 'Fetch and Add'
4845-+ add 'what' to *var, and return the old value of *var
4846-+
4847-+ my_atomic_fas#(&var, what)
4848-+ 'Fetch And Store'
4849-+ store 'what' in *var, and return the old value of *var
4850-+
4851-+ my_atomic_cas#(&var, &old, new)
4852-+ An odd variation of 'Compare And Set/Swap'
4853-+ if *var is equal to *old, then store 'new' in *var, and return TRUE
4854-+ otherwise store *var in *old, and return FALSE
4855-+ Usually, &old should not be accessed if the operation is successful.
4856-+
4857-+ my_atomic_load#(&var)
4858-+ return *var
4859-+
4860-+ my_atomic_store#(&var, what)
4861-+ store 'what' in *var
4862-+
4863-+ '#' is substituted by a size suffix - 8, 16, 32, 64, or ptr
4864-+ (e.g. my_atomic_add8, my_atomic_fas32, my_atomic_casptr).
4865-+
4866-+ NOTE This operations are not always atomic, so they always must be
4867-+ enclosed in my_atomic_rwlock_rdlock(lock)/my_atomic_rwlock_rdunlock(lock)
4868-+ or my_atomic_rwlock_wrlock(lock)/my_atomic_rwlock_wrunlock(lock).
4869-+ Hint: if a code block makes intensive use of atomic ops, it make sense
4870-+ to take/release rwlock once for the whole block, not for every statement.
4871-+
4872-+ On architectures where these operations are really atomic, rwlocks will
4873-+ be optimized away.
4874-+ 8- and 16-bit atomics aren't implemented for windows (see generic-msvc.h),
4875-+ but can be added, if necessary.
4876-+*/
4877-+
4878-+#ifndef my_atomic_rwlock_init
4879-+
4880-+#define intptr void *
4881-+/**
4882-+ Currently we don't support 8-bit and 16-bit operations.
4883-+ It can be added later if needed.
4884-+*/
4885-+#undef MY_ATOMIC_HAS_8_16
4886-+
4887-+#ifndef MY_ATOMIC_MODE_RWLOCKS
4888-+/*
4889-+ * Attempt to do atomic ops without locks
4890-+ */
4891-+#include "atomic/nolock.h"
4892-+#endif
4893-+
4894-+#ifndef make_atomic_cas_body
4895-+/* nolock.h was not able to generate even a CAS function, fall back */
4896-+#include "atomic/rwlock.h"
4897-+#endif
4898-+
4899-+/* define missing functions by using the already generated ones */
4900-+#ifndef make_atomic_add_body
4901-+#define make_atomic_add_body(S) \
4902-+ int ## S tmp=*a; \
4903-+ while (!my_atomic_cas ## S(a, &tmp, tmp+v)) ; \
4904-+ v=tmp;
4905-+#endif
4906-+#ifndef make_atomic_fas_body
4907-+#define make_atomic_fas_body(S) \
4908-+ int ## S tmp=*a; \
4909-+ while (!my_atomic_cas ## S(a, &tmp, v)) ; \
4910-+ v=tmp;
4911-+#endif
4912-+#ifndef make_atomic_load_body
4913-+#define make_atomic_load_body(S) \
4914-+ ret= 0; /* avoid compiler warning */ \
4915-+ (void)(my_atomic_cas ## S(a, &ret, ret));
4916-+#endif
4917-+#ifndef make_atomic_store_body
4918-+#define make_atomic_store_body(S) \
4919-+ (void)(my_atomic_fas ## S (a, v));
4920-+#endif
4921-+
4922-+/*
4923-+ transparent_union doesn't work in g++
4924-+ Bug ?
4925-+
4926-+ Darwin's gcc doesn't want to put pointers in a transparent_union
4927-+ when built with -arch ppc64. Complains:
4928-+ warning: 'transparent_union' attribute ignored
4929-+*/
4930-+#if defined(__GNUC__) && !defined(__cplusplus) && \
4931-+ ! (defined(__APPLE__) && (defined(_ARCH_PPC64) ||defined (_ARCH_PPC)))
4932-+/*
4933-+ we want to be able to use my_atomic_xxx functions with
4934-+ both signed and unsigned integers. But gcc will issue a warning
4935-+ "passing arg N of `my_atomic_XXX' as [un]signed due to prototype"
4936-+ if the signedness of the argument doesn't match the prototype, or
4937-+ "pointer targets in passing argument N of my_atomic_XXX differ in signedness"
4938-+ if int* is used where uint* is expected (or vice versa).
4939-+ Let's shut these warnings up
4940-+*/
4941-+#define make_transparent_unions(S) \
4942-+ typedef union { \
4943-+ int ## S i; \
4944-+ uint ## S u; \
4945-+ } U_ ## S __attribute__ ((transparent_union)); \
4946-+ typedef union { \
4947-+ int ## S volatile *i; \
4948-+ uint ## S volatile *u; \
4949-+ } Uv_ ## S __attribute__ ((transparent_union));
4950-+#define uintptr intptr
4951-+make_transparent_unions(8)
4952-+make_transparent_unions(16)
4953-+make_transparent_unions(32)
4954-+make_transparent_unions(64)
4955-+make_transparent_unions(ptr)
4956-+#undef uintptr
4957-+#undef make_transparent_unions
4958-+#define a U_a.i
4959-+#define cmp U_cmp.i
4960-+#define v U_v.i
4961-+#define set U_set.i
4962-+#else
4963-+#define U_8 int8
4964-+#define U_16 int16
4965-+#define U_32 int32
4966-+#define U_64 int64
4967-+#define U_ptr intptr
4968-+#define Uv_8 int8
4969-+#define Uv_16 int16
4970-+#define Uv_32 int32
4971-+#define Uv_64 int64
4972-+#define Uv_ptr intptr
4973-+#define U_a volatile *a
4974-+#define U_cmp *cmp
4975-+#define U_v v
4976-+#define U_set set
4977-+#endif /* __GCC__ transparent_union magic */
4978-+
4979-+#define make_atomic_cas(S) \
4980-+static inline int my_atomic_cas ## S(Uv_ ## S U_a, \
4981-+ Uv_ ## S U_cmp, U_ ## S U_set) \
4982-+{ \
4983-+ int8 ret; \
4984-+ make_atomic_cas_body(S); \
4985-+ return ret; \
4986-+}
4987-+
4988-+#define make_atomic_add(S) \
4989-+static inline int ## S my_atomic_add ## S( \
4990-+ Uv_ ## S U_a, U_ ## S U_v) \
4991-+{ \
4992-+ make_atomic_add_body(S); \
4993-+ return v; \
4994-+}
4995-+
4996-+#define make_atomic_fas(S) \
4997-+static inline int ## S my_atomic_fas ## S( \
4998-+ Uv_ ## S U_a, U_ ## S U_v) \
4999-+{ \
5000-+ make_atomic_fas_body(S); \
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches