交叉編譯iperf測試arm開發板上wifi模塊的網絡流量速度

交叉編譯iperf測試arm開發板上wifi模塊的網絡流量速度

1.在pc機端安裝iperf軟件
luther@gliethttp:~$ sudo apt-get install iperf
2.交叉編譯iperf到arm開發板上
luther@gliethttp:~$ wget http://downloads.sourceforge.net/iperf/iperf-2.0.4.tar.gz?modtime=1207626803&big_mirror=0
luther@gliethttp:~$ tar zxvf iperf-2.0.4.tar.gz
luther@gliethttp:~/iperf-2.0.4$ ./configure --help
luther@gliethttp:~/iperf-2.0.4$ ./configure --host=arm-linux
luther@gliethttp:~/iperf-2.0.4$ vim config.h
修改如下內容:可以通過./configure查看正常編譯的配置信息,將差異修改到arm交叉編譯生成的config.h中
...
#define HAVE_MALLOC 0           改爲    #define HAVE_MALLOC 1
/* #undef HAVE_QUAD_SUPPORT */  改爲    #define HAVE_QUAD_SUPPORT 1
#define malloc rpl_malloc       改爲    /* #undef malloc */
luther@gliethttp:~/iperf-2.0.4$ make -j4 //我的pc爲雙核
luther@gliethttp:~/iperf-2.0.4$ ll src/iperf
-rwxr-xr-x 1 luther luther 75K 2008-11-25 16:07 src/iperf
這樣我們運行到arm上的iperf程序就編譯成功了,將它拷貝到arm板子上.
1.在pc上以服務器模式啓動iperf
luther@gliethttp:~$ iperf -s
2.將交叉編譯的iperf拷貝到arm開發板上
/ # tftp -r iperf -g 192.168.100
/ # chmod 755 iperf
/ # ./iperf -c 192.168.2.65 -i 5 -t 60
//192.168.2.65是我的pc端ip地址
//-i 5表示arm板子上啓動的client每5s打印一下速度信息;
//-t 60表示測試60s;
//默認使用tcp傳輸
/ # ./iperf -c 192.168.2.65 -i 5 -t 60
------------------------------------------------------------
Client connecting to 192.168.2.65, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.101 port 35071 connected with 192.168.2.65 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 5.0 sec  5.14 MBytes  8.62 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  5.0-10.0 sec  3.45 MBytes  5.78 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 10.0-15.0 sec  2.61 MBytes  4.38 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 15.0-20.0 sec  3.14 MBytes  5.27 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 20.0-25.0 sec  3.20 MBytes  5.36 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 25.0-30.0 sec  4.56 MBytes  7.65 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 30.0-35.0 sec  5.48 MBytes  9.19 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 35.0-40.0 sec  4.56 MBytes  7.65 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 40.0-45.0 sec  3.05 MBytes  5.12 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 45.0-50.0 sec  3.02 MBytes  5.06 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 50.0-55.0 sec  3.60 MBytes  6.04 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 55.0-60.0 sec  3.29 MBytes  5.52 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-60.1 sec  45.1 MBytes  6.30 Mbits/sec
/ #
在pc端經過60s之後,打印最終log如下:
luther@gliethttp:~$ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.2.65 port 5001 connected with 192.168.2.101 port 35071
[  4]  0.0-60.1 sec  45.1 MBytes  6.29 Mbits/sec

上面
192.168.2.65爲以服務器模式運行的iperf所在pc的ip地址
192.168.2.101爲wifi通過dhcpcd eth0動態獲取的ip

