Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
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
bcc
Commits
c22ec6d4
Commit
c22ec6d4
authored
Dec 18, 2018
by
Teng Qin
Committed by
GitHub
Dec 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2084 from jeromemarchand/dbslower-fix
dbslower: fix a python3 bytes/string issue int the -x option
parents
e42a87f6
bffd94f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
man/man8/dbslower.8
man/man8/dbslower.8
+7
-1
tools/dbslower.py
tools/dbslower.py
+1
-1
tools/dbslower_example.txt
tools/dbslower_example.txt
+3
-1
No files found.
man/man8/dbslower.8
View file @
c22ec6d4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
.SH NAME
.SH NAME
dbslower \- Trace MySQL/PostgreSQL server queries slower than a threshold.
dbslower \- Trace MySQL/PostgreSQL server queries slower than a threshold.
.SH SYNOPSIS
.SH SYNOPSIS
.B dbslower [-v] [-p PID [PID ...]] [-m THRESHOLD] {mysql,postgres}
.B dbslower [-v] [-p PID [PID ...]] [-
x PATH] [-
m THRESHOLD] {mysql,postgres}
.SH DESCRIPTION
.SH DESCRIPTION
This traces queries served by a MySQL or PostgreSQL server, and prints
This traces queries served by a MySQL or PostgreSQL server, and prints
those that exceed a latency (query time) threshold. By default a threshold of
those that exceed a latency (query time) threshold. By default a threshold of
...
@@ -11,6 +11,8 @@ those that exceed a latency (query time) threshold. By default a threshold of
...
@@ -11,6 +11,8 @@ those that exceed a latency (query time) threshold. By default a threshold of
This uses User Statically-Defined Tracing (USDT) probes, a feature added to
This uses User Statically-Defined Tracing (USDT) probes, a feature added to
MySQL and PostgreSQL for DTrace support, but which may not be enabled on a
MySQL and PostgreSQL for DTrace support, but which may not be enabled on a
given installation. See requirements.
given installation. See requirements.
Alternativly, MySQL queries can be traced without the USDT support using the
-x option.
Since this uses BPF, only the root user can use this tool.
Since this uses BPF, only the root user can use this tool.
.SH REQUIREMENTS
.SH REQUIREMENTS
...
@@ -25,6 +27,10 @@ Print usage message.
...
@@ -25,6 +27,10 @@ Print usage message.
Trace this PID. If no PID is specified, the tool will attempt to automatically
Trace this PID. If no PID is specified, the tool will attempt to automatically
detect the MySQL or PostgreSQL processes running on the system.
detect the MySQL or PostgreSQL processes running on the system.
.TP
.TP
\-x PATH
Path to MySQL binary. This option allow to MySQL queries even when USDT probes
aren't enabled on the MySQL server.
.TP
\-m THRESHOLD
\-m THRESHOLD
Minimum query latency (duration) to trace, in milliseconds. Default is 1 ms.
Minimum query latency (duration) to trace, in milliseconds. Default is 1 ms.
.TP
.TP
...
...
tools/dbslower.py
View file @
c22ec6d4
...
@@ -69,7 +69,7 @@ if args.path and not args.pids:
...
@@ -69,7 +69,7 @@ if args.path and not args.pids:
(
mysql_func_name
,
addr
)
=
symbols
[
0
]
(
mysql_func_name
,
addr
)
=
symbols
[
0
]
if
mysql_func_name
.
find
(
"COM_DATA"
)
>=
0
:
if
mysql_func_name
.
find
(
b'COM_DATA'
)
>=
0
:
mode
=
"MYSQL57"
mode
=
"MYSQL57"
else
:
else
:
mode
=
"MYSQL56"
mode
=
"MYSQL56"
...
...
tools/dbslower_example.txt
View file @
c22ec6d4
...
@@ -67,7 +67,7 @@ before the actual queries start coming in.
...
@@ -67,7 +67,7 @@ before the actual queries start coming in.
USAGE:
USAGE:
# dbslower -h
# dbslower -h
usage: dbslower.py [-h] [-v] [-p [PIDS [PIDS ...]]] [-m THRESHOLD]
usage: dbslower.py [-h] [-v] [-p [PIDS [PIDS ...]]] [-
x PATH] [-
m THRESHOLD]
{mysql,postgres}
{mysql,postgres}
positional arguments:
positional arguments:
...
@@ -78,6 +78,7 @@ optional arguments:
...
@@ -78,6 +78,7 @@ optional arguments:
-v, --verbose print the BPF program
-v, --verbose print the BPF program
-p [PID [PID ...]], --pid [PID [PID ...]]
-p [PID [PID ...]], --pid [PID [PID ...]]
the pid(s) to trace
the pid(s) to trace
-x PATH, --exe PATH path to binary
-m THRESHOLD, --threshold THRESHOLD
-m THRESHOLD, --threshold THRESHOLD
trace queries slower than this threshold (ms)
trace queries slower than this threshold (ms)
...
@@ -86,3 +87,4 @@ examples:
...
@@ -86,3 +87,4 @@ examples:
dbslower postgres -p 188 322 # trace specific PostgreSQL processes
dbslower postgres -p 188 322 # trace specific PostgreSQL processes
dbslower mysql -p 480 -m 30 # trace MySQL queries slower than 30ms
dbslower mysql -p 480 -m 30 # trace MySQL queries slower than 30ms
dbslower mysql -p 480 -v # trace MySQL queries and print the BPF program
dbslower mysql -p 480 -v # trace MySQL queries and print the BPF program
dbslower mysql -x $(which mysqld) # trace MySQL queries with uprobes
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