码迷,mamicode.com
首页 > 数据库 > 详细

网络流量统计using ADB

时间:2017-12-02 12:58:42      阅读:232      评论:0      收藏:0      [点我收藏+]

标签:tcp   操作   udp   网络流   height   strong   alt   bytes   lan   

/proc/net/xt_qtaguid/stats 基本覆盖目前所有机型且统计流量全面

adb shell cat /proc/net/xt_qtaguid/stats | grep (uid#)

如: adb shell cat /proc/net/xt_qtaguid/stats | grep 10127

48 wlan0 0x0 10127 0 316574 2279 472562 3651 316574 2279 0 0 0 0 472562 3651 0 0 0 0

49 wlan0 0x0 10127 1 6172960 4936 415951 5215 6172960 4936 0 0 0 0 415951 5215 0 0 0 0

50 wlan0 0x3792d5b400000000 10127 0 29678 208 32168 296 29678 208 0 0 0 0 32168 296 0 0 0 0

51 wlan0 0x3792d5b400000000 10127 1 226170 222 25745 265 226170 222 0 0 0 0 25745 265 0 0 0 0

56 wlan0 0xfa1dcc4b00000000 10127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

57 wlan0 0xfa1dcc4b00000000 10127 1 3014885 2127 139857 2117 3014885 2127 0 0 0 0 139857 2117 0 0 0 0

其中第6和8列为 rx_bytes(接收数据)和tx_bytes(传输数据)包含tcp,udp等所有网络流量传输的统计。

 

具体操作方式:

1、找出pid,然后cat /proc/#PID/status | grep uid,找到对应的uid

技术分享图片

技术分享图片

2.cat /proc/net/xt_qtaguid/stats | grep 10082

技术分享图片

一个UID可能对应多个进程,把数据累加起来就行

 

 

 

网络流量统计using ADB

标签:tcp   操作   udp   网络流   height   strong   alt   bytes   lan   

原文地址:http://www.cnblogs.com/mgzc-1508873480/p/7953749.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!