實例2:
/ # ./iperf -c 192.168.2.65 -i 1 -t 60
------------------------------------------------------------
Client connecting to 192.168.2.65, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.101 port 51537 connected with 192.168.2.65 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 1.0 sec  1.63 MBytes  13.7 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  1.0- 2.0 sec  1.50 MBytes  12.6 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  2.0- 3.0 sec  1.61 MBytes  13.5 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  3.0- 4.0 sec  2.05 MBytes  17.2 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  4.0- 5.0 sec  1.54 MBytes  12.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  5.0- 6.0 sec  1.99 MBytes  16.7 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  6.0- 7.0 sec  1.45 MBytes  12.2 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  7.0- 8.0 sec  1.12 MBytes  9.44 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  8.0- 9.0 sec  1.18 MBytes  9.90 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  9.0-10.0 sec  1.23 MBytes  10.3 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 10.0-11.0 sec  1.20 MBytes  10.1 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 11.0-12.0 sec  1.20 MBytes  10.1 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 12.0-13.0 sec  1.20 MBytes  10.0 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 13.0-14.0 sec  1.25 MBytes  10.5 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 14.0-15.0 sec  1.12 MBytes  9.44 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 15.0-16.0 sec  1.23 MBytes  10.4 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 16.0-17.0 sec  1.23 MBytes  10.3 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 17.0-18.0 sec  1.22 MBytes  10.2 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 18.0-19.0 sec    824 KBytes  6.75 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 19.0-20.0 sec  1.00 MBytes  8.39 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 20.0-21.0 sec  1.77 MBytes  14.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 21.0-22.0 sec  1.60 MBytes  13.4 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 22.0-23.0 sec  1.45 MBytes  12.1 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 23.0-24.0 sec  1.72 MBytes  14.4 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 24.0-25.0 sec  1.65 MBytes  13.8 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 25.0-26.0 sec  1.40 MBytes  11.7 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 26.0-27.0 sec  1.67 MBytes  14.0 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 27.0-28.0 sec  1.66 MBytes  13.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 28.0-29.0 sec  1.59 MBytes  13.3 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 29.0-30.0 sec  1.77 MBytes  14.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 30.0-31.0 sec  1.40 MBytes  11.7 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 31.0-32.0 sec  1.73 MBytes  14.5 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 32.0-33.0 sec  1.75 MBytes  14.7 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 33.0-34.0 sec  1.20 MBytes  10.1 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 34.0-35.0 sec  1.77 MBytes  14.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 35.0-36.0 sec  1.80 MBytes  15.1 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 36.0-37.0 sec  1.70 MBytes  14.3 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 37.0-38.0 sec  1.40 MBytes  11.7 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 38.0-39.0 sec  1.43 MBytes  12.0 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 39.0-40.0 sec  1.20 MBytes  10.1 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 40.0-41.0 sec  1.73 MBytes  14.5 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 41.0-42.0 sec  1.71 MBytes  14.4 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 42.0-43.0 sec  1.31 MBytes  11.0 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 43.0-44.0 sec  1.15 MBytes  9.63 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 44.0-45.0 sec    272 KBytes  2.23 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 45.0-46.0 sec  1.15 MBytes  9.63 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 46.0-47.0 sec  1.66 MBytes  13.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 47.0-48.0 sec  1.54 MBytes  12.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 48.0-49.0 sec  1.36 MBytes  11.4 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 49.0-50.0 sec  1.73 MBytes  14.5 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 50.0-51.0 sec  1.73 MBytes  14.5 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 51.0-52.0 sec  1.70 MBytes  14.2 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 52.0-53.0 sec  1.41 MBytes  11.8 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 53.0-54.0 sec  1.80 MBytes  15.1 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 54.0-55.0 sec  1.47 MBytes  12.3 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 55.0-56.0 sec  1.66 MBytes  13.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 56.0-57.0 sec  1.64 MBytes  13.8 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 57.0-58.0 sec  1.77 MBytes  14.9 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 58.0-59.0 sec  1.62 MBytes  13.6 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3] 59.0-60.0 sec  1.60 MBytes  13.4 Mbits/sec
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-60.0 sec  88.5 MBytes  12.4 Mbits/sec
在pc端經過60s之後,打印最終log如下:
luther@gliethttp:~$ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.2.65 port 5001 connected with 192.168.2.101 port 35071
[  4]  0.0-60.1 sec  45.1 MBytes  6.29 Mbits/sec
[  5] local 192.168.2.65 port 5001 connected with 192.168.2.101 port 51537
[  5]  0.0-60.1 sec  88.5 MBytes  12.4 Mbits/sec

從這裏來看指定-i參數似乎影響到實際速度,所以可以將其去掉:
/ # ./iperf -c 192.168.2.65 -t 10
------------------------------------------------------------
Client connecting to 192.168.2.65, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.101 port 51692 connected with 192.168.2.65 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  16.5 MBytes  13.8 Mbits/sec
/ # ./iperf -c 192.168.2.65 -t 60
------------------------------------------------------------
Client connecting to 192.168.2.65, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.101 port 51693 connected with 192.168.2.65 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-60.0 sec  71.4 MBytes  9.98 Mbits/sec
/ # ./iperf -c 192.168.2.65 -t 60
------------------------------------------------------------
Client connecting to 192.168.2.65, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.101 port 40898 connected with 192.168.2.65 port 500
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-60.0 sec    100 MBytes  14.0 Mbits/sec
在pc端經過60s之後,打印最終log如下:
luther@gliethttp:~$ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.2.65 port 5001 connected with 192.168.2.101 port 51692
[  4]  0.0-10.1 sec  16.5 MBytes  13.8 Mbits/sec
[  5] local 192.168.2.65 port 5001 connected with 192.168.2.101 port 51693
[  5]  0.0-60.1 sec  71.4 MBytes  9.97 Mbits/sec
[  4] local 192.168.2.65 port 5001 connected with 192.168.2.101 port 51694
[  4]  0.0-10.0 sec  16.2 MBytes  13.6 Mbits/sec
[  5] local 192.168.2.65 port 5001 connected with 192.168.2.101 port 40898
[  5]  0.0-60.1 sec    100 MBytes  14.0 Mbits/sec
[  5] local 192.168.2.65 port 5001 connected with 192.168.2.101 port 34409
[  5]  0.0-60.1 sec    102 MBytes  14.2 Mbits/sec

 

 

轉自【http://blog.chinaunix.net/u1/38994/showart_1665678.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章