]> git.pld-linux.org Git - packages/mysql.git/blobdiff - response_time_distribution.patch
fox for bug #62472 (mysqlhotcopy errors on databases containing MyISAM)
[packages/mysql.git] / response_time_distribution.patch
index c1b646e950ae3f3a0e59733d3bcb5157eafef8c5..603c8e802695d3967c7067fdcc563954ee4c464a 100644 (file)
 +enable_query_log;
 --- /dev/null
 +++ b/mysql-test/include/query_response_time.inc
-@@ -0,0 +1,39 @@
+@@ -0,0 +1,43 @@
 +SET SESSION query_exec_time=0.1;
 +
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
 +EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base;
 +FLUSH QUERY_RESPONSE_TIME;
++# Following two queries check works of FLUSH and 
++# respecting of "QUERY_RESPONSE_TIME_STATS" variable (see launchpad bug #855312)
++SHOW QUERY_RESPONSE_TIME;
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
 +
 +SET SESSION query_exec_time=0.31; SELECT 1;
 +query_response_time_range_base        2
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        3             0.300000
++      0.125000        1             0.100000
 +      0.250000        0             0.000000
 +      0.500000        30           10.650000
 +      1.000000        3             1.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        4             0.400000
++      0.125000        1             0.100000
 +      0.250000        0             0.000000
 +      0.500000        30           10.650000
 +      1.000000        3             1.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
 +query_response_time_range_base        2
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        3             0.300000
++      0.125000        1             0.100000
 +      0.250000        0             0.000000
 +      0.500000        30           10.650000
 +      1.000000        3             1.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        4             0.400000
++      0.125000        1             0.100000
 +      0.250000        0             0.000000
 +      0.500000        30           10.650000
 +      1.000000        3             1.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
 +query_response_time_range_base        10
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.000010        0             0.000000
 +      0.000100        0             0.000000
 +      0.001000        0             0.000000
 +      0.010000        0             0.000000
 +      0.100000        0             0.000000
-+      1.000000        36           12.450000
++      1.000000        34           12.250000
 +     10.000000        33           77.099997
 +    100.000000        0             0.000000
 +   1000.000000        0             0.000000
 +  10000.000000        0             0.000000
 + 100000.000000        0             0.000000
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.000010        0             0.000000
 +      0.000100        0             0.000000
 +      0.001000        0             0.000000
 +      0.010000        0             0.000000
 +      0.100000        0             0.000000
-+      1.000000        37           12.550000
++      1.000000        34           12.250000
 +     10.000000        33           77.099997
 +    100.000000        0             0.000000
 +   1000.000000        0             0.000000
 +  10000.000000        0             0.000000
 + 100000.000000        0             0.000000
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
 +query_response_time_range_base        7
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.000008        0             0.000000
 +      0.000059        0             0.000000
 +      0.000416        0             0.000000
 +      0.002915        0             0.000000
 +      0.020408        0             0.000000
-+      0.142857        3             0.300000
++      0.142857        1             0.100000
 +      1.000000        33           12.150000
 +      7.000000        33           77.099997
 +     49.000000        0             0.000000
 +  16807.000000        0             0.000000
 + 117649.000000        0             0.000000
 + 823543.000000        0             0.000000
-+ 5764801.00000        0             0.000000
++5764801.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.000008        0             0.000000
 +      0.000059        0             0.000000
 +      0.000416        0             0.000000
 +      0.002915        0             0.000000
 +      0.020408        0             0.000000
-+      0.142857        4             0.400000
++      0.142857        1             0.100000
 +      1.000000        33           12.150000
 +      7.000000        33           77.099997
 +     49.000000        0             0.000000
 +  16807.000000        0             0.000000
 + 117649.000000        0             0.000000
 + 823543.000000        0             0.000000
-+ 5764801.00000        0             0.000000
++5764801.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
 +query_response_time_range_base        156
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000041        2             0.000000
++      0.000041        1             0.000000
 +      0.006410        0             0.000000
-+      1.000000        36           12.450000
++      1.000000        34           12.250000
 +    156.000000        33           77.099997
 +  24336.000000        0             0.000000
-+ 3796416.00000        0             0.000000
++3796416.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000041        2             0.000000
++      0.000041        1             0.000000
 +      0.006410        0             0.000000
-+      1.000000        37           12.550000
++      1.000000        34           12.250000
 +    156.000000        33           77.099997
 +  24336.000000        0             0.000000
-+ 3796416.00000        0             0.000000
++3796416.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
 +query_response_time_range_base        1000
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.001000        0             0.000000
-+      1.000000        36           12.450000
++      1.000000        34           12.250000
 +   1000.000000        33           77.099997
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.001000        0             0.000000
-+      1.000000        37           12.550000
++      1.000000        34           12.250000
 +   1000.000000        33           77.099997
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
 +query_response_time_range_base        1000
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.001000        0             0.000000
-+      1.000000        36           12.450000
++      1.000000        34           12.250000
 +   1000.000000        33           77.099997
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        2             0.000000
++      0.000001        1             0.000000
 +      0.001000        0             0.000000
