pqd: Remove sparklines

This commit is contained in:
Brian Fraser
2013-01-11 13:45:20 -03:00
parent 5495945c7e
commit 4fc66a08d3
105 changed files with 18 additions and 996 deletions

View File

@@ -425,149 +425,6 @@ is_deeply(
],
'Got saved usage for 0xdeadbeef');
# #############################################################################
# Issue 1141: Add "spark charts" to mk-query-digest profile
# #############################################################################
is(
$exa->sparkline(explain =>
[
{ id => 1,
select_type => 'PRIMARY',
table => 'foo',
type => 'eq_ref',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => [],
rows => 100,
Extra => {
'Using index' => 1,
'Using where' => 1,
},
},
],
),
"E",
"sparkline: basic 1 table eq_ref"
);
is(
$exa->sparkline(explain =>
[
{ id => 1,
select_type => 'PRIMARY',
table => 'foo',
type => 'eq_ref',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => [],
rows => 100,
Extra => {
'Using index' => 1,
'Using where' => 1,
'Using filesort' => 1,
},
},
{ id => 2,
select_type => 'PRIMARY',
table => 'bar',
type => 'ref',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => ['foo.col'],
rows => 100,
Extra => {
},
},
],
),
"F>Er",
"sparkline: 2 table with filesort at start"
);
is(
$exa->sparkline(explain =>
[
{ id => 1,
select_type => 'PRIMARY',
table => 'foo',
type => 'range',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => [],
rows => 100,
Extra => {
},
},
{ id => 2,
select_type => 'PRIMARY',
table => 'bar',
type => 'ref',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => ['foo.col'],
rows => 100,
Extra => {
'Using temporary' => 1,
'Using filesort' => 1,
},
},
],
),
"nr>TF",
"sparkline: 2 table with temp and filesort at end"
);
is(
$exa->sparkline(explain =>
[
{ id => 1,
select_type => 'PRIMARY',
table => undef,
type => undef,
possible_keys => [],
key => [],
key_len => [],
ref => [],
rows => undef,
Extra => {
'No tables used' => 1,
},
},
{ id => 1,
select_type => 'UNION',
table => 'a',
type => 'index',
possible_keys => [],
key => ['PRIMARY'],
key_len => [2],
ref => [],
rows => 200,
Extra => {
'Using index' => 1,
},
},
{ id => undef,
select_type => 'UNION RESULT',
table => '<union1,2>',
type => 'ALL',
possible_keys => [],
key => [],
key_len => [],
ref => [],
rows => undef,
Extra => {},
},
],
),
"-Ia",
"sparkline: 3 tables, using index"
);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -1175,21 +1175,7 @@ SKIP: {
}
$ea->calculate_statistical_metrics();
# Make sure that explain_sparkline() does USE db like explain_report()
# does because by mqd defaults expalin_sparline() is called by profile()
# so if it doesn't USE db then the EXPLAIN will fail. Here we reset
# the db to something else because we already called explain_report()
# above which did USE qrf.
#
# 5.6 really is that different: ia vs. TF>aI. It's smarter.
$dbh->do("USE mysql");
my $explain_sparkline = $qrf->explain_sparkline($arg, 'qrf');
is(
$explain_sparkline,
$sandbox_version eq '5.6' ? "ia" : "TF>aI",
"explain_sparkling() uses db"
);
$report = new ReportFormatter(
line_width => 82,
extend_right => 1,
@@ -1360,181 +1346,6 @@ ok(
"Variance-to-mean ration (issue 1124)"
);
# #############################################################################
# Issue 1141: Add "spark charts" to mk-query-digest profile
# #############################################################################
sub proc_events {
my ( %args ) = @_;
my ($arg, $attrib, $vals) = @args{qw(arg attrib vals)};
my $bytes = length $arg;
my $fingerprint = $qr->fingerprint($arg);
$events = [];
foreach my $val ( @$vals ) {
push @$events, {
bytes => $bytes,
arg => $arg,
fingerprint => $fingerprint,
$attrib => $val,
}
}
$ea = new EventAggregator(
groupby => 'fingerprint',
worst => 'Query_time',
);
foreach my $event (@$events) {
$ea->aggregate($event);
}
$ea->calculate_statistical_metrics(apdex_t=>1);
# Seeing the full chart helps determine what the
# sparkline should look like.
if ( $args{chart} ) {
$result = $qrf->chart_distro(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
print $result;
}
return;
};
# Test sparklines in isolation.
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0 0 0)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
" ",
"Sparkchart line - all zeros"
);
# 1us
# 10us
# 100us ################################################
# 1ms ################################
# 10ms ################################
# 100ms ################################################################
# 1s ################
# 10s+
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0.100000 0.500000 0.000600 0.008000 0.990000 1.000000 0.400000 0.003000 0.000200 0.000100 0.010000 0.020000)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
" -..^_ ",
"Sparkchart line 1"
);
# 1us
# 10us
# 100us
# 1ms
# 10ms ################################
# 100ms ################################################################
# 1s ########
# 10s+
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0.01 0.03 0.08 0.09 0.3 0.5 0.5 0.6 0.7 0.5 0.5 0.9 1.0)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
" .^_ ",
"Sparkchart line 2"
);
# 1us ################################################################
# 10us ################################################################
# 100us ################################################################
# 1ms ################################################################
# 10ms ################################################################
# 100ms ################################################################
# 1s ################################################################
# 10s+
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0.000003 0.000030 0.000300 0.003000 0.030000 0.300000 3)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
"^^^^^^^ ",
"Sparkchart line - vals in all ranges except 10s+"
);
# 1us ################################################################
# 10us ################################################################
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+ ################################################################
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0.000003 0.000030 0.000003 0.000030 3 3 30 30)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
"^^ ^^",
"Sparkchart line - twin peaks"
);
# Test that that ^ sparkchart appears in the event header properly.
$result = $qrf->event_report(
ea => $ea,
select => [ qw(Query_time) ],
item => 'select c from t',
rank => 1,
orderby => 'Query_time',
reason => 'top',
);
ok(
no_diff(
$result,
"t/lib/samples/QueryReportFormatter/report028.txt",
cmd_output => 1,
),
'Sparkchart in event header'
);
# ############################################################################
# Bug 887688: Prepared statements crash pt-query-digest
# ############################################################################

