首页 > 技术文章 > 网络流量统计using ADB

mgzc-1508873480 2017-12-02 11:26 原文

/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可能对应多个进程,把数据累加起来就行

 

 

 

推荐阅读