-+      1.000000        37           12.550000
++      1.000000        34           12.250000
 +   1000.000000        33           77.099997
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
 +SET GLOBAL query_exec_time=default;
 --- /dev/null
 +++ b/mysql-test/r/percona_query_response_time.result
-@@ -0,0 +1,1003 @@
+@@ -0,0 +1,1307 @@
 +SET SESSION query_exec_time=0.1;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
 +Warnings:
 +Warning       1292    Truncated incorrect query_response_time_range_base value: '1'
 +FLUSH QUERY_RESPONSE_TIME;
++SHOW QUERY_RESPONSE_TIME;
++              
++      0.000001        0             0.000000
++      0.000003        0             0.000000
++      0.000007        0             0.000000
++      0.000015        0             0.000000
++      0.000030        0             0.000000
++      0.000061        0             0.000000
++      0.000122        0             0.000000
++      0.000244        0             0.000000
++      0.000488        0             0.000000
++      0.000976        0             0.000000
++      0.001953        0             0.000000
++      0.003906        0             0.000000
++      0.007812        0             0.000000
++      0.015625        0             0.000000
++      0.031250        0             0.000000
++      0.062500        0             0.000000
++      0.125000        0             0.000000
++      0.250000        0             0.000000
++      0.500000        0             0.000000
++      1.000000        0             0.000000
++      2.000000        0             0.000000
++      4.000000        0             0.000000
++      8.000000        0             0.000000
++     16.000000        0             0.000000
++     32.000000        0             0.000000
++     64.000000        0             0.000000
++    128.000000        0             0.000000
++    256.000000        0             0.000000
++    512.000000        0             0.000000
++   1024.000000        0             0.000000
++   2048.000000        0             0.000000
++   4096.000000        0             0.000000
++   8192.000000        0             0.000000
++  16384.000000        0             0.000000
++  32768.000000        0             0.000000
++  65536.000000        0             0.000000
++ 131072.000000        0             0.000000
++ 262144.000000        0             0.000000
++ 524288.000000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
++TOO LONG      0       TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time  count   total
++      0.000001        0             0.000000
++      0.000003        0             0.000000
++      0.000007        0             0.000000
++      0.000015        0             0.000000
++      0.000030        0             0.000000
++      0.000061        0             0.000000
++      0.000122        0             0.000000
++      0.000244        0             0.000000
++      0.000488        0             0.000000
++      0.000976        0             0.000000
++      0.001953        0             0.000000
++      0.003906        0             0.000000
++      0.007812        0             0.000000
++      0.015625        0             0.000000
++      0.031250        0             0.000000
++      0.062500        0             0.000000
++      0.125000        0             0.000000
++      0.250000        0             0.000000
++      0.500000        0             0.000000
++      1.000000        0             0.000000
++      2.000000        0             0.000000
++      4.000000        0             0.000000
++      8.000000        0             0.000000
++     16.000000        0             0.000000
++     32.000000        0             0.000000
++     64.000000        0             0.000000
++    128.000000        0             0.000000
++    256.000000        0             0.000000
++    512.000000        0             0.000000
++   1024.000000        0             0.000000
++   2048.000000        0             0.000000
++   4096.000000        0             0.000000
++   8192.000000        0             0.000000
++  16384.000000        0             0.000000
++  32768.000000        0             0.000000
++  65536.000000        0             0.000000
++ 131072.000000        0             0.000000
++ 262144.000000        0             0.000000
++ 524288.000000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
++TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
 +SET SESSION query_exec_time=0.31;
 +SELECT 1;
 +query_response_time_range_base        2
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        2             0.200000
++      0.125000        0             0.000000
 +      0.250000        0             0.000000
 +      0.500000        10            3.550000
 +      1.000000        1             0.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        3             0.300000
++      0.125000        0             0.000000
 +      0.250000        0             0.000000
 +      0.500000        10            3.550000
 +      1.000000        1             0.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
 +FLUSH QUERY_RESPONSE_TIME;
