其他分享
首页 > 其他分享> > 原创|批处理实现MicroUSB传输速度测试工具

原创|批处理实现MicroUSB传输速度测试工具

作者:互联网

批处理实现MicroUSB传输速度测试工具

作用


        用于安卓系统自动重启压力测试,可以自动生成重启运行日志和计算重启时间

文末可免费下载完整版源码文件


使用方法


        将以下代码复制后,保存为*.bat批处理文件即可执行;或者新建一个记事本文件,将复制的代码粘贴进去,然后将文件名后缀改为*.bat,双击即可执行;

代码

@ECHO off

set str=microUSB传输速度测试_V1.0_2018.03.20 By HRD
set TestFile=test.mp4

set androidPath=/sdcard/.

title %str%
echo =============================================================================
echo.
echo                     %str%
echo.
echo =============================================================================

:start
color 1f
if exist .\*.log del /f /q .\*.log
if not exist %TestFile% goto noTestFile
echo.
echo 待测试的文件为: “%TestFile%”...
echo.
echo 等待安卓设备插入...
echo.
echo wait-for-device
echo.
adb wait-for-device
echo Start...
echo.
adb root
ping -n 1 172.0.0.1>nul
echo.
adb remount
adb remount
echo.
echo %date% %time% [INFO] ==============================================================================
echo %date% %time% [INFO] ==============================================================================
echo %date% %time% [INFO] ==============================================================================
echo.
echo %date% %time% [INFO] 开始执行测试...
echo.
echo %date% %time% [INFO] 正在尝试将 “%TestFile%” 复制到安卓设备,将循环执行 5 次...
echo.
echo %date% %time% [INFO] ========================正在执行第 1 次复制动作,请稍候========================
adb push -p %TestFile% %androidPath%
echo.

echo %date% %time% [INFO] ========================正在执行第 2 次复制动作,请稍候========================
adb push -p %TestFile% %androidPath%
echo.

echo %date% %time% [INFO] ========================正在执行第 3 次复制动作,请稍候========================
adb push -p %TestFile% %androidPath%
echo.

echo %date% %time% [INFO] ========================正在执行第 4 次复制动作,请稍候========================
adb push -p %TestFile% %androidPath%
echo.

echo %date% %time% [INFO] ========================正在执行第 5 次复制动作,请稍候========================
adb push -p %TestFile% %androidPath%
echo.

echo %date% %time% [INFO] ==============================================================================
echo %date% %time% [INFO] ==============================================================================
echo %date% %time% [INFO] ==============================================================================
adb shell sleep 1

echo.
echo %date% %time% [INFO] 正在尝试从安卓设备将 “%TestFile%” 复制到PC,将循环执行 5 次...
echo.
echo %date% %time% [INFO] ========================正在执行第 1 次复制动作,请稍候========================
adb pull -p /sdcard/%TestFile% .\testCopy.mp4
echo.

echo %date% %time% [INFO] ========================正在执行第 2 次复制动作,请稍候========================
adb pull -p /sdcard/%TestFile% .\testCopy.mp4
echo.

echo %date% %time% [INFO] ========================正在执行第 3 次复制动作,请稍候========================
adb pull -p /sdcard/%TestFile% .\testCopy.mp4
echo.

echo %date% %time% [INFO] ========================正在执行第 4 次复制动作,请稍候========================
adb pull -p /sdcard/%TestFile% .\testCopy.mp4
echo.

echo %date% %time% [INFO] ========================正在执行第 5 次复制动作,请稍候========================
adb pull -p /sdcard/%TestFile% .\testCopy.mp4
echo.


color 2f
echo 测试动作执行完毕,请查看测试结果...
if exist  .\testCopy.mp4 del /f /q  .\testCopy.mp4
pause

goto :eof



:noTestFile
color cf
echo.
echo 未发现测试文件“%TestFile%”,无法进行测试,请确认后再进行测试...
echo.
echo 按任意键重试...
pause
goto start




















运行截图

 
运行日志

 

=============================================================================

                    microUSB传输速度测试_V1.0_20180320 By HRD

=============================================================================

待测试的文件为: “test.mp4”...

等待安卓设备插入...

wait-for-device

Start...


remount succeeded
remount succeeded

2018-05-03 17:07:37.18 [INFO] ==============================================================================
2018-05-03 17:07:37.18 [INFO] ==============================================================================
2018-05-03 17:07:37.18 [INFO] ==============================================================================

2018-05-03 17:07:37.18 [INFO] 开始执行测试...

2018-05-03 17:07:37.19 [INFO] 正在尝试将 “test.mp4” 复制到安卓设备,将循环执行 5 次...

2018-05-03 17:07:37.19 [INFO] ========================正在执行第 1 次复制动作,请稍候========================
test.mp4: 1 file pushed. 8.2 MB/s (153114185 bytes in 17.768s)

