AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 566737
Accepted
user350325
user350325
Asked: 2014-01-13 06:59:32 +0800 CST2014-01-13 06:59:32 +0800 CST 2014-01-13 06:59:32 +0800 CST

Iperf CSV 输出格式

  • 772

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

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

我可以猜到其他列,但我宁愿确定。

我在任何地方都找不到这个记录!

iperf
  • 5 5 个回答
  • 22885 Views

5 个回答

  • Voted
  1. Best Answer
    sciurus
    2014-01-15T10:54:23+08:002014-01-15T10:54:23+08:00

    字段是

    时间戳、源地址、源端口、目标地址、目标端口、时间间隔、传输字节数、每秒位数

    我通过查看推断出这一点

    $ 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 );
    } 
    
    • 11
  2. Victor
    2014-06-06T07:56:13+08:002014-06-06T07:56:13+08:00

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

    我从以下渠道获得了上述信息:

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

    • 3
  3. brenns10
    2017-04-21T07:40:18+08:002017-04-21T07:40:18+08:00

    接受的答案会跳过一个奇怪的字段:源和目标 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。

    • 3
  4. Jacek Lakomiec
    2014-01-15T17:04:49+08:002014-01-15T17:04:49+08:00

    假设“,”(逗号)是字段分隔符,请查看第 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
  5. Goblinhack
    2015-05-29T10:50:58+08:002015-05-29T10:50:58+08:00

    这是一个使用 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
    
    • 0

相关问题

  • 具有良好图形的吞吐量工具[关闭]

  • 基于命令行的 IP 流量生成器

  • 为 win32 预编译的 Iperf 2.x 二进制文件?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve