Iperf CSV 출력 형식

Iperf CSV 출력 형식

iperf를 -y C 및 -r 인수와 함께 사용하여 양방향 전송을 테스트하고 이를 CSV로 내보냅니다.

일부 출력을 얻었지만 문제는 열 이름이 무엇인지 모른다는 것입니다. 예를 들어 세 개의 데이터 행이 표시되지만 어느 것이 전송에 해당하고 어느 것이 수신에 해당하는지 알 수 없습니다.

다른 열은 추측할 수 있지만 확실하게 알고 싶습니다.

이 문서는 어디에서도 찾을 수 없습니다!

답변1

필드는 다음과 같습니다.

타임스탬프,source_address,source_port,destination_address,destination_port,간격,transferred_bytes,bits_per_second

나는 이것을 보면서 추론했다.

$ iperf -c localhost -r
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
------------------------------------------------------------
Client connecting to localhost, TCP port 5001
TCP window size:  648 KByte (default)
------------------------------------------------------------
[  5] local 127.0.0.1 port 54401 connected with 127.0.0.1 port 5001
[  4] local 127.0.0.1 port 5001 connected with 127.0.0.1 port 54401
[ ID] Interval       Transfer     Bandwidth
[  5]  0.0-10.0 sec  50.3 GBytes  43.2 Gbits/sec
[  4]  0.0-10.0 sec  50.3 GBytes  43.2 Gbits/sec

$ iperf -c localhost -r -y C
20140114124826,127.0.0.1,54402,127.0.0.1,5001,5,0.0-10.0,52551090176,42041052917
20140114124826,127.0.0.1,5001,127.0.0.1,54402,4,0.0-10.0,52551090200,41999020136

편집: 관련 소스 코드를 찾을 수 있습니다여기:

// TCP Reporting
printf( reportCSV_bw_format,
timestamp,
(stats->reserved_delay == NULL ? ",,," : stats->reserved_delay),
stats->transferID,
stats->startTime,
stats->endTime,
stats->TotalLen,
speed);
} else {
// UDP Reporting
printf( reportCSV_bw_jitter_loss_format,
timestamp,
(stats->reserved_delay == NULL ? ",,," : stats->reserved_delay),
stats->transferID,
stats->startTime,
stats->endTime,
stats->TotalLen,
speed,
stats->jitter*1000.0,
stats->cntError,
stats->cntDatagrams,
(100.0 * stats->cntError) / stats->cntDatagrams, stats->cntOutofOrder );
} 

답변2

허용된 답변은 하나의 홀수 필드를 건너뜁니다. 즉, 소스 및 대상 IP+포트 쌍 뒤에 오는 필드입니다.

timestamp,
source_address,
source_port,
destination_address,
destination_port,
XXX,                  <---- this one
interval,
transferred_bytes,
bits_per_second

허용되는 답변의 코드는 이것이 변수에서 비롯된 것이라고 말합니다 transferID. 여기에 있는 다른 답변 중 일부는 연결 식별자 또는 연결 방향을 나타낸다고 주장하는 것 같습니다. 그러나 코드를 빠르게 살펴보면 transferID이라는 전역 변수에서 비롯된 것임을 알 수 있습니다 groupID. 그것은초기화됨0으로:

// Global ID that we increment to be used 
// as identifier for SUM reports
int groupID = 0;

그러나 코드를 빠르게 grep해보면 코드가 많이 증가하고 감소했음을 알 수 있어 매우 혼란스럽습니다. 그것이 의미하는 바를 말해주는 정의된 상수는 없는 것 같습니다. 수동 테스트( iperf version 2.0.9 (9 Sept 2016) pthreads)는 연결 간에 재사용되는 번호를 보여줍니다. 그래서 제 생각엔 이 이야기의 교훈은... 그 숫자를 무시하세요? 아니면 iperf3를 사용하세요.

답변3

날짜 및 시간, 소스 IP, 소스 포트, 대상 IP, 대상 포트, iperf 프로세스 번호, 시간 간격, 전송된 데이터 양(바이트), 대역폭(초당 비트), 지터(밀리초), 손실된 데이터그램 수, 총 수 전송된 데이터그램 수, 손실률, 순서 없이 수신된 데이터그램 수

위의 정보는 다음에서 얻었습니다.

http://www.jb.man.ac.uk/~jcullen/code/python/iperf_tests.py

답변4

다음은 CSV 값을 사용하고 지정된 bps가 충족되는지 확인하는 루프에서 실행되는 간단한 데모입니다.

또한 위의 답변에서 값이 3/4/5인 추가 필드가 있음을 발견했습니다. 4번과 5번이 방향인 것 같습니다. 3 무슨 뜻인지 잘 모르겠습니다. 어쨌든, 이것이 도움이 될 경우:

#!/usr/bin/python

import sys
import subprocess
from subprocess import Popen

def runProcess(exe):
    p = subprocess.Popen(exe, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    while(True):
      retcode = p.poll() #returns None while subprocess is running
      line = p.stdout.readline()
      yield line
      if(retcode is not None):
        break

#
# do an iperf to a peer and check the bps calculated is at least
# what we asked for
#
def peer_run_until_target_bps_not_met (peer, sample_period, target_bps):

    debug = 0
    target_kbps = target_bps / 1024.0
    target_mbps = target_bps / (1024.0 * 1024.0)
    cmd = "iperf -c %s -t %d -i %d -y C" % (peer, sample_period, sample_period)

    while (True):
        bps=0
        for line in runProcess(cmd.split()):
            if line == "":
                break

            if (debug):
                print "timestamp           %s" % line.split(',')[0]
                print "source_address      %s" % line.split(',')[1]
                print "source_port         %s" % line.split(',')[2]
                print "destination_address %s" % line.split(',')[3]
                print "destination_port    %s" % line.split(',')[4]

                #
                # "3" ???
                # "5" indicates client -> server connection,
                # "4" indicates "server -> client"
                #
                print "direction           %s" % line.split(',')[5]

                print "interval            %s" % line.split(',')[6]
                print "transferred_bytes   %s" % line.split(',')[7]
                print "bits_per_second     %s" % line.split(',')[8]

            transferred_bytes = float(line.split(',')[7])
            bps = (transferred_bytes * 8) / float(sample_period)

        kbps = bps / 1024.0
        mbps = bps / (1024.0 * 1024.0)
        print "OK: %12.2f bps / %10.2f Kbps / %10.2f Mbps (target %-10.2f Mbps)" % (bps, kbps, mbps, target_mbps)

        if (bps < target_bps):
            print "FAILED: need %.2f bps / %.2fKbps / %.2f Mbps" % \
        (target_bps, target_kbps, target_mbps)
            return

peer_run_until_target_bps_not_met("10.2.0.0", 5, 0.2 * 1024 * 1024) # 10 Mbps

관련 정보