android统计单个应用的流量,在Android中,如何测量每个应用程序的每个界面的数据流量...

我想实现一个扩展

android.net.TrafficStats来测量每个APN或每个APN每个应用程序的数据流量.方法原型如下所示:

getInterfaceTxPackets(String interface)

getInterfaceRxPackets(String interface)

getInterfaceTxBytes(String interface)

getInterfaceRxBytes(String interface)

getUidInterfaceTxPackets(int uid,String interface)

getUidInterfaceRxPackets(int uid,String interface)

getUidInterfaceTxBytes(int uid,String interface)

getUidInterfaceRxBytes(int uid,String interface)

我读了android.net.TrafficStats.java,它在android_net_TrafficStats.cpp中调用native方法,本机方法从某些文件读取流量统计信息:

>总流量统计文件在文件夹/ sys / class / net /中,在此文件夹中有一些子文件夹,如:eth0,ip6tnl0,rmnet0,rmnet1,rmnet2,rmnet3,详细的统计文件保存在这些文件夹中.

>每个应用程序流量统计文件在/ proc / uid_stat / [uid] /

我的问题:

>文件夹rmnet0,rmnet1,rmnet2,rmnet3 …匹配每个APN?如果是,匹配规则是什么?如果没有,我如何获得每个APN流量统计?

>在文件夹/ p​​roc / uid_stat / [uid] /中,只有两个文件:tcp_rcv和tcp_snd,如何获取每个APN流量统计信息的每个应用?

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值