3000
     ˆÊÉÏ549ÈÁÌ %    ‹      ½”_oÓ0Åß÷)Œx«oÓuÀº4h4•¨è?uE!ÛI¬%vd»+Ý§ÇiZVPË†€I‘|íûžß‰âðE<,?Ï‡èýr2Fó�ïÆ£Â-€Oç€x7/º¤ §áÜ¹ª°^¯Éúœh“Ár¹+‹.Xg$s„;Ž£³°^‹ÎP˜ÊýˆB']!¢‘ââÒ)½rVráO®VI!Ù~¸.-X¡x*A¸(5É-aZW¾×Ì¶¬-öê.¬¬›SSod 4­T8–‡Ðtô`g"L4ßÔÞ‚gõáÛm ÉÖN]š(t9º£…ÌT;]á(”e†¬a}’ie!)¨º%™L1¢…ëã/£Áì«×�ËëÝQHQnDÚÇoýéÕ¬ãhJK=®™xÍ5ŽÆÔ:Tj.S)øIñM#¾‘÷§ŒM,,3²rR«)xÄCT¦[QÏzá	rs¨j$ü±4(û)Œùõb8]Æ£E	¯�xp÷Ÿ¾*Žæ¾TÅÒæ´Ùìˆ›ö/Ub««ýíxŒÌr‡#„Zè¨òB`º¬Œ°VðÃ(|ÌGCX¯ãÉ�”^|�£ÃÙ¡ë_lvÚ�N+ZAu:½î+„N/IðáyyXNU&
�‘X$’ª-Ö‘ÅGéüó—½àâ$]@Þü5ÝJÝ*½VOBÓÕf×ùGù/0:¤ýŒ'þŸ°»¹BØÞŸ!4wûwdÆÚ
>    5   ˆl–Ãa¾”Ên-jq@=p\ÊbÑ¿�þDD³�ÇŽ8øD0ùÑƒxMÐÂÍ  2    #!/usr/bin/perl

# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; version 2
# of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1335  USA

# mysqldumpslow - parse and summarize the MySQL slow query log

# Original version by Tim Bunce, sometime in 2000.
# Further changes by Tim Bunce, 8th March 2001.
# Handling of strings with \ and double '' by Monty 11 Aug 2001.

use strict;
use Getopt::Long;

# t=time, l=lock time, r=rows, a=rows affected
# at, al, ar and aa are the corresponding averages

my %opt = (
    s => 'at',
    h => '*',
);

GetOptions(\%opt,
    'v|verbose+',# verbose
    'help+',	# write usage info
    'd|debug+',	# debug
    's=s',	# what to sort by (aa, ae, al, ar, at, a, c, e, l, r, t)
    'r!',	# reverse the sort order (largest last instead of first)
    't=i',	# just show the top n queries
    'a!',	# don't abstract all numbers to N and strings to 'S'
    'n=i',	# abstract numbers with at least n digits within names
    'g=s',	# grep: only consider stmts that include this string
    'h=s',	# hostname/basename of db server for *-slow.log filename (can be wildcard)
    'i=s',	# name of server instance (if using mysql.server startup script)
    'l!',	# don't subtract lock time from total time
) or usage("bad option");

$opt{'help'} and usage();

unless (@ARGV) {
    my $defaults   = `my_print_defaults --mysqld`;

    my $datadir = ($defaults =~ m/--datadir=(.*)/g)[-1];
    if (!$datadir or $opt{i}) {
	# determine the datadir from the instances section of /etc/my.cnf, if any
	my $instances  = `my_print_defaults instances`;
	die "Can't determine datadir from 'my_print_defaults instances' output: $defaults"
	    unless $instances;
	my @instances = ($instances =~ m/^--(\w+)-/mg);
	die "No -i 'instance_name' specified to select among known instances: @instances.\n"
	    unless $opt{i};
	die "Instance '$opt{i}' is unknown (known instances: @instances)\n"
	    unless grep { $_ eq $opt{i} } @instances;
	$datadir = ($instances =~ m/--$opt{i}-datadir=(.*)/g)[-1]
	    or die "Can't determine --$opt{i}-datadir from 'my_print_defaults instances' output: $instances";
	warn "datadir=$datadir\n" if $opt{v};
    }

    my $slowlog = ($defaults =~ m/--log[-_]slow[-_]queries=(.*)/g)[-1];
    if (!$slowlog)
    {
      $slowlog = ($defaults =~ m/--slow[-_]query[-_]log[-_]file=(.*)/g)[-1];
    }
    if ( $slowlog )
    {
        @ARGV = ($slowlog);
        die "Can't find '$slowlog'\n" unless @ARGV;
    }
    else
    {
      if (!$opt{h})
      {
        $opt{h}= ($defaults =~ m/--log[-_]basename=(.*)/g)[-1];
      }
      @ARGV = <$datadir/$opt{h}-slow.log>;
      die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV;
    }
}

warn "\nReading mysql slow query log from @ARGV\n";

my @pending;
my %stmt;
$/ = ";\n#";		# read entire statements using p