View File

@@ -8,7 +8,6 @@
# Query 1: 0 QPS, 0x concurrency, ID 0x5796997451B1FA1D at byte 123 ______
# Scores: V/M = 0.00
# Query_time sparkline: | ^ |
# Time range: all events occurred at 2007-10-15 21:43:52
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,7 +1,6 @@
# Query 1: 0 QPS, 0x concurrency, ID 0x3F79759E7FA2F117 at byte 1106 _____
# Scores: V/M = 0.00
# Query_time sparkline: | ^ |
# Time range: all events occurred at 2009-12-08 09:23:49.637892
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
@@ -32,7 +31,6 @@ SELECT i FROM d.t WHERE i="3"\G
# Query 2: 0 QPS, 0x concurrency, ID 0xAA8E9FA785927259 at byte 0 ________
# Scores: V/M = 0.00
# Query_time sparkline: | ^ |
# Time range: all events occurred at 2009-12-08 09:23:49.637394
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -6,7 +6,6 @@
# Query 1: 0 QPS, 0x concurrency, ID 0x5796997451B1FA1D at byte 123 ______
# Scores: V/M = 0.00
# Query_time sparkline: | ^ |
# Time range: all events occurred at 2007-10-15 21:43:52
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,6 +1,5 @@
# Item 1: 0 QPS, 0x concurrency, ID 0xEDEF654FCCC4A4D8 at byte 0 _________
# Scores: V/M = 0.00
# Query_time sparkline: | ^ |
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 3

View File

@@ -1,6 +1,5 @@
# Item 1: 0 QPS, 0x concurrency, ID 0xEDEF654FCCC4A4D8 at byte 0 _________
# Scores: V/M = 0.00
# Query_time sparkline: | ^ |
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 1

View File

@@ -1,14 +1,12 @@
# Profile
# Rank Query ID Response time Calls R/Call V/M EXPLAIN Item
# ==== ================== ============= ===== ====== ===== ======= =========
# 1 0x46F81B022F1AD76B 0.0003 100.0% 1 0.0003 0.00 ia SELECT t
# MISC 0xMISC 0.0003 100.0% 1 0.0003 0.0 MISC <1 ITEMS>
# Rank Query ID Response time Calls R/Call V/M Item
# ==== ================== ============= ===== ====== ===== =========
# 1 0x46F81B022F1AD76B 0.0003 100.0% 1 0.0003 0.00 SELECT t
# MISC 0xMISC 0.0003 100.0% 1 0.0003 0.0 <1 ITEMS>
# Query 1: 0 QPS, 0x concurrency, ID 0x46F81B022F1AD76B at byte 0 ________
# Scores: V/M = 0.00
# EXPLAIN sparkline: ia
# Query_time sparkline: | ^ |
# Time range: all events occurred at 2009-12-08 09:23:49.637394
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======