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
克隆/下载
tcprtt_example.txt 9.83 KB
一键复制 编辑 原始数据 按行查看 历史
Demonstrations of tcprtt, the Linux eBPF/bcc version.
This program traces TCP RTT(round-trip time) to analyze the quality of
network, then help us to distinguish the network latency trouble is from
user process or physical network.
For example, wrk show the http request latency distribution:
# wrk -d 30 -c 10 --latency http://192.168.122.100/index.html
Running 30s test @ http://192.168.122.100/index.html
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 86.75ms 153.76ms 1.54s 90.85%
Req/Sec 160.91 76.07 424.00 67.06%
Latency Distribution
50% 14.55ms
75% 119.21ms
90% 230.22ms
99% 726.90ms
9523 requests in 30.02s, 69.62MB read
Socket errors: connect 0, read 0, write 0, timeout 1
During wrk testing, run tcprtt:
# ./tcprtt -i 1 -d 10 -m
Tracing TCP RTT... Hit Ctrl-C to end.
msecs : count distribution
0 -> 1 : 4 | |
2 -> 3 : 0 | |
4 -> 7 : 1055 |****************************************|
8 -> 15 : 26 | |
16 -> 31 : 0 | |
32 -> 63 : 0 | |
64 -> 127 : 18 | |
128 -> 255 : 14 | |
256 -> 511 : 14 | |
512 -> 1023 : 12 | |
The wrk output shows that the latency of web service is not stable, and tcprtt
also shows unstable TCP RTT. So in this situation, we need to make sure the
quality of network is good or not firstly.
Use filter for address and(or) port. Ex, only collect local address 192.168.122.200
and remote address 192.168.122.100 and remote port 80.
# ./tcprtt -i 1 -d 10 -m -a 192.168.122.200 -A 192.168.122.100 -P 80
Tracing at server side, show each clients with its own histogram.
For example, run tcprtt on a storage node to show initiators' rtt histogram:
# ./tcprtt -i 1 --lport 3260 --byraddr -e
Tracing TCP RTT... Hit Ctrl-C to end.
Remote Addres = 10.194.87.206 [AVG 170]
usecs : count distribution
0 -> 1 : 0 | |
2 -> 3 : 0 | |
4 -> 7 : 0 | |
8 -> 15 : 0 | |
16 -> 31 : 0 | |
32 -> 63 : 31 | |
64 -> 127 : 5150 |******************* |
128 -> 255 : 10327 |****************************************|
256 -> 511 : 1014 |*** |
512 -> 1023 : 10 | |
1024 -> 2047 : 7 | |
2048 -> 4095 : 14 | |
4096 -> 8191 : 10 | |
Remote Addres = 10.194.87.197 [AVG 4293]
usecs : 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 : 3 |******** |
2048 -> 4095 : 12 |********************************** |
4096 -> 8191 : 14 |****************************************|
Remote Addres = 10.194.88.148 [AVG 6215]
usecs : 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 : 0 | |
2048 -> 4095 : 0 | |
4096 -> 8191 : 2 |****************************************|
Remote Addres = 10.194.87.90 [AVG 2188]
usecs : 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 : 15 |********* |
512 -> 1023 : 30 |****************** |
1024 -> 2047 : 50 |****************************** |
2048 -> 4095 : 65 |****************************************|
4096 -> 8191 : 22 |************* |
....
Use -e(--extension) to show extension RTT:
# ./tcprtt -i 1 -e
All Addresses = ******* [AVG 324]
usecs : count distribution
0 -> 1 : 0 | |
2 -> 3 : 0 | |
4 -> 7 : 0 | |
8 -> 15 : 0 | |
16 -> 31 : 0 | |
32 -> 63 : 0 | |
64 -> 127 : 5360 |******** |
128 -> 255 : 23834 |****************************************|
256 -> 511 : 11276 |****************** |
512 -> 1023 : 700 |* |
1024 -> 2047 : 434 | |
2048 -> 4095 : 356 | |
4096 -> 8191 : 328 | |
8192 -> 16383 : 91 | |
Full USAGE:
# ./tcprtt -h
usage: tcprtt [-h] [-i INTERVAL] [-d DURATION] [-T] [-m] [-p LPORT]
[-P RPORT] [-a LADDR] [-A RADDR] [-b] [-B] [-e] [-D]
[-4 | -6]
Summarize TCP RTT as a histogram
optional arguments:
-h, --help show this help message and exit
-i INTERVAL, --interval INTERVAL
summary interval, seconds
-d DURATION, --duration DURATION
total duration of trace, seconds
-T, --timestamp include timestamp on output
-m, --milliseconds millisecond histogram
-p LPORT, --lport LPORT
filter for local port
-P RPORT, --rport RPORT
filter for remote port
-a LADDR, --laddr LADDR
filter for local address
-A RADDR, --raddr RADDR
filter for remote address
-b, --byladdr show sockets histogram by local address
-B, --byraddr show sockets histogram by remote address
-e, --extension show extension summary(average)
-D, --debug print BPF program before starting (for debugging
purposes)
-4, --ipv4 trace IPv4 family only
-6, --ipv6 trace IPv6 family only
examples:
./tcprtt # summarize TCP RTT
./tcprtt -i 1 -d 10 # print 1 second summaries, 10 times
./tcprtt -m -T # summarize in millisecond, and timestamps
./tcprtt -p # filter for local port
./tcprtt -P # filter for remote port
./tcprtt -a # filter for local address
./tcprtt -A # filter for remote address
./tcprtt -b # show sockets histogram by local address
./tcprtt -B # show sockets histogram by remote address
./tcprtt -D # show debug bpf text
./tcprtt -e # show extension summary(average)
./tcprtt -4 # trace IPv4 family only
./tcprtt -6 # trace IPv6 family only
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/mirrors/bcc.git
git@gitee.com:mirrors/bcc.git
mirrors
bcc
bcc
master

搜索帮助