Take non-incremental network stats from bpf maps
Use two maps to record the details of network stats. Swap and clean up after system server pulls the stats. The TAG_STATS_MAP is removed since we don't need to worry about losing the stats for each uid if the eBPF map is full. All the stats can be stored in the same map now and it is very unlikely to overflow the map before system server scrapes the stats and clean it up. Add a benchmark test to measure the performance of creating and closing pf_key socket. A typical result is: ------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------ BpfBenchMark/WaitForRcu/1 86615 ns 54858 ns 20209 Bug: 79171384 Test: dumpsys netd trafficcontroller NetworkUsageStatsTest Change-Id: Ic79e382f51bf21eee78c4cac5a8a97edaf3654cd
Loading
Please register or sign in to comment