Android移植之iperf

 

<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:黑体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimHei; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:1 135135232 16 0 262144 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@黑体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:1 135135232 16 0 262144 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} h1 {mso-style-next:正文; margin-top:17.0pt; margin-right:0cm; margin-bottom:16.5pt; margin-left:0cm; text-align:justify; text-justify:inter-ideograph; line-height:240%; mso-pagination:lines-together; page-break-after:avoid; mso-outline-level:1; font-size:22.0pt; font-family:"Times New Roman"; mso-font-kerning:22.0pt;} h2 {mso-style-next:正文; margin-top:13.0pt; margin-right:0cm; margin-bottom:13.0pt; margin-left:0cm; text-align:justify; text-justify:inter-ideograph; line-height:173%; mso-pagination:lines-together; page-break-after:avoid; mso-outline-level:2; font-size:16.0pt; font-family:Arial; mso-fareast-font-family:黑体; mso-bidi-font-family:"Times New Roman"; mso-font-kerning:1.0pt;} h3 {mso-style-next:正文; margin-top:13.0pt; margin-right:0cm; margin-bottom:13.0pt; margin-left:0cm; text-align:justify; text-justify:inter-ideograph; line-height:173%; mso-pagination:lines-together; page-break-after:avoid; mso-outline-level:3; font-size:16.0pt; font-family:"Times New Roman"; mso-font-kerning:1.0pt;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:15.6pt;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1400710771; mso-list-type:hybrid; mso-list-template-ids:-1600998460 -319549310 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-start-at:2; mso-level-tab-stop:29.25pt; mso-level-number-position:left; margin-left:29.25pt; text-indent:-29.25pt;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} -->

                                   Android 移植之 iperf

1 .移植准备

       1 ,源代码地址:

     http://sourceforge.net/projects/iperf/files/iperf/2.0.4%20source/iperf-2.0.4.tar.gz/download    下载 iperf-2.0.4.tar.gz ,并放到 Adroid_root/external

2 ,解压到 Adroid_root/external/ iperf-2.0.4.tar.gz;

       tar –zxvf iperf-2.0.4.tar.gz

2.           创建 Android.mk

       cat Android.mk

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

 

LOCAL_SRC_FILES := /

compat/Thread.c /

compat/error.c /

compat/delay.cpp /

compat/gettimeofday.c /

compat/inet_ntop.c /

compat/inet_pton.c /

compat/signal.c /

compat/snprintf.c /

compat/string.c

 

LOCAL_SRC_FILES += /

src/Client.cpp /

src/Extractor.c /

src/Launch.cpp /

src/List.cpp /

src/Listener.cpp /

src/Locale.c /

src/PerfSocket.cpp /

src/ReportCSV.c /

src/ReportDefault.c /

src/Reporter.c /

src/Server.cpp /

src/Settings.cpp /

src/SocketAddr.c /

src/main.cpp /

src/sockets.c /

src/stdio.c /

src/tcp_window_size.c /

src/gnu_getopt.c /

src/gnu_getopt_long.c /

src/service.c

 

 

LOCAL_C_INCLUDES += /

$(LOCAL_PATH) /

$(LOCAL_PATH)/include

 

 

LOCAL_CFLAGS += -O2

 

LOCAL_CFLAGS += -DHAVE_CONFIG_H

 

 

 

LOCAL_LDLIBS += -lpthread

 

 

 

LOCAL_SHARED_LIBRARIES := libc libm libcutils libnetutils

 

 

 

LOCAL_MODULE := iperf

 

 

 

#LOCAL_FORCE_STATIC_EXECUTABLE := true

 

LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)

 

#LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)

 

#LOCAL_MODULE_TAGS := eng user

 

 

 

include $(BUILD_EXECUTABLE)

3.            先生成需要的头文件

       ./configure –host=arm

4.            代码修改

external/testtools/iperf/src/Listener.cpp:382 行改成:

mreq.ipv6mr_ifindex = 0;

compact/signal.c 里面的 #include "util.h"

改成 #include   “../include/util.h”

src/sockets.c 里面的 #include "util.h"

改成 #include  “../include/util.h”

 

5.         编译

$cd Adroid_root

$source build/envsetup.sh

$mmm external/iperf-2.0.4

 

6.         目标文件

         Android_root/build/out/target/product/generic/symbols/system/bin/ 目录下就可以看到你刚才编译生成的文件了;这个目录里的文件是带符号信息的,方便调试;

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
资源里包括windows的iperf.exe、android系统安装的iperf.apk和iperf使用说明参数等内容。 Iperf是一个网络性能测试工具。可以测试TCP和UDP带宽质量,可以测量最大TCP带宽,具有多种参数和UDP特性,可以报告带宽,延迟抖动和数据包丢失。 Iperf使用方法与参数说明 参数说明 -s 以server模式启动,eg:iperf -s -c host以client模式启动,host是server端地址,eg:iperf -c 222.35.11.23 通用参数 -f [kmKM] 分别表示以Kbits, Mbits, KBytes, MBytes显示报告,默认以Mbits为单位,eg:iperf -c 222.35.11.23 -f K -i sec 以秒为单位显示报告间隔,eg:iperf -c 222.35.11.23 -i 2 -l 缓冲区大小,默认是8KB,eg:iperf -c 222.35.11.23 -l 16 -m 显示tcp最大mtu值 -o 将报告和错误信息输出到文件eg:iperf -c 222.35.11.23 -o ciperflog.txt -p 指定服务器端使用的端口或客户端所连接的端口eg:iperf -s -p 9999;iperf -c 222.35.11.23 -p 9999 -u 使用udp协议 -w 指定TCP窗口大小,默认是8KB -B 绑定一个主机地址或接口(当主机有多个地址或接口时使用该参数) -C 兼容旧版本(当server端和client端版本不一样时使用) -M 设定TCP数据包的最大mtu值 -N 设定TCP不延时 -V 传输ipv6数据包 server专用参数 -D 以服务方式运行iperf,eg:iperf -s -D -R 停止iperf服务,针对-D,eg:iperf -s -R client端专用参数 -d 同时进行双向传输测试 -n 指定传输的字节数,eg:iperf -c 222.35.11.23 -n 100000 -r 单独进行双向传输测试 -t 测试时间,默认10秒,eg:iperf -c 222.35.11.23 -t 5 -F 指定需要传输的文件 -T 指定ttl值
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值