最近项目需要测试wifi的功能。Linux下的iperf很好用,但是在Android下面是没有这个工具的。所以自己就移植了一个。
源码大概如下:
源码目录
Android.mk 文件内容如下:

ifneq ($(TARGET_SIMULATOR),true)

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
IPERF_SOURCES:= compat/snprintf.c compat/string.c compat/inet_pton.c compat/signal.c\
 compat/error.c compat/gettimeofday.c compat/Thread.c\
 compat/inet_ntop.c src/ReportCSV.c src/tcp_window_size.c\
 src/gnu_getopt.c src/stdio.c src/sockets.c src/SocketAddr.c src/ReportDefault.c\
 src/Locale.c src/gnu_getopt_long.c src/service.c src/Reporter.c src/Extractor.c\
 compat/delay.cpp src/Listener.cpp src/Server.cpp src/List.cpp src/Launch.cpp src/Settings.cpp\
 src/PerfSocket.cpp src/main.cpp src/Client.cpp

#LOCAL_CFLAGS := -O2 -g

LOCAL_MODULE := iperf

LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)

LOCAL_SRC_FILES:= $(IPERF_SOURCES)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include

LOCAL_CFLAGS := -DHAVE_CONFIG_H


LOCAL_MODULE_TAGS := debug


include $(BUILD_EXECUTABLE)


endif  # TARGET_SIMULATOR != true

直接通过命令编译

./mk -t mt6735 mm  packages/iperf/andro-iperf/iperf-2.0.5/

生成 iperf 文件
这里写图片描述
测试可以正常使用。有空再把源码和编译的iperf可执行文件传上去
https://download.csdn.net/download/lb5761311/10107972

Logo

更多推荐