Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3ce3295e
Commit
3ce3295e
authored
Mar 09, 2005
by
kent@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysqldumpslow.sh:
bug#4914 added --help and usage information
parent
61214228
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
3 deletions
+40
-3
scripts/mysqldumpslow.sh
scripts/mysqldumpslow.sh
+40
-3
No files found.
scripts/mysqldumpslow.sh
View file @
3ce3295e
...
@@ -17,8 +17,9 @@ my %opt = (
...
@@ -17,8 +17,9 @@ my %opt = (
)
;
)
;
GetOptions
(
\%
opt,
GetOptions
(
\%
opt,
'v+'
,
# verbose
'verbose|v+'
,# verbose
'd+'
,
# debug
'help+'
,
# write usage info
'debug|d+'
,
# debug
's=s'
,
# what to sort by (t, at, l, al, r, ar etc)
's=s'
,
# what to sort by (t, at, l, al, r, ar etc)
'r!'
,
# reverse the sort order (largest last instead of first)
'r!'
,
# reverse the sort order (largest last instead of first)
't=i'
,
# just show the top n queries
't=i'
,
# just show the top n queries
...
@@ -28,8 +29,9 @@ GetOptions(\%opt,
...
@@ -28,8 +29,9 @@ GetOptions(\%opt,
'h=s'
,
# hostname of db server for *-slow.log filename (can be wildcard)
'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)
'i=s'
,
# name of server instance (if using mysql.server startup script)
'l!'
,
# don't subtract lock time from total time
'l!'
,
# don't subtract lock time from total time
)
or
die
"Bad option"
;
)
or
usage
(
"bad option"
)
;
$opt
{
'help'
}
and usage
()
;
unless
(
@ARGV
)
{
unless
(
@ARGV
)
{
my
$defaults
=
`
my_print_defaults mysqld
`
;
my
$defaults
=
`
my_print_defaults mysqld
`
;
...
@@ -141,3 +143,38 @@ foreach (@sorted) {
...
@@ -141,3 +143,38 @@ foreach (@sorted) {
printf "
Count: %d
Time
=
%.2fs
(
%ds
)
Lock
=
%.2fs
(
%ds
)
Rows
=
%.1f
(
%d
)
,
$user
\@
$host
\n
%s
\n\n
",
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
,
$_
;
$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;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment