Iperf CSV输出格式


10

如果我使用带有-y C和-r参数的iperf来测试双向传输并将其导出为CSV。

我得到一些输出,但是问题是我不知道列名是什么。例如,它显示了三行数据,但我不知道哪个对应于发送,哪个对应于接收。

我可以猜到其他专栏,但我希望可以肯定。

我在任何地方都找不到此文件!

Answers:


10

字段是

时间戳记,源地址,源端口,目的地地址,目的地端口,时间间隔,传输字节数,每秒位数

我通过看得出来

$ 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和目标IP +端口对之后的奇数字段:

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

接受的答案中的代码说这来自transferID变量。这里的其他一些答案似乎认为它代表连接标识符或连接方向。但是,快速浏览该代码表明它transferID来自名为的全局变量groupID。它初始化为零:

// 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。


1

假设“,”(逗号)是字段分隔符,请看第6个字段。然后在这里查看这些行:

Server listening on TCP port 5001
------------------------------------------------------------
Client connecting to localhost, TCP port 5001

[ 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

“ 5”表示客户端->服务器连接,然后“ 4”表示“服务器->客户端”连接(在此特定示例中,由“ sciurus”给出,请查看要说明的源/目标端口。


1

日期和时间,源IP,源端口,目标IP,目标端口,iperf进程号,时间间隔,传输的数据量(字节),带宽(每秒位数),抖动(毫秒),丢失的数据报数,总数发送的数据报数,丢失百分比,乱序接收的数据报数

我从以下位置获得了以上信息:

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


0

这是一个使用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
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.