Reprinted from: http://blog.sina.com.cn/s/blog_628cc2b70101dbyy.html
First, view principle: The network traffic data of an application is saved in/proc/uid_stat/$UID/TCP_RCV file of the system.
Second, step:
(1) Get PID of the current application: View the current app's process ID through the PS command, such as the Application Center is Ps|grep AppStore, get a value of 10928
(2) Obtain the UID of the current application: Enter the directory/proc/$PID, view the status file UID value, such as the view of the Application Center, CD/PROC/10928,CAT status, get the value of 10006
(3) View the cumulative value of the app's received data: Go to the catalog/proc/uid_stat/$UID and view TCP_RCV values, such as how the app Center is viewed, Cd/proc/uid_stat/10006,cat TCP_RCV.
(4) View the current application per second of traffic values: through a second interval to print two times TCP_RCV value of the calculation of the difference obtained, the value obtained by automated means is more accurate.
[Android Memory] How to view an app's current traffic in an Android system