mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Merged fix-1160918-restore-show-all
This commit is contained in:
@@ -6525,6 +6525,12 @@ has event_headers => (
|
||||
default => sub { [qw(pct total min max avg 95% stddev median)] },
|
||||
);
|
||||
|
||||
has show_all => (
|
||||
is => 'ro',
|
||||
isa => 'HashRef',
|
||||
default => sub { {} },
|
||||
);
|
||||
|
||||
has ReportFormatter => (
|
||||
is => 'ro',
|
||||
isa => 'ReportFormatter',
|
||||
@@ -7404,11 +7410,13 @@ sub bool_percents {
|
||||
|
||||
sub format_string_list {
|
||||
my ( $self, $attrib, $vals, $class_cnt ) = @_;
|
||||
|
||||
|
||||
if ( !exists $vals->{unq} ) {
|
||||
return ($vals->{cnt});
|
||||
}
|
||||
|
||||
my $show_all = $self->show_all();
|
||||
|
||||
my $cnt_for = $vals->{unq};
|
||||
if ( 1 == keys %$cnt_for ) {
|
||||
my ($str) = keys %$cnt_for;
|
||||
@@ -7433,6 +7441,9 @@ sub format_string_list {
|
||||
}
|
||||
my $p = percentage_of($cnt_for->{$str}, $class_cnt);
|
||||
$print_str .= " ($cnt_for->{$str}/$p%)";
|
||||
if ( !$show_all->{$attrib} ) {
|
||||
last if (length $line) + (length $print_str) > LINE_LENGTH - 27;
|
||||
}
|
||||
$line .= "$print_str, ";
|
||||
$i++;
|
||||
}
|
||||
@@ -13764,6 +13775,8 @@ sub print_reports {
|
||||
my @groupby = @{$args{groupby}};
|
||||
my @orderby = @{$args{orderby}};
|
||||
|
||||
my $show_all = $o->get('show-all');
|
||||
|
||||
for my $i ( 0..$#groupby ) {
|
||||
if ( $o->get('report') || $qv || $qh ) {
|
||||
$eas->[$i]->calculate_statistical_metrics();
|
||||
@@ -13814,6 +13827,7 @@ sub print_reports {
|
||||
OptionParser => $args{OptionParser},
|
||||
QueryParser => $args{QueryParser},
|
||||
Quoter => $args{Quoter},
|
||||
show_all => $show_all,
|
||||
);
|
||||
|
||||
$qrf->print_reports(
|
||||
@@ -15517,6 +15531,18 @@ example, specifying C<--set-vars wait_timeout=500> overrides the defaultvalue of
|
||||
|
||||
The tool prints a warning and continues if a variable cannot be set.
|
||||
|
||||
=item --show-all
|
||||
|
||||
type: Hash
|
||||
|
||||
Show all values for these attributes.
|
||||
|
||||
By default pt-query-digest only shows as many of an attribute's value that
|
||||
fit on a single line. This option allows you to specify attributes for which
|
||||
all values will be shown (line width is ignored). This only works for
|
||||
attributes with string values like user, host, db, etc. Multiple attributes
|
||||
can be specified, comma-separated.
|
||||
|
||||
=item --since
|
||||
|
||||
type: string
|
||||
|
@@ -84,6 +84,12 @@ has event_headers => (
|
||||
default => sub { [qw(pct total min max avg 95% stddev median)] },
|
||||
);
|
||||
|
||||
has show_all => (
|
||||
is => 'ro',
|
||||
isa => 'HashRef',
|
||||
default => sub { {} },
|
||||
);
|
||||
|
||||
has ReportFormatter => (
|
||||
is => 'ro',
|
||||
isa => 'ReportFormatter',
|
||||
@@ -1114,13 +1120,15 @@ sub bool_percents {
|
||||
# Does pretty-printing for lists of strings like users, hosts, db.
|
||||
sub format_string_list {
|
||||
my ( $self, $attrib, $vals, $class_cnt ) = @_;
|
||||
|
||||
|
||||
# Only class result values have unq. So if unq doesn't exist,
|
||||
# then we've been given global values.
|
||||
if ( !exists $vals->{unq} ) {
|
||||
return ($vals->{cnt});
|
||||
}
|
||||
|
||||
my $show_all = $self->show_all();
|
||||
|
||||
my $cnt_for = $vals->{unq};
|
||||
if ( 1 == keys %$cnt_for ) {
|
||||
my ($str) = keys %$cnt_for;
|
||||
@@ -1146,6 +1154,9 @@ sub format_string_list {
|
||||
}
|
||||
my $p = percentage_of($cnt_for->{$str}, $class_cnt);
|
||||
$print_str .= " ($cnt_for->{$str}/$p%)";
|
||||
if ( !$show_all->{$attrib} ) {
|
||||
last if (length $line) + (length $print_str) > LINE_LENGTH - 27;
|
||||
}
|
||||
$line .= "$print_str, ";
|
||||
$i++;
|
||||
}
|
||||
|
@@ -7,4 +7,4 @@
|
||||
# Count 100 3
|
||||
# Exec time 100 6s 1s 3s 2s 3s 780ms 2s
|
||||
# String:
|
||||
# foo Hi. I'm a... (1/33%), Me too! I'... (1/33%), Number 3 l... (1/33%)
|
||||
# foo Hi. I'm a... (1/33%), Me too! I'... (1/33%)... 1 more
|
||||
|
@@ -5,4 +5,4 @@
|
||||
# Count 100 2
|
||||
# Exec time 100 16s 8s 8s 8s 8s 0 8s
|
||||
# String:
|
||||
# Hosts 123.123.123.456 (1/50%), 123.123.123.789 (1/50%)
|
||||
# Hosts 123.123.123.456 (1/50%)... 1 more
|
||||
|
@@ -5,4 +5,4 @@
|
||||
# Count 100 3
|
||||
# Exec time 100 24s 8s 8s 8s 8s 0 8s
|
||||
# String:
|
||||
# Hosts 123.123.123.456 (1/33%), 123.123.123.789 (1/33%), 123.123.123.999 (1/33%)
|
||||
# Hosts 123.123.123.456 (1/33%)... 2 more
|
||||
|
@@ -5,4 +5,4 @@
|
||||
# Count 100 3
|
||||
# Exec time 100 24s 8s 8s 8s 8s 0 8s
|
||||
# String:
|
||||
# Hosts 123.123.123.456 (1/33%), 123.123.123.789 (1/33%), 123.123.123.999 (1/33%)
|
||||
# Hosts 123.123.123.456 (1/33%)... 2 more
|
||||
|
@@ -14,7 +14,7 @@
|
||||
# Rows read 100 690 230 230 230 230 0 230
|
||||
# Query size 100 31 10 11 10.33 10.84 0.47 9.83
|
||||
# String:
|
||||
# Hosts 123.123.123.121 (1/33%), 123.123.123.122 (1/33%), 123.123.123.123 (1/33%)
|
||||
# Hosts 123.123.123.121 (1/33%)... 2 more
|
||||
# Users chessguest
|
||||
# Query_time distribution
|
||||
# 1us
|
||||
|
@@ -72,7 +72,7 @@ SELECT * FROM bar WHERE id=12\G
|
||||
# Rows examine 0 0 0 0 0 0 0 0
|
||||
# Query size 45 140 28 28 28 28 0 28
|
||||
# String:
|
||||
# arg crc 108 (1/20%), 306 (1/20%), 353 (1/20%), 558 (1/20%), 887 (1/20%)
|
||||
# arg crc 108 (1/20%), 306 (1/20%), 353 (1/20%)... 2 more
|
||||
# Query_time distribution
|
||||
# 1us
|
||||
# 10us ################################################################
|
||||
|
@@ -12,7 +12,7 @@
|
||||
# Rows examine 0 0 0 0 0 0 0 0
|
||||
# Query size 100 224 28 28 28 28 0 28
|
||||
# String:
|
||||
# InnoDB trxID 101 (1/12%), 102 (1/12%), 103 (1/12%), 104 (1/12%), 105 (1/12%), 106 (1/12%), A07 (1/12%), A08 (1/12%)
|
||||
# InnoDB trxID 101 (1/12%), 102 (1/12%), 103 (1/12%)... 5 more
|
||||
# Query_time distribution
|
||||
# 1us
|
||||
# 10us ################################################################
|
||||
|
@@ -56,7 +56,7 @@ select * from d.t where name="adam"\G
|
||||
# Warning coun 0 0 0 0 0 0 0 0
|
||||
# String:
|
||||
# Hosts 127.0.0.1
|
||||
# Statement id 2 (1/20%), 3 (1/20%), 4 (1/20%), 5 (1/20%), 6 (1/20%)
|
||||
# Statement id 2 (1/20%), 3 (1/20%), 4 (1/20%), 5 (1/20%)... 1 more
|
||||
# Query_time distribution
|
||||
# 1us
|
||||
# 10us
|
||||
|
Reference in New Issue
Block a user