저는 iPerf3을 사용하여 두 원격 장치 간의 처리량을 측정하고 있습니다. 내 iPerf 명령의 출력은 다음과 같습니다.
[ 4] 0.00-0.20 sec 122 KBytes 4.98 Mbits/sec 7 29.7 KBytes
[ 4] 0.20-0.40 sec 110 KBytes 4.52 Mbits/sec 0 33.9 KBytes
[ 4] 0.40-0.60 sec 112 KBytes 4.58 Mbits/sec 1 25.5 KBytes
[ 4] 0.60-0.80 sec 84.8 KBytes 3.48 Mbits/sec 0 26.9 KBytes
[ 4] 0.80-1.00 sec 113 KBytes 4.63 Mbits/sec 0 26.9 KBytes
[ 4] 1.00-1.20 sec 113 KBytes 4.63 Mbits/sec 0 28.3 KBytes
[ 4] 1.20-1.40 sec 84.8 KBytes 3.47 Mbits/sec 0 29.7 KBytes
[ 4] 1.40-1.60 sec 113 KBytes 4.63 Mbits/sec 0 31.1 KBytes
[ 4] 1.60-1.80 sec 113 KBytes 4.63 Mbits/sec 0 32.5 KBytes
[ 4] 1.80-2.00 sec 84.8 KBytes 3.48 Mbits/sec 0 33.9 KBytes
[ 4] 2.00-2.20 sec 113 KBytes 4.63 Mbits/sec 0 35.4 KBytes
[ 4] 2.20-2.40 sec 116 KBytes 4.75 Mbits/sec 2 26.9 KBytes
[ 4] 2.40-2.60 sec 84.8 KBytes 3.47 Mbits/sec 0 28.3 KBytes
[ 4] 2.60-2.80 sec 113 KBytes 4.63 Mbits/sec 0 31.1 KBytes
[ 4] 2.80-3.00 sec 84.8 KBytes 3.47 Mbits/sec 0 31.1 KBytes
[ 4] 3.00-3.20 sec 113 KBytes 4.63 Mbits/sec 0 32.5 KBytes
[ 4] 3.20-3.40 sec 84.8 KBytes 3.47 Mbits/sec 1 28.3 KBytes
[ 4] 3.40-3.60 sec 115 KBytes 4.69 Mbits/sec 0 25.5 KBytes
[ 4] 3.60-3.80 sec 113 KBytes 4.63 Mbits/sec 0 26.9 KBytes
[ 4] 3.80-4.00 sec 113 KBytes 4.63 Mbits/sec 0 26.9 KBytes
[ 4] 4.00-4.20 sec 84.8 KBytes 3.48 Mbits/sec 0 28.3 KBytes
[ 4] 4.20-4.40 sec 113 KBytes 4.63 Mbits/sec 0 29.7 KBytes
[ 4] 4.40-4.60 sec 113 KBytes 4.63 Mbits/sec 0 31.1 KBytes
[ 4] 4.60-4.80 sec 84.8 KBytes 3.47 Mbits/sec 0 32.5 KBytes
[ 4] 4.80-5.00 sec 116 KBytes 4.75 Mbits/sec 0 33.9 KBytes
[ 4] 5.00-5.20 sec 102 KBytes 4.17 Mbits/sec 1 26.9 KBytes
[ 4] 5.20-5.40 sec 84.8 KBytes 3.47 Mbits/sec 0 28.3 KBytes
[ 4] 5.40-5.60 sec 113 KBytes 4.63 Mbits/sec 0 29.7 KBytes
[ 4] 5.60-5.80 sec 113 KBytes 4.63 Mbits/sec 0 31.1 KBytes
[ 4] 5.80-6.00 sec 91.9 KBytes 3.76 Mbits/sec 0 32.5 KBytes
[ 4] 6.00-6.20 sec 113 KBytes 4.64 Mbits/sec 0 32.5 KBytes
[ 4] 6.20-6.40 sec 84.8 KBytes 3.47 Mbits/sec 0 33.9 KBytes
[ 4] 6.40-6.60 sec 123 KBytes 5.04 Mbits/sec 1 24.0 KBytes
[ 4] 6.60-6.80 sec 84.8 KBytes 3.48 Mbits/sec 0 26.9 KBytes
[ 4] 6.80-7.00 sec 113 KBytes 4.63 Mbits/sec 0 28.3 KBytes
[ 4] 7.00-7.20 sec 113 KBytes 4.63 Mbits/sec 0 29.7 KBytes
[ 4] 7.20-7.40 sec 113 KBytes 4.63 Mbits/sec 0 31.1 KBytes
[ 4] 7.40-7.60 sec 84.8 KBytes 3.47 Mbits/sec 0 32.5 KBytes
[ 4] 7.60-7.80 sec 113 KBytes 4.63 Mbits/sec 0 32.5 KBytes
[ 4] 7.80-8.00 sec 91.9 KBytes 3.76 Mbits/sec 1 24.0 KBytes
[ 4] 8.00-8.20 sec 84.8 KBytes 3.48 Mbits/sec 0 26.9 KBytes
[ 4] 8.20-8.40 sec 113 KBytes 4.63 Mbits/sec 0 28.3 KBytes
[ 4] 8.40-8.60 sec 113 KBytes 4.63 Mbits/sec 0 29.7 KBytes
[ 4] 8.60-8.80 sec 84.8 KBytes 3.48 Mbits/sec 0 31.1 KBytes
[ 4] 8.80-9.00 sec 113 KBytes 4.63 Mbits/sec 0 32.5 KBytes
[ 4] 9.00-9.20 sec 84.8 KBytes 3.48 Mbits/sec 0 32.5 KBytes
[ 4] 9.20-9.40 sec 120 KBytes 4.92 Mbits/sec 1 24.0 KBytes
[ 4] 9.40-9.60 sec 84.8 KBytes 3.48 Mbits/sec 0 26.9 KBytes
[ 4] 9.60-9.80 sec 113 KBytes 4.63 Mbits/sec 0 28.3 KBytes
[ 4] 9.80-10.00 sec 113 KBytes 4.63 Mbits/sec 0 29.7 KBytes `
각 출력 라인에 타임스탬프를 추가하고 싶습니다.
답변1
iperf3의 -T 옵션을 사용하여 iperf의 각 줄 시작 부분에 문자열을 추가할 수 있지만, 불행하게도 문자열에 명령(예: date
)이 포함되어 있으면 명령이 원래 실행된 날짜만 사용됩니다.
따라서 스크립트가 부족하여 이를 수행하는 유일한 방법은 한 번에 iperf 1 패킷을 실행하는 in 루프에 대한 빠르고 더러운 것입니다.
┌─[root@Fedora]─[~]─[03:25 pm]
└─[$]› for i in {1..30}; do iperf3 -c 192.168.0.1 -i 1 -t 1 -T $(date "+%H:%M:%S ") | grep -A1 Interval | grep -v Interval ; done
15:26:26 : [ 4] 0.00-1.00 sec 8.23 MBytes 69.0 Mbits/sec 8 271 KBytes
15:26:26 : [ 4] 0.00-1.00 sec 8.23 MBytes 69.0 Mbits/sec 8 sender
15:26:27 : [ 4] 0.00-1.00 sec 12.4 MBytes 104 Mbits/sec 219 733 KBytes
15:26:27 : [ 4] 0.00-1.00 sec 12.4 MBytes 104 Mbits/sec 219 sender
15:26:29 : [ 4] 0.00-1.00 sec 12.5 MBytes 105 Mbits/sec 101 673 KBytes
15:26:29 : [ 4] 0.00-1.00 sec 12.5 MBytes 105 Mbits/sec 101 sender
15:26:30 : [ 4] 0.00-1.00 sec 14.0 MBytes 117 Mbits/sec 0 1.05 MBytes
15:26:30 : [ 4] 0.00-1.00 sec 14.0 MBytes 117 Mbits/sec 0 sender
15:26:32 : [ 4] 0.00-1.00 sec 12.4 MBytes 104 Mbits/sec 29 566 KBytes
15:26:32 : [ 4] 0.00-1.00 sec 12.4 MBytes 104 Mbits/sec 29 sender
15:26:33 : [ 4] 0.00-1.00 sec 14.0 MBytes 117 Mbits/sec 2 729 KBytes
하지만 이 접근 방식을 사용하면 전체 평균 결과가 나오지 않는다는 의미입니다. 이게 도움이 되길 바란다.
답변2
~처럼iperf3.9, --timestamps
타임스탬프가 앞에 추가될 수 있도록 이 플래그가 추가됩니다.
PS C:\Users\kyrlon> iperf3 -c 127.0.0.1 --timestamp
Thu Apr 4 17:32:38 2024 Connecting to host 127.0.0.1, port 5201
Thu Apr 4 17:32:38 2024 [ 5] local 127.0.0.1 port 33864 connected to 127.0.0.1 port 5201
Thu Apr 4 17:32:39 2024 [ ID] Interval Transfer Bitrate
Thu Apr 4 17:32:39 2024 [ 5] 0.00-1.00 sec 581 MBytes 4.86 Gbits/sec
Thu Apr 4 17:32:40 2024 [ 5] 1.00-2.00 sec 578 MBytes 4.84 Gbits/sec
Thu Apr 4 17:32:41 2024 [ 5] 2.00-3.00 sec 704 MBytes 5.92 Gbits/sec
Thu Apr 4 17:32:42 2024 [ 5] 3.00-4.00 sec 778 MBytes 6.53 Gbits/sec
Thu Apr 4 17:32:43 2024 [ 5] 4.00-5.00 sec 746 MBytes 6.25 Gbits/sec
Thu Apr 4 17:32:44 2024 [ 5] 5.00-6.00 sec 796 MBytes 6.66 Gbits/sec
Thu Apr 4 17:32:45 2024 [ 5] 6.00-7.00 sec 708 MBytes 5.96 Gbits/sec
Thu Apr 4 17:32:46 2024 [ 5] 7.00-8.00 sec 790 MBytes 6.63 Gbits/sec
Thu Apr 4 17:32:47 2024 [ 5] 8.00-9.00 sec 815 MBytes 6.84 Gbits/sec
Thu Apr 4 17:32:48 2024 [ 5] 9.00-10.00 sec 881 MBytes 7.38 Gbits/sec
Thu Apr 4 17:32:48 2024 - - - - - - - - - - - - - - - - - - - - - - - - -
Thu Apr 4 17:32:48 2024 [ ID] Interval Transfer Bitrate
Thu Apr 4 17:32:48 2024 [ 5] 0.00-10.00 sec 7.20 GBytes 6.19 Gbits/sec sender
Thu Apr 4 17:32:48 2024 [ 5] 0.00-10.00 sec 7.20 GBytes 6.18 Gbits/sec receiver
Thu Apr 4 17:32:48 2024
Thu Apr 4 17:32:48 2024 iperf Done.