153 lines
4.9 KiB
Plaintext
153 lines
4.9 KiB
Plaintext
--source include/have_ndb.inc
|
|
|
|
use ndbinfo;
|
|
|
|
--echo Show view definitions
|
|
|
|
desc cpustat_50ms;
|
|
desc cpustat_1sec;
|
|
desc cpustat_20sec;
|
|
desc cpustat;
|
|
|
|
--echo Create temporary table for more diagnostics on failure
|
|
create temporary table cpustat_sum (
|
|
tstamp timestamp,
|
|
source char(20),
|
|
cnt int,
|
|
OS_user_time int,
|
|
OS_system_time int,
|
|
OS_idle_time int,
|
|
exec_time int,
|
|
sleep_time int,
|
|
spin_time int,
|
|
send_time int,
|
|
buffer_flule_time int,
|
|
elapsed_time int
|
|
);
|
|
|
|
--echo Check that the tables 'fill' over time if they are not
|
|
--echo already full
|
|
--disable_result_log
|
|
# Choose a thread
|
|
select @node_id:=node_id, @thr_no:=thr_no from cpustat_50ms limit 1;
|
|
--enable_result_log
|
|
|
|
--echo There should be no invalid lines.
|
|
--echo That is lines width longer duration than sampling period.
|
|
--echo Expect zero as result.
|
|
|
|
select count(1) as invalid_lines from cpustat_50ms
|
|
where node_id=@node_id and thr_no=@thr_no and
|
|
OS_user_time > (2 * 1 * 1000000);
|
|
|
|
select count(1) as invalid_lines from cpustat_1sec
|
|
where node_id=@node_id and thr_no=@thr_no and
|
|
OS_user_time > (2 * 20 * 1 * 1000000);
|
|
|
|
select count(1) as invalid_lines from cpustat_20sec
|
|
where node_id=@node_id and thr_no=@thr_no and
|
|
OS_user_time > (2 * 20 * 20 * 1000000);
|
|
|
|
--echo Save line counts before sleep.
|
|
|
|
select count(1) into @start_lines_50ms from cpustat_50ms
|
|
where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
select count(1) into @start_lines_1sec from cpustat_1sec
|
|
where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
select count(1) into @start_lines_20sec from cpustat_20sec
|
|
where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
# Save aggregates of statistics for diagnostics on failure
|
|
|
|
insert into cpustat_sum
|
|
select now(), 'cpustat_50ms', count(*),
|
|
sum(OS_user_time), sum(OS_system_time), sum(OS_idle_time),
|
|
sum(exec_time), sum(sleep_time), sum(spin_time),
|
|
sum(send_time), sum(buffer_full_time), sum(elapsed_time)
|
|
from cpustat_50ms where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
insert into cpustat_sum
|
|
select now(), 'cpustat_1sec', count(*),
|
|
sum(OS_user_time), sum(OS_system_time), sum(OS_idle_time),
|
|
sum(exec_time), sum(sleep_time), sum(spin_time),
|
|
sum(send_time), sum(buffer_full_time), sum(elapsed_time)
|
|
from cpustat_1sec where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
insert into cpustat_sum
|
|
select now(), 'cpustat_20sec', count(*),
|
|
sum(OS_user_time), sum(OS_system_time), sum(OS_idle_time),
|
|
sum(exec_time), sum(sleep_time), sum(spin_time),
|
|
sum(send_time), sum(buffer_full_time), sum(elapsed_time)
|
|
from cpustat_20sec where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
# Sleep as part of test, after sleep all cpustat should have full
|
|
# set of lines (20).
|
|
|
|
select now() into @sleep_start;
|
|
|
|
--sleep 40
|
|
|
|
select now() into @sleep_end;
|
|
|
|
# Save aggregates of statistics for diagnostics on failure.
|
|
|
|
insert into cpustat_sum
|
|
select now(), 'cpustat_50ms', count(*),
|
|
sum(OS_user_time), sum(OS_system_time), sum(OS_idle_time),
|
|
sum(exec_time), sum(sleep_time), sum(spin_time),
|
|
sum(send_time), sum(buffer_full_time), sum(elapsed_time)
|
|
from cpustat_50ms where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
insert into cpustat_sum
|
|
select now(), 'cpustat_1sec', count(*),
|
|
sum(OS_user_time), sum(OS_system_time), sum(OS_idle_time),
|
|
sum(exec_time), sum(sleep_time), sum(spin_time),
|
|
sum(send_time), sum(buffer_full_time), sum(elapsed_time)
|
|
from cpustat_1sec where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
insert into cpustat_sum
|
|
select now(), 'cpustat_20sec', count(*),
|
|
sum(OS_user_time), sum(OS_system_time), sum(OS_idle_time),
|
|
sum(exec_time), sum(sleep_time), sum(spin_time),
|
|
sum(send_time), sum(buffer_full_time), sum(elapsed_time)
|
|
from cpustat_20sec where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
select count(1) as invalid_lines from cpustat_50ms
|
|
where node_id=@node_id and thr_no=@thr_no and
|
|
OS_user_time > (2 * 1 * 1000000);
|
|
|
|
select count(1) as invalid_lines from cpustat_1sec
|
|
where node_id=@node_id and thr_no=@thr_no and
|
|
OS_user_time > (2 * 20 * 1 * 1000000);
|
|
|
|
select count(1) as invalid_lines from cpustat_20sec
|
|
where node_id=@node_id and thr_no=@thr_no and
|
|
OS_user_time > (2 * 20 * 20 * 1000000);
|
|
|
|
--echo Save line counts after sleep.
|
|
|
|
select count(1) into @later_lines_50ms from cpustat_50ms
|
|
where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
select count(1) into @later_lines_1sec from cpustat_1sec
|
|
where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
select count(1) into @later_lines_20sec from cpustat_20sec
|
|
where node_id=@node_id and thr_no=@thr_no;
|
|
|
|
if (!`select @start_lines_50ms <= @later_lines_50ms AND
|
|
@start_lines_1sec <= @later_lines_1sec AND
|
|
@start_lines_20sec <= @later_lines_20sec AND
|
|
@later_lines_50ms = 20 AND
|
|
@later_lines_1sec = 20 AND
|
|
@later_lines_20sec > 1`)
|
|
{
|
|
select @start_invalid_20sec, @later_invalid_20sec,
|
|
TIMEDIFF(@sleep_end, @sleep_start) 'sleep 40s';
|
|
select * from cpustat_sum order by tstamp,source;
|
|
}
|
|
|
|
drop table cpustat_sum;
|