List:Internals« Previous MessageNext Message »
From:kent Date:March 9 2005 3:00pm
Subject:bk commit into 4.1 tree (kent:1.2099) BUG#4914
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of kent. When kent does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2099 05/03/09 15:00:40 kent@stripped +1 -0
  mysqldumpslow.sh:
    bug#4914 added --help and usage information

  scripts/mysqldumpslow.sh
    1.8 05/03/09 14:56:28 kent@stripped +40 -3
    bug#4914 added --help and usage information

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	kent
# Host:	g4.boortz.dyndns.org
# Root:	/Users/kent/mysql/bk/mysql-4.1-perl

--- 1.7/scripts/mysqldumpslow.sh	2002-03-26 23:58:43 +01:00
+++ 1.8/scripts/mysqldumpslow.sh	2005-03-09 14:56:28 +01:00
@@ -17,8 +17,9 @@
 );
 
 GetOptions(\%opt,
-    'v+',	# verbose
-    'd+',	# debug
+    'verbose|v+',# verbose
+    'help+',	# write usage info
+    'debug|d+',	# debug
     's=s',	# what to sort by (t, at, l, al, r, ar etc)
     'r!',	# reverse the sort order (largest last instead of first)
     't=i',	# just show the top n queries
@@ -28,8 +29,9 @@
     'h=s',	# hostname 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 die "Bad option";
+) or usage("bad option");
 
+$opt{'help'} and usage();
 
 unless (@ARGV) {
     my $defaults   = `my_print_defaults mysqld`;
@@ -140,4 +142,39 @@
     my $host  = (@hosts==1) ? $hosts[0] : sprintf "%dhosts",scalar @hosts;
     printf "Count: %d  Time=%.2fs (%ds)  Lock=%.2fs (%ds)  Rows=%.1f (%d),
$user\@$host\n%s\n\n",
 	    $c, $at,$t, $al,$l, $ar,$r, $_;
+}
+
+sub usage {
+    my $str= shift;
+    my $text= <<HERE;
+Usage: mysqldumpslow [ OPTS... ] [ LOGS... ]
+
+Parse and summarize the MySQL slow query log. Options are
+
+  --verbose    verbose
+  --debug      debug
+  --help       write this text to standard output
+
+  -v           verbose
+  -d           debug
+  -s ORDER     what to sort by (t, at, l, al, r, ar etc), 'at' is default
+  -r           reverse the sort order (largest last instead of first)
+  -t NUM       just show the top n queries
+  -a           don't abstract all numbers to N and strings to 'S'
+  -n NUM       abstract numbers with at least n digits within names
+  -g PATTERN   grep: only consider stmts that include this string
+  -h HOSTNAME  hostname of db server for *-slow.log filename (can be wildcard),
+               default is '*', i.e. match all
+  -i NAME      name of server instance (if using mysql.server startup script)
+  -l           don't subtract lock time from total time
+
+HERE
+    if ($str) {
+      print STDERR "ERROR: $str\n\n";
+      print STDERR $text;
+      exit 1;
+    } else {
+      print $text;
+      exit 0;
+    }
 }
Thread
bk commit into 4.1 tree (kent:1.2099) BUG#4914kent9 Mar