7 Star 13 Fork 3

Gitee 极速下载/bcc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.github
SPECS
cmake
debian
docker
docs
examples
images
introspection
libbpf-tools
man
scripts
snap
src
tests
tools
lib
old
CMakeLists.txt
argdist.py
argdist_example.txt
bashreadline.py
bashreadline_example.txt
bindsnoop.py
bindsnoop_example.txt
biolatency.py
biolatency_example.txt
biolatpcts.py
biolatpcts_example.txt
biopattern.py
biopattern_example.txt
biosnoop.lua
biosnoop.py
biosnoop_example.txt
biotop.py
biotop_example.txt
bitesize.py
bitesize_example.txt
bpflist.py
bpflist_example.txt
btrfsdist.py
btrfsdist_example.txt
btrfsslower.py
btrfsslower_example.txt
cachestat.py
cachestat_example.txt
cachetop.py
cachetop_example.txt
capable.py
capable_example.txt
cobjnew.sh
cobjnew_example.txt
compactsnoop.py
compactsnoop_example.txt
cpudist.py
cpudist_example.txt
cpuunclaimed.py
cpuunclaimed_example.txt
criticalstat.py
criticalstat_example.txt
cthreads_example.txt
dbslower.py
dbslower_example.txt
dbstat.py
dbstat_example.txt
dcsnoop.py
dcsnoop_example.txt
dcstat.py
dcstat_example.txt
deadlock.c
deadlock.py
deadlock_example.txt
dirtop.py
dirtop_example.txt
drsnoop.py
drsnoop_example.txt
execsnoop.py
execsnoop_example.txt
exitsnoop.py
exitsnoop_example.txt
ext4dist.py
ext4dist_example.txt
ext4slower.py
ext4slower_example.txt
f2fsslower.py
f2fsslower_example.txt
filegone.py
filegone_example.txt
filelife.py
filelife_example.txt
fileslower.py
fileslower_example.txt
filetop.py
filetop_example.txt
funccount.py
funccount_example.txt
funcinterval.py
funcinterval_example.txt
funclatency.py
funclatency_example.txt
funcslower.py
funcslower_example.txt
gethostlatency.py
gethostlatency_example.txt
hardirqs.py
hardirqs_example.txt
inject.py
inject_example.txt
javacalls.sh
javacalls_example.txt
javaflow.sh
javaflow_example.txt
javagc.sh
javagc_example.txt
javaobjnew.sh
javaobjnew_example.txt
javastat.sh
javastat_example.txt
javathreads.sh
javathreads_example.txt
killsnoop.py
killsnoop_example.txt
klockstat.py
klockstat_example.txt
kvmexit.py
kvmexit_example.txt
llcstat.py
llcstat_example.txt
mdflush.py
mdflush_example.txt
memleak.py
memleak_example.txt
mountsnoop.py
mountsnoop_example.txt
mysqld_qslower.py
mysqld_qslower_example.txt
netqtop.c
netqtop.py
netqtop_example.txt
nfsdist.py
nfsdist_example.txt
nfsslower.py
nfsslower_example.txt
nodegc.sh
nodegc_example.txt
nodestat.sh
nodestat_example.txt
numasched.py
numasched_example.txt
offcputime.py
offcputime_example.txt
offwaketime.py
offwaketime_example.txt
oomkill.py
oomkill_example.txt
opensnoop.py
opensnoop_example.txt
perlcalls.sh
perlcalls_example.txt
perlflow.sh
perlflow_example.txt
perlstat.sh
perlstat_example.txt
phpcalls.sh
phpcalls_example.txt
phpflow.sh
phpflow_example.txt
phpstat.sh
phpstat_example.txt
pidpersec.py
pidpersec_example.txt
ppchcalls.py
ppchcalls_example.txt
profile.py
profile_example.txt
pythoncalls.sh
pythoncalls_example.txt
pythonflow.sh
pythonflow_example.txt
pythongc.sh
pythongc_example.txt
pythonstat.sh
pythonstat_example.txt
rdmaucma.py
rdmaucma_example.txt
readahead.py
readahead_example.txt
reset-trace.sh
reset-trace_example.txt
rubycalls.sh
rubycalls_example.txt
rubyflow.sh
rubyflow_example.txt
rubygc.sh
rubygc_example.txt
rubyobjnew.sh
rubyobjnew_example.txt
rubystat.sh
rubystat_example.txt
runqlat.py
runqlat_example.txt
runqlen.py
runqlen_example.txt
runqslower.py
runqslower_example.txt
shmsnoop.py
shmsnoop_example.txt
slabratetop.py
slabratetop_example.txt
sofdsnoop.py
sofdsnoop_example.txt
softirqs.py
softirqs_example.txt
solisten.py
solisten_example.txt
sslsniff.py
sslsniff_example.txt
stackcount.py
stackcount_example.txt
stacksnoop.lua
statsnoop.py
statsnoop_example.txt
swapin.py
swapin_example.txt
syncsnoop.py
syncsnoop_example.txt
syscount.py
syscount_example.txt
tclcalls.sh
tclcalls_example.txt
tclflow.sh
tclflow_example.txt
tclobjnew.sh
tclobjnew_example.txt
tclstat.sh
tclstat_example.txt
tcpaccept.py
tcpaccept_example.txt
tcpcong.py
tcpcong_example.txt
tcpconnect.py
tcpconnect_example.txt
tcpconnlat.py
tcpconnlat_example.txt
tcpdrop.py
tcpdrop_example.txt
tcplife.lua
tcplife.py
tcplife_example.txt
tcpretrans.py
tcpretrans_example.txt
tcprtt.py
tcprtt_example.txt
tcpstates.py
tcpstates_example.txt
tcpsubnet.py
tcpsubnet_example.txt
tcpsynbl.py
tcpsynbl_example.txt
tcptop.py
tcptop_example.txt
tcptracer.py
tcptracer_example.txt
threadsnoop.py
threadsnoop_example.txt
tplist.py
tplist_example.txt
trace.py
trace_example.txt
ttysnoop.py
ttysnoop_example.txt
vfscount.py
vfscount_example.txt
vfsstat.py
vfsstat_example.txt
virtiostat.py
virtiostat_example.txt
wakeuptime.py
wakeuptime_example.txt
wqlat.py
wqlat_example.txt
xfsdist.py
xfsdist_example.txt
xfsslower.py
xfsslower_example.txt
zfsdist.py
zfsdist_example.txt
zfsslower.py
zfsslower_example.txt
.clang-format
.dockerignore
.gitignore
.gitmodules
.travis.yml
CMakeLists.txt
CODEOWNERS
CONTRIBUTING-SCRIPTS.md
FAQ.txt
INSTALL.md
LICENSE.txt
LINKS.md
QUICKSTART.md
README.md
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/iovisor/bcc
克隆/下载
dbstat_example.txt 6.50 KB
一键复制 编辑 原始数据 按行查看 历史
Demonstrations of dbstat, the Linux eBPF/bcc version.
dbstat traces queries performed by a MySQL or PostgreSQL database process, and
displays a histogram of query latencies. For example:
# dbstat mysql
Tracing database queries for pids 25776 slower than 0 ms...
query latency (ms) : count distribution
0 -> 1 : 990 |****************************************|
2 -> 3 : 7 | |
4 -> 7 : 0 | |
8 -> 15 : 0 | |
16 -> 31 : 0 | |
32 -> 63 : 0 | |
64 -> 127 : 0 | |
128 -> 255 : 0 | |
256 -> 511 : 0 | |
512 -> 1023 : 0 | |
1024 -> 2047 : 2 | |
^C
It's immediately evident that the vast majority of queries finish very quickly,
in under 1ms, but there are some super-slow queries occasionally, in the 1-2
seconds bucket.
We can filter out the shorter queries with the -m switch:
# dbstat mysql -m 1000
Tracing database queries for pids 25776 slower than 1000 ms...
query latency (ms) : count distribution
0 -> 1 : 0 | |
2 -> 3 : 0 | |
4 -> 7 : 0 | |
8 -> 15 : 0 | |
16 -> 31 : 0 | |
32 -> 63 : 0 | |
64 -> 127 : 0 | |
128 -> 255 : 0 | |
256 -> 511 : 0 | |
512 -> 1023 : 0 | |
1024 -> 2047 : 8 |****************************************|
^C
By default, dbstat will try to detect mysqld and postgres processes, but if
necessary, you can specify the process ids with the -p switch. Here, the -i
switch is also used to request histograms at 3 second intervals:
# dbstat mysql -p $(pidof mysql) -i 3
Tracing database queries for pids 25776 slower than 0 ms...
[06:14:36]
query latency (ms) : count distribution
0 -> 1 : 758 |****************************************|
2 -> 3 : 1 | |
4 -> 7 : 0 | |
8 -> 15 : 0 | |
16 -> 31 : 0 | |
32 -> 63 : 0 | |
64 -> 127 : 0 | |
128 -> 255 : 0 | |
256 -> 511 : 0 | |
512 -> 1023 : 0 | |
1024 -> 2047 : 1 | |
[06:14:39]
query latency (ms) : count distribution
0 -> 1 : 436 |****************************************|
2 -> 3 : 2 | |
4 -> 7 : 0 | |
8 -> 15 : 0 | |
16 -> 31 : 0 | |
32 -> 63 : 0 | |
64 -> 127 : 0 | |
128 -> 255 : 0 | |
256 -> 511 : 0 | |
512 -> 1023 : 0 | |
1024 -> 2047 : 1 | |
[06:14:42]
query latency (ms) : count distribution
0 -> 1 : 399 |****************************************|
2 -> 3 : 0 | |
4 -> 7 : 0 | |
8 -> 15 : 0 | |
16 -> 31 : 0 | |
32 -> 63 : 0 | |
64 -> 127 : 0 | |
128 -> 255 : 0 | |
256 -> 511 : 0 | |
512 -> 1023 : 0 | |
1024 -> 2047 : 1 | |
^C
USAGE:
# dbstat -h
usage: dbstat.py [-h] [-v] [-p [PID [PID ...]]] [-m THRESHOLD] [-u]
[-i INTERVAL]
{mysql,postgres}
positional arguments:
{mysql,postgres} the database engine to use
optional arguments:
-h, --help show this help message and exit
-v, --verbose print the BPF program
-p [PID [PID ...]], --pid [PID [PID ...]]
the pid(s) to trace
-m THRESHOLD, --threshold THRESHOLD
trace queries slower than this threshold (ms)
-u, --microseconds display query latencies in microseconds (default:
milliseconds)
-i INTERVAL, --interval INTERVAL
print summary at this interval (seconds)
dbstat postgres # display a histogram of PostgreSQL query latencies
dbstat mysql -v # display MySQL latencies and print the BPF program
dbstat mysql -u # display query latencies in microseconds (default: ms)
dbstat mysql -m 5 # trace only queries slower than 5ms
dbstat mysql -p 408 # trace queries in a specific process
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/mirrors/bcc.git
git@gitee.com:mirrors/bcc.git
mirrors
bcc
bcc
master

搜索帮助