Commit f8ccbcc4 authored by unknown's avatar unknown

Correct complaints of reviewers and clean up test.


mysql-test/r/profiling.result:
  Remove unnecessary verbosity.
  
  Remove section of test that is impossible to test with PS protocol.
mysql-test/t/profiling.test:
  Remove unnecessary verbosity.
  
  Remove section of test that is impossible to test with PS protocol.
sql/sql_profile.h:
  Make bit flags unsigned ints.
parent 7eb9aac7
......@@ -308,88 +308,41 @@ create table profile_log (how_many int);
drop procedure if exists p1;
drop procedure if exists p2;
drop procedure if exists p3;
create procedure p1 () modifies sql data begin set profiling = ON; select 'This p1 should show up in profiling'; insert into profile_log select count(*) from information_schema.profiling; end//
create procedure p2() deterministic begin set profiling = ON; call p1(); select 'This p2 should show up in profiling'; end//
create procedure p3 () reads sql data begin set profiling = ON; select 'This p3 should show up in profiling'; show profile; end//
select count(*) as count_before_p1 from information_schema.profiling;
count_before_p1
535
create procedure p1 ()
modifies sql data
begin
set profiling = ON;
select 'This p1 should show up in profiling';
insert into profile_log select count(*) from information_schema.profiling;
end//
create procedure p2()
deterministic
begin
set profiling = ON;
call p1();
select 'This p2 should show up in profiling';
end//
create procedure p3 ()
reads sql data
begin
set profiling = ON;
select 'This p3 should show up in profiling';
show profile;
end//
first call to p1
call p1;
This p1 should show up in profiling
This p1 should show up in profiling
select * from profile_log;
how_many
528
second call to p1
call p1;
This p1 should show up in profiling
This p1 should show up in profiling
select * from profile_log;
how_many
528
478
third call to p1
call p1;
This p1 should show up in profiling
This p1 should show up in profiling
select * from profile_log;
how_many
528
478
443
set session profiling = OFF;
call p2;
This p1 should show up in profiling
This p1 should show up in profiling
This p2 should show up in profiling
This p2 should show up in profiling
set session profiling = OFF;
call p3;
This p3 should show up in profiling
This p3 should show up in profiling
Status Duration
continuing inside routine #
checking permissions #
Opening tables #
init #
optimizing #
executing #
end #
query end #
closing tables #
show profiles;
Query_ID Duration Query
# # create table t3 (id int not null primary key)
# # insert into t1 values (1), (2), (3)
# # insert into t2 values (1), (2), (3)
# # insert into t3 values (1), (2), (3)
# # select * from t1
# # delete from t1
# # insert into t1 values (1), (2), (3)
# # insert into t1 values (1), (2), (3)
# # select * from t1
# # select @@profiling
# # create function f1() returns varchar(50) return 'hello'
# # select @@profiling
# # select @@profiling
# # select 'This p1 should show up in profiling'
# # insert into profile_log select count(*) from information_schema.profiling
# # select * from profile_log
# # SET profiling = ON
# # select 'This p1 should show up in profiling'
# # insert into profile_log select count(*) from information_schema.profiling
# # select * from profile_log
# # SET profiling = ON
# # select 'This p1 should show up in profiling'
# # insert into profile_log select count(*) from information_schema.profiling
# # select * from profile_log
# # SET profiling = ON
# # select 'This p1 should show up in profiling'
# # insert into profile_log select count(*) from information_schema.profiling
# # select 'This p2 should show up in profiling'
# # select 'This p3 should show up in profiling'
# # show profile
drop procedure if exists p1;
drop procedure if exists p2;
drop procedure if exists p3;
......@@ -458,17 +411,5 @@ drop view if exists v1;
Warnings:
Note 1051 Unknown table 'test.v1'
drop function if exists f1;
select 1; select 2; select 3;;
1
1
2
2
3
3
select state from information_schema.profiling where seq=1 order by query_id desc limit 3;
state
continuing
continuing
starting
set session profiling = OFF;
End of 5.0 tests
......@@ -157,12 +157,30 @@ drop procedure if exists p3;
--enable_warnings
delimiter //;
create procedure p1 () modifies sql data begin set profiling = ON; select 'This p1 should show up in profiling'; insert into profile_log select count(*) from information_schema.profiling; end//
create procedure p2() deterministic begin set profiling = ON; call p1(); select 'This p2 should show up in profiling'; end//
create procedure p3 () reads sql data begin set profiling = ON; select 'This p3 should show up in profiling'; show profile; end//
create procedure p1 ()
modifies sql data
begin
set profiling = ON;
select 'This p1 should show up in profiling';
insert into profile_log select count(*) from information_schema.profiling;
end//
create procedure p2()
deterministic
begin
set profiling = ON;
call p1();
select 'This p2 should show up in profiling';
end//
create procedure p3 ()
reads sql data
begin
set profiling = ON;
select 'This p3 should show up in profiling';
show profile;
end//
delimiter ;//
select count(*) as count_before_p1 from information_schema.profiling;
--disable_result_log
--echo first call to p1
call p1;
select * from profile_log;
......@@ -175,11 +193,11 @@ select * from profile_log;
set session profiling = OFF;
call p2;
set session profiling = OFF;
--replace_column 2 #
call p3;
--replace_column 1 # 2 #
show profiles;
--enable_result_log
drop procedure if exists p1;
drop procedure if exists p2;
......@@ -235,10 +253,11 @@ drop table if exists t1, t2, t3;
drop view if exists v1;
drop function if exists f1;
# Multiple queries in one packet.
--eval select 1; select 2; select 3;
# two continuations, one starting
select state from information_schema.profiling where seq=1 order by query_id desc limit 3;
## Multiple queries in one packet. Combo statements don't work with ps-proto.
#--eval select 1; select 2; select 3;
## two continuations, one starting
#select state from information_schema.profiling where seq=1 order by query_id desc limit 3;
## last thing in the file
set session profiling = OFF;
......
......@@ -42,16 +42,16 @@ int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond)
int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table);
#define PROFILE_NONE 0
#define PROFILE_CPU (1<<0)
#define PROFILE_MEMORY (1<<1)
#define PROFILE_BLOCK_IO (1<<2)
#define PROFILE_CONTEXT (1<<3)
#define PROFILE_PAGE_FAULTS (1<<4)
#define PROFILE_IPC (1<<5)
#define PROFILE_SWAPS (1<<6)
#define PROFILE_SOURCE (1<<16)
#define PROFILE_ALL (~0)
#define PROFILE_NONE (uint)0
#define PROFILE_CPU (uint)(1<<0)
#define PROFILE_MEMORY (uint)(1<<1)
#define PROFILE_BLOCK_IO (uint)(1<<2)
#define PROFILE_CONTEXT (uint)(1<<3)
#define PROFILE_PAGE_FAULTS (uint)(1<<4)
#define PROFILE_IPC (uint)(1<<5)
#define PROFILE_SWAPS (uint)(1<<6)
#define PROFILE_SOURCE (uint)(1<<16)
#define PROFILE_ALL (uint)(~0)
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment