strace/perf trace 使用

strace -fF -e trace=network ping 114.114.114.114 -c 1

strace: deprecated option -F ignored
socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP) = -1 EACCES (Permission denied)
socket(AF_INET, SOCK_RAW, IPPROTO_ICMP) = 3
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(1025), sin_addr=inet_addr("114.114.114.114")}, 16) = 0
getsockname(4, {sa_family=AF_INET, sin_port=htons(37052), sin_addr=inet_addr("192.168.1.158")}, [16]) = 0
setsockopt(3, SOL_RAW, ICMP_FILTER, ~(1<<ICMP_ECHOREPLY|1<<ICMP_DEST_UNREACH|1<<ICMP_SOURCE_QUENCH|1<<ICMP_REDIRECT|1<<ICMP_TIME_EXCEEDED|1<<ICMP_PARAMETERPROB), 4) = 0
setsockopt(3, SOL_IP, IP_RECVERR, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDBUF, [324], 4) = 0
setsockopt(3, SOL_SOCKET, SO_RCVBUF, [65536], 4) = 0
getsockopt(3, SOL_SOCKET, SO_RCVBUF, [131072], [4]) = 0
PING 114.114.114.114 (114.114.114.114) 56(84) bytes of data.
setsockopt(3, SOL_SOCKET, SO_TIMESTAMP, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_SNDTIMEO, "\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO, "\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
sendto(3, "\10\0C\221Y\213\0\1=d\235b\0\0\0\0\271H\10\0\0\0\0"..., 64, 0, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("114.114.114.114")}, 16) = 64
recvmsg(3, {msg_name={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("114.114.114.114")}, msg_namelen=128->16, msg_iov=[{iov_base="E\24\0T`y\0\0L\1e\361rrrr\300\23\0\1=d\235b"..., iov_len=192}], msg_iovlen=1, msg_control=[{cmsg_len=32, cmsg_level=SOL_SOCKET, cmsg_type=SCM_TIMESTAMP, cmsg_data={tv_sec=1654481981, tv_usec=571112}}], msg_controllen=32, msg_flags=0}, 0) = 84
64 bytes from 114.114.114.114: icmp_seq=1 ttl=76 time=28.2 ms

--- 114.114.114.114 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 28.207/28.207/28.207/0.000 ms
+++ exited with 0 +++

perf trace --event 'net:*' ping 114.114.114.114 -c 1

PING 114.114.114.114 (114.114.114.114) 56(84) bytes of data.
     0.000 net:net_dev_queue:dev=eth0 skbaddr=0xffff9ff8b306ed00 len=98
     0.015 net:net_dev_start_xmit:dev=eth0 queue_mapping=2 skbaddr=0xffff9ff8b306ed00 vlan_tagged=0 vlan_proto=0x0000 vlan_tci=0x0000 protocol=0x0800 ip_summed=0 len=98 data_len=0 network_offset=14 transport_offset_valid=1 transport_offset=34 tx_flags=0 gso_size=0 gso_segs=0 gso_type=0
     0.023 net:net_dev_xmit:dev=eth0 skbaddr=0xffff9ff8b306ed00 len=98 rc=0
64 bytes from 114.114.114.114: icmp_seq=1 ttl=61 time=28.0 ms

--- 114.114.114.114 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 28.090/28.090/28.090/0.000 ms

 

posted @ 2022-06-06 10:25  salami_china  阅读(254)  评论(0编辑  收藏  举报