Wireless Special Test--Traffic Test (Part 1)

For traffic testing, we must first understand what traffic is?

Traffic refers to the traffic data generated by the mobile phone surfing the Internet. When the mobile phone is used to open software or perform Internet operations, data will be exchanged with the server. The mobile phone traffic refers to the size of this data. Our collection accesses the Internet through the operator's network, and the operator forwards data packets for our mobile phones. The total size (bytes) of the data packets is the traffic, and the data packets here include the uplink and downlink packets of the mobile phone. Since data packets are transmitted using the IP protocol, the traffic calculated by the operator is generally the size of the data packet including the IP header.

We use the TCP send and receive length statistics function provided by Android itself

 Generally, the communication between the APP and the background server is based on TCP, so we can use this statistic to test the traffic of our APP, and the statistical function provided by Android is based on the APP latitude, and there is no need to prohibit the connection of other apps. network permissions.

 

The operation steps are as follows:

 

1) Use the ps command to view the uid of the app under test, take the Jingdong app as an example, adb shell ps | findstr jd

 

All Android application processes start with u0_a. The UID of Android applications starts from 10000 and ends at 19999, which can be viewed in Process.java (FIRST_APPLICATION_UID and LAST_APPLICATION_UID). The number after u0_a is the UID value of the application minus the value The value obtained by FIRST_APPLICATION_UID, so, for com.jingdong.app, its user is u0_a332, according to the previous regulations, its UID is 332 + FIRST_APPLICATION_UID = 10332. So Jingdong's uid is 10000+332=10332. If you are worried about this uid, you can also enter the directory to view

 

  

2) After obtaining the uid of the app, enter the /proc/uid_stat/10332 directory, and cat obtains the initial values ​​of the current tcp_snd and tcp_tcv

 

 

3) At this point, the test can be started. After opening the APP, click the module to be tested, enter the tab column, and obtain the values ​​of tcp_snd and tcp_tcv again after the test is completed.

 

 

 

4) Flow calculation within the measured time

Send traffic: tcp_snd_new-tcp_snd_old=2636783-2573939=62844bytes

Receive traffic: tcp_rcv_new-tcp_rcv_old=117147054-114987186=2159868bytes

This method has no distinction of other dimensions, only statistical total data, I will use other methods to test traffic next time, to be continued...

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325321821&siteId=291194637