++SHOW QUERY_RESPONSE_TIME;
++              
++      0.000001        0             0.000000
++      0.000003        0             0.000000
++      0.000007        0             0.000000
++      0.000015        0             0.000000
++      0.000030        0             0.000000
++      0.000061        0             0.000000
++      0.000122        0             0.000000
++      0.000244        0             0.000000
++      0.000488        0             0.000000
++      0.000976        0             0.000000
++      0.001953        0             0.000000
++      0.003906        0             0.000000
++      0.007812        0             0.000000
++      0.015625        0             0.000000
++      0.031250        0             0.000000
++      0.062500        0             0.000000
++      0.125000        0             0.000000
++      0.250000        0             0.000000
++      0.500000        0             0.000000
++      1.000000        0             0.000000
++      2.000000        0             0.000000
++      4.000000        0             0.000000
++      8.000000        0             0.000000
++     16.000000        0             0.000000
++     32.000000        0             0.000000
++     64.000000        0             0.000000
++    128.000000        0             0.000000
++    256.000000        0             0.000000
++    512.000000        0             0.000000
++   1024.000000        0             0.000000
++   2048.000000        0             0.000000
++   4096.000000        0             0.000000
++   8192.000000        0             0.000000
++  16384.000000        0             0.000000
++  32768.000000        0             0.000000
++  65536.000000        0             0.000000
++ 131072.000000        0             0.000000
++ 262144.000000        0             0.000000
++ 524288.000000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
++TOO LONG      0       TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time  count   total
++      0.000001        0             0.000000
++      0.000003        0             0.000000
++      0.000007        0             0.000000
++      0.000015        0             0.000000
++      0.000030        0             0.000000
++      0.000061        0             0.000000
++      0.000122        0             0.000000
++      0.000244        0             0.000000
++      0.000488        0             0.000000
++      0.000976        0             0.000000
++      0.001953        0             0.000000
++      0.003906        0             0.000000
++      0.007812        0             0.000000
++      0.015625        0             0.000000
++      0.031250        0             0.000000
++      0.062500        0             0.000000
++      0.125000        0             0.000000
++      0.250000        0             0.000000
++      0.500000        0             0.000000
++      1.000000        0             0.000000
++      2.000000        0             0.000000
++      4.000000        0             0.000000
++      8.000000        0             0.000000
++     16.000000        0             0.000000
++     32.000000        0             0.000000
++     64.000000        0             0.000000
++    128.000000        0             0.000000
++    256.000000        0             0.000000
++    512.000000        0             0.000000
++   1024.000000        0             0.000000
++   2048.000000        0             0.000000
++   4096.000000        0             0.000000
++   8192.000000        0             0.000000
++  16384.000000        0             0.000000
++  32768.000000        0             0.000000
++  65536.000000        0             0.000000
++ 131072.000000        0             0.000000
++ 262144.000000        0             0.000000
++ 524288.000000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
++TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
 +SET SESSION query_exec_time=0.31;
 +SELECT 1;
 +query_response_time_range_base        2
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        2             0.200000
++      0.125000        0             0.000000
 +      0.250000        0             0.000000
 +      0.500000        10            3.550000
 +      1.000000        1             0.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        3             0.300000
++      0.125000        0             0.000000
 +      0.250000        0             0.000000
 +      0.500000        10            3.550000
 +      1.000000        1             0.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
 +FLUSH QUERY_RESPONSE_TIME;
++SHOW QUERY_RESPONSE_TIME;
++              
++      0.000001        0             0.000000
++      0.000010        0             0.000000
++      0.000100        0             0.000000
++      0.001000        0             0.000000
++      0.010000        0             0.000000
++      0.100000        0             0.000000
++      1.000000        0             0.000000
++     10.000000        0             0.000000
++    100.000000        0             0.000000
++   1000.000000        0             0.000000
++  10000.000000        0             0.000000
++ 100000.000000        0             0.000000
++1000000.000000        0             0.000000
++TOO LONG      0       TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time  count   total
++      0.000001        0             0.000000
++      0.000010        0             0.000000
++      0.000100        0             0.000000
++      0.001000        0             0.000000
++      0.010000        0             0.000000
++      0.100000        0             0.000000
++      1.000000        0             0.000000
++     10.000000        0             0.000000
++    100.000000        0             0.000000
++   1000.000000        0             0.000000
++  10000.000000        0             0.000000
++ 100000.000000        0             0.000000
++1000000.000000        0             0.000000
++TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
 +SET SESSION query_exec_time=0.31;
 +SELECT 1;
 +query_response_time_range_base        10
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.000010        0             0.000000
 +      0.000100        0             0.000000
 +      0.001000        0             0.000000
 +      0.010000        0             0.000000
 +      0.100000        0             0.000000
-+      1.000000        13            4.250000
++      1.000000        11            4.050000
 +     10.000000        11           25.699999
 +    100.000000        0             0.000000
 +   1000.000000        0             0.000000
 +  10000.000000        0             0.000000
 + 100000.000000        0             0.000000
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.000010        0             0.000000
 +      0.000100        0             0.000000
 +      0.001000        0             0.000000
 +      0.010000        0             0.000000
 +      0.100000        0             0.000000
-+      1.000000        14            4.350000
++      1.000000        11            4.050000
 +     10.000000        11           25.699999
 +    100.000000        0             0.000000
 +   1000.000000        0             0.000000
 +  10000.000000        0             0.000000
 + 100000.000000        0             0.000000
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
 +FLUSH QUERY_RESPONSE_TIME;
++SHOW QUERY_RESPONSE_TIME;
++              
++      0.000001        0             0.000000
++      0.000008        0             0.000000
++      0.000059        0             0.000000
++      0.000416        0             0.000000
++      0.002915        0             0.000000
++      0.020408        0             0.000000
++      0.142857        0             0.000000
++      1.000000        0             0.000000
++      7.000000        0             0.000000
++     49.000000        0             0.000000
++    343.000000        0             0.000000
++   2401.000000        0             0.000000
++  16807.000000        0             0.000000
++ 117649.000000        0             0.000000
++ 823543.000000        0             0.000000
++5764801.000000        0             0.000000
++TOO LONG      0       TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time  count   total
++      0.000001        0             0.000000
++      0.000008        0             0.000000
++      0.000059        0             0.000000
++      0.000416        0             0.000000
++      0.002915        0             0.000000
++      0.020408        0             0.000000
++      0.142857        0             0.000000
++      1.000000        0             0.000000
++      7.000000        0             0.000000
++     49.000000        0             0.000000
++    343.000000        0             0.000000
++   2401.000000        0             0.000000
++  16807.000000        0             0.000000
++ 117649.000000        0             0.000000
++ 823543.000000        0             0.000000
++5764801.000000        0             0.000000
++TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
 +SET SESSION query_exec_time=0.31;
 +SELECT 1;
 +query_response_time_range_base        7
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.000008        0             0.000000
 +      0.000059        0             0.000000
 +      0.000416        0             0.000000
 +      0.002915        0             0.000000
 +      0.020408        0             0.000000