2018-05-03 17:07:55.03 [INFO] ========================正在执行第 2 次复制动作,请稍候========================
test.mp4: 1 file pushed. 8.2 MB/s (153114185 bytes in 17.776s)

2018-05-03 17:08:12.91 [INFO] ========================正在执行第 3 次复制动作,请稍候========================
test.mp4: 1 file pushed. 8.1 MB/s (153114185 bytes in 17.943s)

2018-05-03 17:08:30.94 [INFO] ========================正在执行第 4 次复制动作,请稍候========================
test.mp4: 1 file pushed. 8.4 MB/s (153114185 bytes in 17.411s)

2018-05-03 17:08:48.43 [INFO] ========================正在执行第 5 次复制动作,请稍候========================
test.mp4: 1 file pushed. 8.2 MB/s (153114185 bytes in 17.792s)

2018-05-03 17:09:06.31 [INFO] ==============================================================================
2018-05-03 17:09:06.32 [INFO] ==============================================================================
2018-05-03 17:09:06.32 [INFO] ==============================================================================

2018-05-03 17:09:07.68 [INFO] 正在尝试从安卓设备将 “test.mp4” 复制到PC,将循环执行 5 次...

2018-05-03 17:09:07.69 [INFO] ========================正在执行第 1 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 10.8 MB/s (153114185 bytes in 13.540s)

2018-05-03 17:09:21.31 [INFO] ========================正在执行第 2 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 11.9 MB/s (153114185 bytes in 12.287s)

2018-05-03 17:09:33.69 [INFO] ========================正在执行第 3 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 11.9 MB/s (153114185 bytes in 12.242s)

2018-05-03 17:09:46.02 [INFO] ========================正在执行第 4 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 12.0 MB/s (153114185 bytes in 12.154s)

2018-05-03 17:09:58.25 [INFO] ========================正在执行第 5 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 11.8 MB/s (153114185 bytes in 12.354s)

测试动作执行完毕,请查看测试结果...
请按任意键继续. . .


2018-05-03 17:10:47.66 [INFO] ==============================================================================
2018-05-03 17:10:47.66 [INFO] ==============================================================================
2018-05-03 17:10:47.66 [INFO] ==============================================================================

2018-05-03 17:10:47.67 [INFO] 开始执行测试...

2018-05-03 17:10:47.67 [INFO] 正在尝试将 “test.mp4” 复制到安卓设备,将循环执行 5 次...

2018-05-03 17:10:47.67 [INFO] ========================正在执行第 1 次复制动作,请稍候========================
test.mp4: 1 file pushed. 7.8 MB/s (153114185 bytes in 18.725s)

2018-05-03 17:11:06.47 [INFO] ========================正在执行第 2 次复制动作,请稍候========================
test.mp4: 1 file pushed. 8.1 MB/s (153114185 bytes in 17.932s)

2018-05-03 17:11:24.49 [INFO] ========================正在执行第 3 次复制动作,请稍候========================
test.mp4: 1 file pushed. 8.0 MB/s (153114185 bytes in 18.160s)

2018-05-03 17:11:42.75 [INFO] ========================正在执行第 4 次复制动作,请稍候========================
test.mp4: 1 file pushed. 8.1 MB/s (153114185 bytes in 17.957s)

2018-05-03 17:12:00.80 [INFO] ========================正在执行第 5 次复制动作,请稍候========================
test.mp4: 1 file pushed. 8.1 MB/s (153114185 bytes in 17.935s)

2018-05-03 17:12:18.84 [INFO] ==============================================================================
2018-05-03 17:12:18.84 [INFO] ==============================================================================
2018-05-03 17:12:18.84 [INFO] ==============================================================================

2018-05-03 17:12:19.98 [INFO] 正在尝试从安卓设备将 “test.mp4” 复制到PC,将循环执行 5 次...

2018-05-03 17:12:19.99 [INFO] ========================正在执行第 1 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 12.0 MB/s (153114185 bytes in 12.205s)

2018-05-03 17:12:32.28 [INFO] ========================正在执行第 2 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 11.9 MB/s (153114185 bytes in 12.227s)

2018-05-03 17:12:44.60 [INFO] ========================正在执行第 3 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 12.1 MB/s (153114185 bytes in 12.117s)

2018-05-03 17:12:56.81 [INFO] ========================正在执行第 4 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 12.2 MB/s (153114185 bytes in 11.976s)

2018-05-03 17:13:08.87 [INFO] ========================正在执行第 5 次复制动作,请稍候========================
/sdcard/test.mp4: 1 file pulled. 12.1 MB/s (153114185 bytes in 12.076s)

测试动作执行完毕,请查看测试结果...
请按任意键继续. . .

今日美图

 

 

 

 

 

完整源码下载地址

链接:https://pan.baidu.com/s/1kPm2faE93B8OTndEVDM1XQ 
提取码:sc3r

标签:INFO,03,17,05,echo,传输速度,MicroUSB,2018,测试工具
来源: https://blog.csdn.net/zh6526157/article/details/121658193