弱网测试原理与方法(二)-使用虚拟机模拟网络速率


通过虚拟机设置不同的网络速率,来测试不同网络类型下应用的反应。

 

虚拟机允许模拟各种网络传输比率,可以在虚拟机启动时设置传输比率范围。在虚拟机启动时设置网络速率,使用-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官方网站



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