-+      0.142857        2             0.200000
++      0.142857        0             0.000000
 +      1.000000        11            4.050000
 +      7.000000        11           25.699999
 +     49.000000        0             0.000000
 +  16807.000000        0             0.000000
 + 117649.000000        0             0.000000
 + 823543.000000        0             0.000000
-+ 5764801.00000        0             0.000000
++5764801.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.000008        0             0.000000
 +      0.000059        0             0.000000
 +      0.000416        0             0.000000
 +      0.002915        0             0.000000
 +      0.020408        0             0.000000
-+      0.142857        3             0.300000
++      0.142857        0             0.000000
 +      1.000000        11            4.050000
 +      7.000000        11           25.699999
 +     49.000000        0             0.000000
 +  16807.000000        0             0.000000
 + 117649.000000        0             0.000000
 + 823543.000000        0             0.000000
-+ 5764801.00000        0             0.000000
++5764801.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
 +FLUSH QUERY_RESPONSE_TIME;
++SHOW QUERY_RESPONSE_TIME;
++              
++      0.000041        0             0.000000
++      0.006410        0             0.000000
++      1.000000        0             0.000000
++    156.000000        0             0.000000
++  24336.000000        0             0.000000
++3796416.000000        0             0.000000
++TOO LONG      0       TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time  count   total
++      0.000041        0             0.000000
++      0.006410        0             0.000000
++      1.000000        0             0.000000
++    156.000000        0             0.000000
++  24336.000000        0             0.000000
++3796416.000000        0             0.000000
++TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
 +SET SESSION query_exec_time=0.31;
 +SELECT 1;
 +query_response_time_range_base        156
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000041        25            0.000000
++      0.000041        24            0.000000
 +      0.006410        0             0.000000
-+      1.000000        13            4.250000
++      1.000000        11            4.050000
 +    156.000000        11           25.699999
 +  24336.000000        0             0.000000
-+ 3796416.00000        0             0.000000
++3796416.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000041        25            0.000000
++      0.000041        24            0.000000
 +      0.006410        0             0.000000
-+      1.000000        14            4.350000
++      1.000000        11            4.050000
 +    156.000000        11           25.699999
 +  24336.000000        0             0.000000
-+ 3796416.00000        0             0.000000
++3796416.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
 +FLUSH QUERY_RESPONSE_TIME;
++SHOW QUERY_RESPONSE_TIME;
++              
++      0.000001        0             0.000000
++      0.001000        0             0.000000
++      1.000000        0             0.000000
++   1000.000000        0             0.000000
++1000000.000000        0             0.000000
++TOO LONG      0       TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time  count   total
++      0.000001        0             0.000000
++      0.001000        0             0.000000
++      1.000000        0             0.000000
++   1000.000000        0             0.000000
++1000000.000000        0             0.000000
++TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
 +SET SESSION query_exec_time=0.31;
 +SELECT 1;
 +query_response_time_range_base        1000
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.001000        0             0.000000
-+      1.000000        13            4.250000
++      1.000000        11            4.050000
 +   1000.000000        11           25.699999
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.001000        0             0.000000
-+      1.000000        14            4.350000
++      1.000000        11            4.050000
 +   1000.000000        11           25.699999
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +Warnings:
 +Warning       1292    Truncated incorrect query_response_time_range_base value: '1001'
 +FLUSH QUERY_RESPONSE_TIME;
++SHOW QUERY_RESPONSE_TIME;
++              
++      0.000001        0             0.000000
++      0.001000        0             0.000000
++      1.000000        0             0.000000
++   1000.000000        0             0.000000
++1000000.000000        0             0.000000
++TOO LONG      0       TOO LONG
++SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
++time  count   total
++      0.000001        0             0.000000
++      0.001000        0             0.000000
++      1.000000        0             0.000000
++   1000.000000        0             0.000000
++1000000.000000        0             0.000000
++TOO LONG      0       TOO LONG
 +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
 +SET SESSION query_exec_time=0.31;
 +SELECT 1;
 +query_response_time_range_base        1000
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.001000        0             0.000000
-+      1.000000        13            4.250000
++      1.000000        11            4.050000
 +   1000.000000        11           25.699999
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        25            0.000000
++      0.000001        24            0.000000
 +      0.001000        0             0.000000
-+      1.000000        14            4.350000
++      1.000000        11            4.050000
 +   1000.000000        11           25.699999
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
 +query_response_time_range_base        2
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        46            4.600000
++      0.125000        44            4.400000
 +      0.250000        0             0.000000
 +      0.500000        10            3.550000
 +      1.000000        1             0.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        47            4.700000
++      0.125000        44            4.400000
 +      0.250000        0             0.000000
 +      0.500000        10            3.550000
 +      1.000000        1             0.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +query_response_time_range_base        2
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        46            4.600000
++      0.125000        44            4.400000
 +      0.250000        0             0.000000
 +      0.500000        10            3.550000
 +      1.000000        1             0.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.000003        0             0.000000
 +      0.000007        0             0.000000
 +      0.000015        0             0.000000
 +      0.015625        0             0.000000
 +      0.031250        0             0.000000
 +      0.062500        0             0.000000
-+      0.125000        47            4.700000
++      0.125000        44            4.400000
 +      0.250000        0             0.000000
 +      0.500000        10            3.550000
 +      1.000000        1             0.500000
 + 131072.000000        0             0.000000
 + 262144.000000        0             0.000000
 + 524288.000000        0             0.000000
-+ 1048576.00000        0             0.000000
-+ 2097152.00000        0             0.000000
-+ 4194304.00000        0             0.000000
-+ 8388608.00000        0             0.000000
++1048576.000000        0             0.000000
++2097152.000000        0             0.000000
++4194304.000000        0             0.000000
++8388608.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +query_response_time_range_base        10
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.000010        0             0.000000
 +      0.000100        0             0.000000
 +      0.001000        0             0.000000
 +      0.010000        0             0.000000
 +      0.100000        0             0.000000
-+      1.000000        57            8.650000
++      1.000000        55            8.450000
 +     10.000000        11           25.699999
 +    100.000000        0             0.000000
 +   1000.000000        0             0.000000
 +  10000.000000        0             0.000000
 + 100000.000000        0             0.000000
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.000010        0             0.000000
 +      0.000100        0             0.000000
 +      0.001000        0             0.000000
 +      0.010000        0             0.000000
 +      0.100000        0             0.000000
-+      1.000000        58            8.750000
++      1.000000        55            8.450000
 +     10.000000        11           25.699999
 +    100.000000        0             0.000000
 +   1000.000000        0             0.000000
 +  10000.000000        0             0.000000
 + 100000.000000        0             0.000000
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +query_response_time_range_base        7
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.000008        0             0.000000
 +      0.000059        0             0.000000
 +      0.000416        0             0.000000
 +      0.002915        0             0.000000
 +      0.020408        0             0.000000
-+      0.142857        46            4.600000
++      0.142857        44            4.400000
 +      1.000000        11            4.050000
 +      7.000000        11           25.699999
 +     49.000000        0             0.000000
 +  16807.000000        0             0.000000
 + 117649.000000        0             0.000000
 + 823543.000000        0             0.000000
-+ 5764801.00000        0             0.000000
++5764801.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.000008        0             0.000000
 +      0.000059        0             0.000000
 +      0.000416        0             0.000000
 +      0.002915        0             0.000000
 +      0.020408        0             0.000000
-+      0.142857        47            4.700000
++      0.142857        44            4.400000
 +      1.000000        11            4.050000
 +      7.000000        11           25.699999
 +     49.000000        0             0.000000
 +  16807.000000        0             0.000000
 + 117649.000000        0             0.000000
 + 823543.000000        0             0.000000
-+ 5764801.00000        0             0.000000
++5764801.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +query_response_time_range_base        156
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000041        46            0.000000
++      0.000041        45            0.000000
 +      0.006410        0             0.000000
-+      1.000000        57            8.650000
++      1.000000        55            8.450000
 +    156.000000        11           25.699999
 +  24336.000000        0             0.000000
-+ 3796416.00000        0             0.000000
++3796416.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000041        46            0.000000
++      0.000041        45            0.000000
 +      0.006410        0             0.000000
-+      1.000000        58            8.750000
++      1.000000        55            8.450000
 +    156.000000        11           25.699999
 +  24336.000000        0             0.000000
-+ 3796416.00000        0             0.000000
++3796416.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +query_response_time_range_base        1000
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.001000        0             0.000000
-+      1.000000        57            8.650000
++      1.000000        55            8.450000
 +   1000.000000        11           25.699999
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.001000        0             0.000000
-+      1.000000        58            8.750000
++      1.000000        55            8.450000
 +   1000.000000        11           25.699999
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET SESSION query_exec_time=0.1;
 +query_response_time_range_base        1000
 +SHOW QUERY_RESPONSE_TIME;
 +              
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.001000        0             0.000000
-+      1.000000        57            8.650000
++      1.000000        55            8.450000
 +   1000.000000        11           25.699999
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
 +time  count   total
-+      0.000001        46            0.000000
++      0.000001        45            0.000000
 +      0.001000        0             0.000000
-+      1.000000        58            8.750000
++      1.000000        55            8.450000
 +   1000.000000        11           25.699999
