4
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
5
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
6
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
10
use warnings FATAL => 'all';
11
use English qw(-no_match_vars);
17
$Data::Dumper::Indent = 1;
18
$Data::Dumper::Sortkeys = 1;
19
$Data::Dumper::Quotekeys = 0;
21
require "$trunk/bin/pt-upgrade";
23
sub test_diff_query_times {
26
my $diff = pt_upgrade::diff_query_times(
27
query_time1 => $args{t1},
28
query_time2 => $args{t2},
33
"$args{t1} vs. $args{t2}"
34
) or diag(Dumper($diff));
37
test_diff_query_times(
43
test_diff_query_times(
49
test_diff_query_times(
52
expect => ['0.01', '0.5', '50.0'],
55
test_diff_query_times(
61
test_diff_query_times(
64
expect => [ 23, 820, 35.7 ],
67
# Just .01 shy of 1 order of mag. diff.
68
test_diff_query_times(
74
# Exactly 1 order of mag. diff.
75
test_diff_query_times(
78
expect => [ 0.09, 0.9, '10.0' ],
81
# An order of mag. decrease, which is ok.
82
test_diff_query_times(
88
# #############################################################################
90
# #############################################################################