通過虛擬機設置不同的網絡速率,來測試不同網絡類型下應用的反應。
虛擬機允許模擬各種網絡傳輸比率,可以在虛擬機啓動時設置傳輸比率範圍。在虛擬機啓動時設置網絡速率,使用-netspeed選擇項與<speed>值,使用-netdelay設置網絡延遲的值。
命令如下:
emulator –avd avdName–port avdport –netspeed <speed> -netdelay <delay >
To make changes to network speed while the emulator isrunning, connect to the console and use the netspeed
command
with asupported <speed>
value from the table below
更改網絡速度在模擬器運行時,連接到控制檯,使用netspeed命令支持從下表<速度值>
netspeed <speed> :上行/下載速率
|
||
Value |
Description |
Comments |
gsm |
GSM/CSD |
(Up: 14.4, down: 14.4) |
hscsd |
HSCSD |
(Up: 14.4, down: 43.2) |
gprs |
GPRS |
(Up: 40.0, down: 80.0) |
edge |
EDGE/EGPRS |
(Up: 118.4, down: 236.8) |
umts |
UMTS/3G |
(Up: 128.0, down: 1920.0) |
hsdpa |
HSDPA |
(Up: 348.0, down: 14400.0) |
full |
no limit |
(Up: 0.0, down: 0.0) |
<num> |
Set an exact rate used for both upload and download. |
|
<up>:<down> |
Set exact rates for upload and download separately. |
To make changes to network delay while the emulator isrunning, connect to the console and use the netdelay command with asupported <delay> value from the table below.
更改網絡延遲在模擬器運行時,連接到控制檯,使用netdelay命令支持從下表<延遲>價值。
netdelay <delay>:延遲速度,單位爲毫秒
Value |
Description |
Comments |
gprs |
GPRS |
(min 150, max 550) |
edge |
EDGE/EGPRS |
(min 80, max 400) |
umts |
UMTS/3G |
(min 35, max 200) |
none |
No latency |
(min 0, max 0) |
<num> |
Emulate an exact latency (milliseconds). |
|
<min>:<max> |
Emulate an specified latency range (min, max milliseconds). |
|
命令如下:
emulator –avd avdName–port avdport –netspeed gsm -netdelay gprs
:該模擬器上傳下載速率爲gsm的值,延遲時間爲gprs的值
可以寫多條命令來對比不同速率傳輸應用程序的響應區別
數據來源於android官方網站