-+ 1000000.00000        0             0.000000
++1000000.000000        0             0.000000
 +TOO LONG      0       TOO LONG
 +SET SESSION query_exec_time=default;
 +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
 +2010-09-15 add column 'total'
 --- a/sql/CMakeLists.txt
 +++ b/sql/CMakeLists.txt
-@@ -51,7 +51,7 @@
+@@ -52,7 +52,7 @@
                 message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c
                 mysqld.cc net_serv.cc  keycaches.cc
                 ../sql-common/client_plugin.c
                 ../sql-common/pack.c parse_file.cc password.c procedure.cc 
                 protocol.cc records.cc repl_failsafe.cc rpl_filter.cc set_var.cc 
                 slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc 
-@@ -59,7 +59,7 @@
+@@ -60,7 +60,7 @@
                 sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h 
                 sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc 
                 sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc 
  #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
  #include "../storage/perfschema/pfs_server.h"
  #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
-@@ -611,7 +613,7 @@
+@@ -615,7 +617,7 @@
  MY_LOCALE *my_default_lc_messages;
  MY_LOCALE *my_default_lc_time_names;
  
  SHOW_COMP_OPTION have_geometry, have_rtree_keys;
  SHOW_COMP_OPTION have_crypt, have_compress;
  SHOW_COMP_OPTION have_profiling;
-@@ -912,6 +914,10 @@
+@@ -917,6 +919,10 @@
  my_bool opt_enable_shared_memory;
  HANDLE smem_event_connect_request= 0;
  #endif
  
  my_bool opt_use_ssl  = 0;
  char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL,
-@@ -1483,6 +1489,9 @@
+@@ -1488,6 +1494,9 @@
    my_free(opt_bin_logname);
    bitmap_free(&temp_pool);
    free_max_user_conn();
  #ifdef HAVE_REPLICATION
    end_slave_list();
  #endif
-@@ -4010,6 +4019,9 @@
+@@ -3860,6 +3869,9 @@
    if (!DEFAULT_ERRMSGS[0][0])
      unireg_abort(1);  
  
    /* We have to initialize the storage engines before CSV logging */
    if (ha_init())
    {
-@@ -6909,6 +6921,11 @@
+@@ -6773,6 +6785,11 @@
  #else
    have_query_cache=SHOW_OPTION_NO;
  #endif
  extern bool in_bootstrap;
 --- /dev/null
 +++ b/sql/query_response_time.cc
-@@ -0,0 +1,310 @@
+@@ -0,0 +1,302 @@
 +#include "mysql_version.h"
 +#include "my_global.h"
 +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
 +#define MAXIMUM_BASE QRT_MAXIMUM_BASE
 +#define POSITIVE_POWER_FILLER QRT_POSITIVE_POWER_FILLER
 +#define NEGATIVE_POWER_FILLER QRT_NEGATIVE_POWER_FILLER
-+#define STRING_OVERFLOW QRT_STRING_OVERFLOW
 +#define TIME_OVERFLOW   QRT_TIME_OVERFLOW
 +#define DEFAULT_BASE    QRT_DEFAULT_BASE
 +
 +  ulonglong m_bound[OVERALL_POWER_COUNT];
 +};
 +
-+void print_time(char* buffer, std::size_t buffer_size, std::size_t string_positive_power_length, const char* format, uint64 value)
++static
++void print_time(char* buffer, std::size_t buffer_size, const char* format,
++                uint64 value)
 +{
-+  memset(buffer,'X',buffer_size);
-+  buffer[string_positive_power_length]= '.';
 +  ulonglong second=      (value / MILLION);
 +  ulonglong microsecond= (value % MILLION);
-+  std::size_t result_length= snprintf(buffer,buffer_size,format,second,microsecond);
-+  if(result_length < 0)
-+  {
-+    assert(sizeof(STRING_OVERFLOW) <= buffer_size);
-+    memcpy(buffer, STRING_OVERFLOW, sizeof(STRING_OVERFLOW));
-+    return;
-+  }
-+  buffer[result_length]= 0;
++  my_snprintf(buffer, buffer_size, format, second, microsecond);
 +}
 +
 +class time_collector
 +  uint32 count(uint index) const
 +  {
 +    my_atomic_rwlock_rdlock(&time_collector_lock);
-+    uint32 result= my_atomic_load32((volatile int32*)&m_count[index]);
++    uint32 result= my_atomic_load32((int32*)&m_count[index]);
 +    my_atomic_rwlock_rdunlock(&time_collector_lock);
 +    return result;
 +  }
 +  uint64 total(uint index) const
 +  {
 +    my_atomic_rwlock_rdlock(&time_collector_lock);
-+    uint64 result= my_atomic_load64((volatile int64*)&m_total[index]);
++    uint64 result= my_atomic_load64((int64*)&m_total[index]);
 +    my_atomic_rwlock_rdunlock(&time_collector_lock);
 +    return result;
 +  }
 +      if(m_utility->bound(i) > time)
 +      {
 +        my_atomic_rwlock_wrlock(&time_collector_lock);
-+        my_atomic_add32((volatile int32*)(&m_count[i]), 1);
-+        my_atomic_add64((volatile int64*)(&m_total[i]), time);
++        my_atomic_add32((int32*)(&m_count[i]), 1);
++        my_atomic_add64((int64*)(&m_total[i]), time);
 +        my_atomic_rwlock_wrunlock(&time_collector_lock);
 +        break;
 +      }
 +  used on architectures that do not have atomic implementation of atomic
 +  operations. */
 +  my_atomic_rwlock_t time_collector_lock;
-+  volatile uint32   m_count[OVERALL_POWER_COUNT + 1];
-+  volatile uint64   m_total[OVERALL_POWER_COUNT + 1];
++  uint32   m_count[OVERALL_POWER_COUNT + 1];
++  uint64   m_total[OVERALL_POWER_COUNT + 1];
 +};
 +
 +class collector
 +      }
 +      else
 +      {
-+        print_time(time,sizeof(time),TIME_STRING_POSITIVE_POWER_LENGTH,TIME_STRING_FORMAT,this->bound(i));
-+        print_time(total,sizeof(total),TOTAL_STRING_POSITIVE_POWER_LENGTH,TOTAL_STRING_FORMAT,this->total(i));
++        print_time(time, sizeof(time), TIME_STRING_FORMAT, this->bound(i));
++        print_time(total, sizeof(total), TOTAL_STRING_FORMAT, this->total(i));
 +      }
 +      fields[0]->store(time,strlen(time),system_charset_info);
 +      fields[1]->store(this->count(i));
 +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
 --- /dev/null
 +++ b/sql/query_response_time.h
-@@ -0,0 +1,71 @@
+@@ -0,0 +1,64 @@
 +#ifndef QUERY_RESPONSE_TIME_H
 +#define QUERY_RESPONSE_TIME_H
 +
 +  and number 7234 result is:
 +  '   7234'
 +*/
-+#define QRT_POSITIVE_POWER_FILLER " "
++#define QRT_POSITIVE_POWER_FILLER ""
 +/*
 +  Filler for fractional number. Similiary to whole number
 +*/
 +#define QRT_NEGATIVE_POWER_FILLER "0"
 +
 +/*
-+  Message if string overflow (string overflow - internal error, this string say about bug in QRT)
-+*/
-+#define QRT_STRING_OVERFLOW "TOO BIG STRING"
-+
-+/*
 +  Message if time too big for statistic collecting (very long query)
 +*/
 +#define QRT_TIME_OVERFLOW "TOO LONG"
 +
 +#define QRT_TIME_STRING_LENGTH                                \
 +  max( (QRT_TIME_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TIME_STRING_NEGATIVE_POWER_LENGTH*/), \
-+       max( (sizeof(QRT_TIME_OVERFLOW) - 1),          \
-+          (sizeof(QRT_STRING_OVERFLOW) - 1) ) )
++       (sizeof(QRT_TIME_OVERFLOW) - 1) )
 +
 +#define QRT_TOTAL_STRING_LENGTH                               \
 +  max( (QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TOTAL_STRING_NEGATIVE_POWER_LENGTH*/), \
-+       max( (sizeof(QRT_TIME_OVERFLOW) - 1),          \
-+          (sizeof(QRT_STRING_OVERFLOW) - 1) ) )
++       (sizeof(QRT_TIME_OVERFLOW) - 1) )
 +
 +extern ST_SCHEMA_TABLE query_response_time_table;
 +
 +#endif // QUERY_RESPONSE_TIME_H
 --- a/sql/set_var.h
 +++ b/sql/set_var.h
-@@ -293,6 +293,7 @@
+@@ -294,6 +294,7 @@
  
  extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen;
  extern SHOW_COMP_OPTION have_query_cache;
  #include "transaction.h"
  #include "sql_audit.h"
  #include "sql_prepare.h"
-@@ -1507,6 +1508,7 @@
+@@ -1518,6 +1519,12 @@
  
    ulonglong end_utime_of_query= thd->current_utime();
    ulonglong query_exec_time= get_query_exec_time(thd, end_utime_of_query);
-+  query_response_time_collect(query_exec_time);
++#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
++  if (opt_query_response_time_stats)
++  {
++    query_response_time_collect(query_exec_time);
++  }
++#endif
  
    /*
      Low long_query_time value most likely means user is debugging stuff and even
-@@ -1671,6 +1673,7 @@
+@@ -1682,6 +1689,7 @@
    case SCH_CHARSETS:
    case SCH_ENGINES:
    case SCH_COLLATIONS:
  
  /**
    Reload/resets privileges and the different caches.
-@@ -296,6 +296,12 @@
+@@ -322,6 +322,12 @@
  #endif
   if (options & REFRESH_USER_RESOURCES)
     reset_mqh((LEX_USER *) NULL, 0);             /* purecov: inspected */
  #include "lock.h"                           // MYSQL_OPEN_IGNORE_FLUSH
  #include "debug_sync.h"
  #include "datadict.h"   // dd_frm_type()
