mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-20 17:49:56 +00:00
Change the Report modules to use Lmo
This commit is contained in:
@@ -397,6 +397,7 @@ sub import {
|
|||||||
extends => \&extends,
|
extends => \&extends,
|
||||||
has => \&has,
|
has => \&has,
|
||||||
with => \&with,
|
with => \&with,
|
||||||
|
override => \&override,
|
||||||
confess => \&Carp::confess,
|
confess => \&Carp::confess,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -677,6 +678,16 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub override {
|
||||||
|
my ($methods, $code) = @_;
|
||||||
|
my $caller = scalar caller;
|
||||||
|
|
||||||
|
for my $method ( ref($methods) ? @$methods : $methods ) {
|
||||||
|
my $full_method = "${caller}::${method}";
|
||||||
|
*{_glob_for $full_method} = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
|
@@ -1419,6 +1419,7 @@ sub import {
|
|||||||
extends => \&extends,
|
extends => \&extends,
|
||||||
has => \&has,
|
has => \&has,
|
||||||
with => \&with,
|
with => \&with,
|
||||||
|
override => \&override,
|
||||||
confess => \&Carp::confess,
|
confess => \&Carp::confess,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1699,6 +1700,16 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub override {
|
||||||
|
my ($methods, $code) = @_;
|
||||||
|
my $caller = scalar caller;
|
||||||
|
|
||||||
|
for my $method ( ref($methods) ? @$methods : $methods ) {
|
||||||
|
my $full_method = "${caller}::${method}";
|
||||||
|
*{_glob_for $full_method} = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
|
187
bin/pt-diskstats
187
bin/pt-diskstats
@@ -20,6 +20,7 @@ BEGIN {
|
|||||||
Diskstats
|
Diskstats
|
||||||
DiskstatsGroupByAll
|
DiskstatsGroupByAll
|
||||||
DiskstatsGroupByDisk
|
DiskstatsGroupByDisk
|
||||||
|
DiskstatsGroupBySample
|
||||||
DiskstatsMenu
|
DiskstatsMenu
|
||||||
VersionCheck
|
VersionCheck
|
||||||
HTTPMicro
|
HTTPMicro
|
||||||
@@ -1090,6 +1091,7 @@ use Time::Local qw(timegm timelocal);
|
|||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
use B qw();
|
use B qw();
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
require Exporter;
|
require Exporter;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our %EXPORT_TAGS = ();
|
our %EXPORT_TAGS = ();
|
||||||
@@ -1108,6 +1110,7 @@ our @EXPORT_OK = qw(
|
|||||||
crc32
|
crc32
|
||||||
encode_json
|
encode_json
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
||||||
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
||||||
@@ -2798,6 +2801,190 @@ sub compute_in_progress {
|
|||||||
# See https://launchpad.net/percona-toolkit for more information.
|
# See https://launchpad.net/percona-toolkit for more information.
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
{
|
{
|
||||||
|
|
||||||
|
package DiskstatsGroupBySample;
|
||||||
|
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
use English qw(-no_match_vars);
|
||||||
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
|
use base qw( Diskstats );
|
||||||
|
|
||||||
|
use POSIX qw( ceil );
|
||||||
|
|
||||||
|
sub new {
|
||||||
|
my ( $class, %args ) = @_;
|
||||||
|
my $self = $class->SUPER::new(%args);
|
||||||
|
$self->{_iterations} = 0;
|
||||||
|
$self->{_save_curr_as_prev} = 0;
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub group_by {
|
||||||
|
my ( $self, %args ) = @_;
|
||||||
|
my @optional_args = qw( header_callback rows_callback );
|
||||||
|
my ( $header_callback, $rows_callback ) = $args{ @optional_args };
|
||||||
|
|
||||||
|
$self->clear_state() unless $self->interactive();
|
||||||
|
|
||||||
|
$self->parse_from(
|
||||||
|
sample_callback => $self->can("_sample_callback"),
|
||||||
|
filehandle => $args{filehandle},
|
||||||
|
filename => $args{filename},
|
||||||
|
data => $args{data},
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub _sample_callback {
|
||||||
|
my ( $self, $ts, %args ) = @_;
|
||||||
|
my $printed_a_line = 0;
|
||||||
|
|
||||||
|
if ( $self->has_stats() ) {
|
||||||
|
$self->{_iterations}++;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $elapsed = ($self->curr_ts() || 0)
|
||||||
|
- ($self->prev_ts() || 0);
|
||||||
|
|
||||||
|
if ( $ts > 0 && ceil($elapsed) >= $self->sample_time() ) {
|
||||||
|
|
||||||
|
$self->print_deltas(
|
||||||
|
max_device_length => 6,
|
||||||
|
header_callback => sub {
|
||||||
|
my ( $self, $header, @args ) = @_;
|
||||||
|
|
||||||
|
if ( $self->force_header() ) {
|
||||||
|
my $method = $args{header_callback} || "print_header";
|
||||||
|
$self->$method( $header, @args );
|
||||||
|
$self->set_force_header(undef);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rows_callback => sub {
|
||||||
|
my ( $self, $format, $cols, $stat ) = @_;
|
||||||
|
my $method = $args{rows_callback} || "print_rows";
|
||||||
|
$self->$method( $format, $cols, $stat );
|
||||||
|
$printed_a_line = 1;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ( $self->{_iterations} == 1 || $printed_a_line == 1 ) {
|
||||||
|
$self->{_save_curr_as_prev} = 1;
|
||||||
|
$self->_save_curr_as_prev( $self->stats_for() );
|
||||||
|
$self->set_prev_ts_line( $self->curr_ts_line() );
|
||||||
|
$self->{_save_curr_as_prev} = 0;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub delta_against {
|
||||||
|
my ( $self, $dev ) = @_;
|
||||||
|
return $self->prev_stats_for($dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ts_line_for_timestamp {
|
||||||
|
my ($self) = @_;
|
||||||
|
return $self->prev_ts_line();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub delta_against_ts {
|
||||||
|
my ( $self ) = @_;
|
||||||
|
return $self->prev_ts();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub clear_state {
|
||||||
|
my ( $self, @args ) = @_;
|
||||||
|
$self->{_iterations} = 0;
|
||||||
|
$self->{_save_curr_as_prev} = 0;
|
||||||
|
$self->SUPER::clear_state(@args);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub compute_devs_in_group {
|
||||||
|
my ($self) = @_;
|
||||||
|
my $stats = $self->stats_for();
|
||||||
|
return scalar grep {
|
||||||
|
$stats->{$_} && $self->_print_device_if($_)
|
||||||
|
} $self->ordered_devs;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub compute_dev {
|
||||||
|
my ( $self, $devs ) = @_;
|
||||||
|
$devs ||= $self->compute_devs_in_group();
|
||||||
|
return "{" . $devs . "}" if $devs > 1;
|
||||||
|
return (grep { $self->_print_device_if($_) } $self->ordered_devs())[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub _calc_stats_for_deltas {
|
||||||
|
my ( $self, $elapsed ) = @_;
|
||||||
|
|
||||||
|
my $delta_for;
|
||||||
|
|
||||||
|
foreach my $dev ( grep { $self->_print_device_if($_) } $self->ordered_devs() ) {
|
||||||
|
my $curr = $self->stats_for($dev);
|
||||||
|
my $against = $self->delta_against($dev);
|
||||||
|
|
||||||
|
next unless $curr && $against;
|
||||||
|
|
||||||
|
my $delta = $self->_calc_delta_for( $curr, $against );
|
||||||
|
$delta->{ios_in_progress} = $curr->[Diskstats::IOS_IN_PROGRESS];
|
||||||
|
while ( my ( $k, $v ) = each %$delta ) {
|
||||||
|
$delta_for->{$k} += $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return unless $delta_for && %{$delta_for};
|
||||||
|
|
||||||
|
my $in_progress = $delta_for->{ios_in_progress};
|
||||||
|
my $tot_in_progress = 0;
|
||||||
|
my $devs_in_group = $self->compute_devs_in_group() || 1;
|
||||||
|
|
||||||
|
my %stats = (
|
||||||
|
$self->_calc_read_stats(
|
||||||
|
delta_for => $delta_for,
|
||||||
|
elapsed => $elapsed,
|
||||||
|
devs_in_group => $devs_in_group,
|
||||||
|
),
|
||||||
|
$self->_calc_write_stats(
|
||||||
|
delta_for => $delta_for,
|
||||||
|
elapsed => $elapsed,
|
||||||
|
devs_in_group => $devs_in_group,
|
||||||
|
),
|
||||||
|
in_progress =>
|
||||||
|
$self->compute_in_progress( $in_progress, $tot_in_progress ),
|
||||||
|
);
|
||||||
|
|
||||||
|
my %extras = $self->_calc_misc_stats(
|
||||||
|
delta_for => $delta_for,
|
||||||
|
elapsed => $elapsed,
|
||||||
|
devs_in_group => $devs_in_group,
|
||||||
|
stats => \%stats,
|
||||||
|
);
|
||||||
|
|
||||||
|
@stats{ keys %extras } = values %extras;
|
||||||
|
|
||||||
|
$stats{dev} = $self->compute_dev( $devs_in_group );
|
||||||
|
|
||||||
|
$self->{_first_time_magic} = undef;
|
||||||
|
if ( @{$self->{_nochange_skips}} ) {
|
||||||
|
my $devs = join ", ", @{$self->{_nochange_skips}};
|
||||||
|
PTDEBUG && _d("Skipping [$devs], haven't changed from the first sample");
|
||||||
|
$self->{_nochange_skips} = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return \%stats;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub compute_line_ts {
|
||||||
|
my ($self, %args) = @_;
|
||||||
|
if ( $self->show_timestamps() ) {
|
||||||
|
@args{ qw( first_ts curr_ts ) } = @args{ qw( curr_ts first_ts ) }
|
||||||
|
}
|
||||||
|
return $self->SUPER::compute_line_ts(%args);
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
}
|
}
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# End DiskstatsGroupBySample package
|
# End DiskstatsGroupBySample package
|
||||||
|
@@ -1793,6 +1793,7 @@ use Time::Local qw(timegm timelocal);
|
|||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
use B qw();
|
use B qw();
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
require Exporter;
|
require Exporter;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our %EXPORT_TAGS = ();
|
our %EXPORT_TAGS = ();
|
||||||
@@ -1811,6 +1812,7 @@ our @EXPORT_OK = qw(
|
|||||||
crc32
|
crc32
|
||||||
encode_json
|
encode_json
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
||||||
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
||||||
|
@@ -3019,6 +3019,7 @@ use Time::Local qw(timegm timelocal);
|
|||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
use B qw();
|
use B qw();
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
require Exporter;
|
require Exporter;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our %EXPORT_TAGS = ();
|
our %EXPORT_TAGS = ();
|
||||||
@@ -3037,6 +3038,7 @@ our @EXPORT_OK = qw(
|
|||||||
crc32
|
crc32
|
||||||
encode_json
|
encode_json
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
||||||
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
||||||
|
@@ -3211,6 +3211,7 @@ use Time::Local qw(timegm timelocal);
|
|||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
use B qw();
|
use B qw();
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
require Exporter;
|
require Exporter;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our %EXPORT_TAGS = ();
|
our %EXPORT_TAGS = ();
|
||||||
@@ -3229,6 +3230,7 @@ our @EXPORT_OK = qw(
|
|||||||
crc32
|
crc32
|
||||||
encode_json
|
encode_json
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
||||||
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
||||||
@@ -4434,61 +4436,6 @@ sub fingerprint {
|
|||||||
my ($explain) = @args{@required_args};
|
my ($explain) = @args{@required_args};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub sparkline {
|
|
||||||
my ( $self, %args ) = @_;
|
|
||||||
my @required_args = qw(explain);
|
|
||||||
foreach my $arg ( @required_args ) {
|
|
||||||
die "I need a $arg argument" unless defined $args{$arg};
|
|
||||||
}
|
|
||||||
my ($explain) = @args{@required_args};
|
|
||||||
PTDEBUG && _d("Making sparkline for", Dumper($explain));
|
|
||||||
|
|
||||||
my $access_code = {
|
|
||||||
'ALL' => 'a',
|
|
||||||
'const' => 'c',
|
|
||||||
'eq_ref' => 'e',
|
|
||||||
'fulltext' => 'f',
|
|
||||||
'index' => 'i',
|
|
||||||
'index_merge' => 'm',
|
|
||||||
'range' => 'n',
|
|
||||||
'ref_or_null' => 'o',
|
|
||||||
'ref' => 'r',
|
|
||||||
'system' => 's',
|
|
||||||
'unique_subquery' => 'u',
|
|
||||||
};
|
|
||||||
|
|
||||||
my $sparkline = '';
|
|
||||||
my ($T, $F); # Using temporary, Using filesort
|
|
||||||
|
|
||||||
foreach my $tbl ( @$explain ) {
|
|
||||||
my $code;
|
|
||||||
if ( defined $tbl->{type} ) {
|
|
||||||
$code = $access_code->{$tbl->{type}} || "?";
|
|
||||||
$code = uc $code if $tbl->{Extra}->{'Using index'};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$code = '-'
|
|
||||||
};
|
|
||||||
$sparkline .= $code;
|
|
||||||
|
|
||||||
$T = 1 if $tbl->{Extra}->{'Using temporary'};
|
|
||||||
$F = 1 if $tbl->{Extra}->{'Using filesort'};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $T || $F ) {
|
|
||||||
if ( $explain->[-1]->{Extra}->{'Using temporary'}
|
|
||||||
|| $explain->[-1]->{Extra}->{'Using filesort'} ) {
|
|
||||||
$sparkline .= ">" . ($T ? "T" : "") . ($F ? "F" : "");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$sparkline = ($T ? "T" : "") . ($F ? "F" : "") . ">$sparkline";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PTDEBUG && _d("sparkline:", $sparkline);
|
|
||||||
return $sparkline;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub _d {
|
sub _d {
|
||||||
my ($package, undef, $line) = caller 0;
|
my ($package, undef, $line) = caller 0;
|
||||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||||
|
13
bin/pt-kill
13
bin/pt-kill
@@ -1426,6 +1426,7 @@ sub import {
|
|||||||
extends => \&extends,
|
extends => \&extends,
|
||||||
has => \&has,
|
has => \&has,
|
||||||
with => \&with,
|
with => \&with,
|
||||||
|
override => \&override,
|
||||||
confess => \&Carp::confess,
|
confess => \&Carp::confess,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1706,6 +1707,16 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub override {
|
||||||
|
my ($methods, $code) = @_;
|
||||||
|
my $caller = scalar caller;
|
||||||
|
|
||||||
|
for my $method ( ref($methods) ? @$methods : $methods ) {
|
||||||
|
my $full_method = "${caller}::${method}";
|
||||||
|
*{_glob_for $full_method} = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
@@ -2312,6 +2323,7 @@ use Time::Local qw(timegm timelocal);
|
|||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
use B qw();
|
use B qw();
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
require Exporter;
|
require Exporter;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our %EXPORT_TAGS = ();
|
our %EXPORT_TAGS = ();
|
||||||
@@ -2330,6 +2342,7 @@ our @EXPORT_OK = qw(
|
|||||||
crc32
|
crc32
|
||||||
encode_json
|
encode_json
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
||||||
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
||||||
|
@@ -2517,7 +2517,7 @@ sub _d {
|
|||||||
{
|
{
|
||||||
package ReportFormatter;
|
package ReportFormatter;
|
||||||
|
|
||||||
use Mo;
|
use Lmo;
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
@@ -2920,6 +2920,7 @@ sub _d {
|
|||||||
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
|
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no Lmo;
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
@@ -1419,6 +1419,7 @@ sub import {
|
|||||||
extends => \&extends,
|
extends => \&extends,
|
||||||
has => \&has,
|
has => \&has,
|
||||||
with => \&with,
|
with => \&with,
|
||||||
|
override => \&override,
|
||||||
confess => \&Carp::confess,
|
confess => \&Carp::confess,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1699,6 +1700,16 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub override {
|
||||||
|
my ($methods, $code) = @_;
|
||||||
|
my $caller = scalar caller;
|
||||||
|
|
||||||
|
for my $method ( ref($methods) ? @$methods : $methods ) {
|
||||||
|
my $full_method = "${caller}::${method}";
|
||||||
|
*{_glob_for $full_method} = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
@@ -2305,6 +2316,7 @@ use Time::Local qw(timegm timelocal);
|
|||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
use B qw();
|
use B qw();
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
require Exporter;
|
require Exporter;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our %EXPORT_TAGS = ();
|
our %EXPORT_TAGS = ();
|
||||||
@@ -2323,6 +2335,7 @@ our @EXPORT_OK = qw(
|
|||||||
crc32
|
crc32
|
||||||
encode_json
|
encode_json
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
||||||
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
||||||
|
@@ -1398,6 +1398,7 @@ sub import {
|
|||||||
extends => \&extends,
|
extends => \&extends,
|
||||||
has => \&has,
|
has => \&has,
|
||||||
with => \&with,
|
with => \&with,
|
||||||
|
override => \&override,
|
||||||
confess => \&Carp::confess,
|
confess => \&Carp::confess,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1678,6 +1679,16 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub override {
|
||||||
|
my ($methods, $code) = @_;
|
||||||
|
my $caller = scalar caller;
|
||||||
|
|
||||||
|
for my $method ( ref($methods) ? @$methods : $methods ) {
|
||||||
|
my $full_method = "${caller}::${method}";
|
||||||
|
*{_glob_for $full_method} = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
@@ -3212,6 +3223,7 @@ use Time::Local qw(timegm timelocal);
|
|||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
use B qw();
|
use B qw();
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
require Exporter;
|
require Exporter;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our %EXPORT_TAGS = ();
|
our %EXPORT_TAGS = ();
|
||||||
@@ -3230,6 +3242,7 @@ our @EXPORT_OK = qw(
|
|||||||
crc32
|
crc32
|
||||||
encode_json
|
encode_json
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
||||||
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
||||||
|
@@ -1546,6 +1546,7 @@ sub import {
|
|||||||
extends => \&extends,
|
extends => \&extends,
|
||||||
has => \&has,
|
has => \&has,
|
||||||
with => \&with,
|
with => \&with,
|
||||||
|
override => \&override,
|
||||||
confess => \&Carp::confess,
|
confess => \&Carp::confess,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1826,6 +1827,16 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub override {
|
||||||
|
my ($methods, $code) = @_;
|
||||||
|
my $caller = scalar caller;
|
||||||
|
|
||||||
|
for my $method ( ref($methods) ? @$methods : $methods ) {
|
||||||
|
my $full_method = "${caller}::${method}";
|
||||||
|
*{_glob_for $full_method} = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
|
@@ -3119,6 +3119,7 @@ sub import {
|
|||||||
extends => \&extends,
|
extends => \&extends,
|
||||||
has => \&has,
|
has => \&has,
|
||||||
with => \&with,
|
with => \&with,
|
||||||
|
override => \&override,
|
||||||
confess => \&Carp::confess,
|
confess => \&Carp::confess,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -3399,6 +3400,16 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub override {
|
||||||
|
my ($methods, $code) = @_;
|
||||||
|
my $caller = scalar caller;
|
||||||
|
|
||||||
|
for my $method ( ref($methods) ? @$methods : $methods ) {
|
||||||
|
my $full_method = "${caller}::${method}";
|
||||||
|
*{_glob_for $full_method} = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
@@ -3568,7 +3579,7 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
use Mo;
|
use Lmo;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|
||||||
sub get_cluster_name {
|
sub get_cluster_name {
|
||||||
@@ -7397,6 +7408,7 @@ use Time::Local qw(timegm timelocal);
|
|||||||
use Digest::MD5 qw(md5_hex);
|
use Digest::MD5 qw(md5_hex);
|
||||||
use B qw();
|
use B qw();
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
require Exporter;
|
require Exporter;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our %EXPORT_TAGS = ();
|
our %EXPORT_TAGS = ();
|
||||||
@@ -7415,6 +7427,7 @@ our @EXPORT_OK = qw(
|
|||||||
crc32
|
crc32
|
||||||
encode_json
|
encode_json
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/;
|
||||||
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/;
|
||||||
|
@@ -2214,7 +2214,7 @@ sub _d {
|
|||||||
{
|
{
|
||||||
package VersionParser;
|
package VersionParser;
|
||||||
|
|
||||||
use Mo;
|
use Lmo;
|
||||||
use Scalar::Util qw(blessed);
|
use Scalar::Util qw(blessed);
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
@@ -1423,6 +1423,7 @@ sub import {
|
|||||||
extends => \&extends,
|
extends => \&extends,
|
||||||
has => \&has,
|
has => \&has,
|
||||||
with => \&with,
|
with => \&with,
|
||||||
|
override => \&override,
|
||||||
confess => \&Carp::confess,
|
confess => \&Carp::confess,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1703,6 +1704,16 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub override {
|
||||||
|
my ($methods, $code) = @_;
|
||||||
|
my $caller = scalar caller;
|
||||||
|
|
||||||
|
for my $method ( ref($methods) ? @$methods : $methods ) {
|
||||||
|
my $full_method = "${caller}::${method}";
|
||||||
|
*{_glob_for $full_method} = $code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
package JSONReportFormatter;
|
package JSONReportFormatter;
|
||||||
use Mo;
|
use Lmo;
|
||||||
|
|
||||||
use List::Util qw(sum);
|
use List::Util qw(sum);
|
||||||
use Transformers qw(make_checksum parse_timestamp);
|
use Transformers qw(make_checksum parse_timestamp);
|
||||||
@@ -120,5 +120,6 @@ override query_report => sub {
|
|||||||
return $json . "\n";
|
return $json . "\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
no Lmo;
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
use Mo;
|
use Lmo;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|
||||||
sub get_cluster_name {
|
sub get_cluster_name {
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
# which is also in mk-query-digest.
|
# which is also in mk-query-digest.
|
||||||
package QueryReportFormatter;
|
package QueryReportFormatter;
|
||||||
|
|
||||||
use Mo;
|
use Lmo;
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use POSIX qw(floor);
|
use POSIX qw(floor);
|
||||||
|
|
||||||
@@ -1343,6 +1343,7 @@ sub _d {
|
|||||||
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
|
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no Lmo;
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
@@ -56,7 +56,7 @@
|
|||||||
# calculated widths.
|
# calculated widths.
|
||||||
package ReportFormatter;
|
package ReportFormatter;
|
||||||
|
|
||||||
use Mo;
|
use Lmo;
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||||
|
|
||||||
@@ -506,6 +506,7 @@ sub _d {
|
|||||||
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
|
print STDERR "# $package:$line $PID ", join(' ', @_), "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no Lmo;
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
Reference in New Issue
Block a user