-@@ -7865,6 +7866,14 @@
+@@ -7888,6 +7889,14 @@
  
  */
  
  ST_SCHEMA_TABLE schema_tables[]=
  {
    {"CHARACTER_SETS", charsets_fields_info, create_schema_table, 
-@@ -7918,6 +7927,13 @@
+@@ -7941,6 +7950,13 @@
     1, 9, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
    {"ROUTINES", proc_fields_info, create_schema_table, 
     fill_schema_proc, make_proc_old_format, 0, -1, -1, 0, 0},
  %token  QUICK
  %token  RANGE_SYM                     /* SQL-2003-R */
  %token  READS_SYM                     /* SQL-2003-R */
-@@ -11080,6 +11081,15 @@
+@@ -11105,6 +11106,15 @@
            {
              Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
            }
          | CREATE PROCEDURE_SYM sp_name
            {
              LEX *lex= Lex;
-@@ -11316,6 +11326,12 @@
-           { Lex->type|= REFRESH_STATUS; }
-         | SLAVE
-           { Lex->type|= REFRESH_SLAVE; }
+@@ -11344,6 +11354,12 @@
+             Lex->type|= REFRESH_SLAVE;
+             Lex->reset_slave_info.all= false;
+           }
 +        | QUERY_RESPONSE_TIME_SYM
 +          { 
 +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
          | MASTER_SYM
            { Lex->type|= REFRESH_MASTER; }
          | DES_KEY_FILE
-@@ -12617,6 +12633,7 @@
+@@ -12651,6 +12667,7 @@
          | PROXY_SYM                {}
          | QUARTER_SYM              {}
          | QUERY_SYM                {}
          | REBUILD_SYM              {}
 --- a/sql/sys_vars.cc
 +++ b/sql/sys_vars.cc
-@@ -49,6 +49,7 @@
- #include "../storage/perfschema/pfs_server.h"
- #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
+@@ -51,6 +51,7 @@
+ TYPELIB bool_typelib={ array_elements(bool_values)-1, "", bool_values, 0 };
  
 +#include "query_response_time.h" 
  /*
    This forward declaration is needed because including sql_base.h
    causes further includes.  [TODO] Eliminate this forward declaration
-@@ -1860,6 +1861,26 @@
+@@ -1939,6 +1940,26 @@
         DEFAULT(FALSE));
  #endif /* HAVE_QUERY_CACHE */
  
 @@ -0,0 +1,2 @@
 +Variable_name Value
 +have_response_time_distribution       YES
---- a/include/atomic/x86-gcc.h 2011-05-11 14:54:11.000000000 +0300
-+++ b/include/atomic/x86-gcc.h 2011-07-21 16:20:24.563057000 +0300
-@@ -108,27 +108,22 @@
+--- a/include/atomic/x86-gcc.h
++++ b/include/atomic/x86-gcc.h
+@@ -108,27 +108,23 @@
    v=tmp;
  
  /*
 -                : "c" (&set), "m" (*a)                            \
 -                : "memory", "esp")
 +#define make_atomic_cas_body64                                     \
-+  asm ("movl %%edi, -4(%%esp);"                                    \
-+       "leal %0, %%edi;"                                           \
-+       "xchgl %%ebx, %%esi;"                                       \
-+       LOCK_prefix "; cmpxchg8b (%%edi);"                          \
-+       "movl %%esi, %%ebx;"                                        \
-+       "movl -4(%%esp), %%edi;"                                    \
-+       "setz %1;"                                                  \
-+       : "+m" (*a), "=q" (ret), "+A" (*cmp)                        \
-+       : "S" ((int32)(set & 0xFFFFFFFF)), "c" ((int32)(set >> 32)) \
-+       : "flags")
++  asm volatile ("movl %%edi, -4(%%esp);"                           \
++                "leal %0, %%edi;"                                  \
++                "xchgl %%ebx, %%esi;"                              \
++                LOCK_prefix "; cmpxchg8b (%%edi);"                 \
++                "movl %%esi, %%ebx;"                               \
++                "movl -4(%%esp), %%edi;"                           \
++                "setz %1;"                                         \
++                : "+m" (*a), "=q" (ret), "+A" (*cmp)               \
++                : "S" ((int32)(set & 0xFFFFFFFF)),                 \
++                  "c" ((int32)(set >> 32))                         \
++                : "memory", "flags")
  #endif
  
  /*
+--- a/mysql-test/r/mysqld--help-notwin.result
++++ b/mysql-test/r/mysqld--help-notwin.result
+@@ -505,6 +505,12 @@
+  Invalidate queries in query cache on LOCK for write
+  --query-prealloc-size=# 
+  Persistent buffer for query parsing and execution
++ --query-response-time-range-base=# 
++ Select base of log for query_response_time ranges.
++ WARNING: variable change affect only after flush
++ --query-response-time-stats 
++ Enable or disable query response time statisics
++ collecting
+  --range-alloc-block-size=# 
+  Allocation block size for storing ranges during
+  optimization
+@@ -939,6 +945,8 @@
+ query-cache-type ON
+ query-cache-wlock-invalidate FALSE
+ query-prealloc-size 8192
++query-response-time-range-base 10
++query-response-time-stats FALSE
+ range-alloc-block-size 4096
+ read-buffer-size 131072
+ read-only FALSE
This page took 0.160383 seconds and 4 git commands to generate.