NetworkStats: apply464xlatAdjustments - remove useBpfStats parameter. am: d09cef39c5
Change-Id: Ibaee70f31f27f7457bd8524d4ab62bc76fff5dea
This commit is contained in:
committed by
Automerger Merge Worker
commit
8e9b58f395
@@ -1069,11 +1069,10 @@ public final class NetworkStats implements Parcelable {
|
||||
* @param baseTraffic Traffic on the base interfaces. Will be mutated.
|
||||
* @param stackedTraffic Stats with traffic stacked on top of our ifaces. Will also be mutated.
|
||||
* @param stackedIfaces Mapping ipv6if -> ipv4if interface where traffic is counted on both.
|
||||
* @param useBpfStats True if eBPF is in use.
|
||||
* @hide
|
||||
*/
|
||||
public static void apply464xlatAdjustments(NetworkStats baseTraffic,
|
||||
NetworkStats stackedTraffic, Map<String, String> stackedIfaces, boolean useBpfStats) {
|
||||
NetworkStats stackedTraffic, Map<String, String> stackedIfaces) {
|
||||
// For recycling
|
||||
Entry entry = null;
|
||||
for (int i = 0; i < stackedTraffic.size; i++) {
|
||||
@@ -1113,8 +1112,8 @@ public final class NetworkStats implements Parcelable {
|
||||
* @param stackedIfaces Mapping ipv6if -> ipv4if interface where traffic is counted on both.
|
||||
* @hide
|
||||
*/
|
||||
public void apply464xlatAdjustments(Map<String, String> stackedIfaces, boolean useBpfStats) {
|
||||
apply464xlatAdjustments(this, this, stackedIfaces, useBpfStats);
|
||||
public void apply464xlatAdjustments(Map<String, String> stackedIfaces) {
|
||||
apply464xlatAdjustments(this, this, stackedIfaces);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -152,12 +152,10 @@ public class NetworkStatsFactory {
|
||||
|
||||
/**
|
||||
* Applies 464xlat adjustments with ifaces noted with {@link #noteStackedIface(String, String)}.
|
||||
* @see NetworkStats#apply464xlatAdjustments(NetworkStats, NetworkStats, Map, boolean)
|
||||
* @see NetworkStats#apply464xlatAdjustments(NetworkStats, NetworkStats, Map)
|
||||
*/
|
||||
public void apply464xlatAdjustments(NetworkStats baseTraffic,
|
||||
NetworkStats stackedTraffic, boolean useBpfStats) {
|
||||
NetworkStats.apply464xlatAdjustments(baseTraffic, stackedTraffic, mStackedIfaces,
|
||||
useBpfStats);
|
||||
public void apply464xlatAdjustments(NetworkStats baseTraffic, NetworkStats stackedTraffic) {
|
||||
NetworkStats.apply464xlatAdjustments(baseTraffic, stackedTraffic, mStackedIfaces);
|
||||
}
|
||||
|
||||
public NetworkStatsFactory() {
|
||||
@@ -380,7 +378,7 @@ public class NetworkStatsFactory {
|
||||
// network, the overhead is their fault.
|
||||
// No locking here: apply464xlatAdjustments behaves fine with an add-only
|
||||
// ConcurrentHashMap.
|
||||
delta.apply464xlatAdjustments(mStackedIfaces, mUseBpfStats);
|
||||
delta.apply464xlatAdjustments(mStackedIfaces);
|
||||
|
||||
// Migrate data usage over a VPN to the TUN network.
|
||||
for (VpnInfo info : vpnArray) {
|
||||
|
||||
@@ -1882,14 +1882,13 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
// fold tethering stats and operations into uid snapshot
|
||||
final NetworkStats tetherSnapshot = getNetworkStatsTethering(STATS_PER_UID);
|
||||
tetherSnapshot.filter(UID_ALL, ifaces, TAG_ALL);
|
||||
mStatsFactory.apply464xlatAdjustments(uidSnapshot, tetherSnapshot,
|
||||
mUseBpfTrafficStats);
|
||||
mStatsFactory.apply464xlatAdjustments(uidSnapshot, tetherSnapshot);
|
||||
uidSnapshot.combineAllValues(tetherSnapshot);
|
||||
|
||||
// get a stale copy of uid stats snapshot provided by providers.
|
||||
final NetworkStats providerStats = getNetworkStatsFromProviders(STATS_PER_UID);
|
||||
providerStats.filter(UID_ALL, ifaces, TAG_ALL);
|
||||
mStatsFactory.apply464xlatAdjustments(uidSnapshot, providerStats, mUseBpfTrafficStats);
|
||||
mStatsFactory.apply464xlatAdjustments(uidSnapshot, providerStats);
|
||||
uidSnapshot.combineAllValues(providerStats);
|
||||
|
||||
uidSnapshot.combineAllValues(mUidOperations);
|
||||
|
||||
@@ -926,21 +926,14 @@ public class NetworkStatsTest {
|
||||
3 /* txPackets */,
|
||||
0 /* operations */);
|
||||
|
||||
final NetworkStats statsXt = new NetworkStats(TEST_START, 3)
|
||||
final NetworkStats stats = new NetworkStats(TEST_START, 3)
|
||||
.insertEntry(appEntry)
|
||||
.insertEntry(rootUidEntry)
|
||||
.insertEntry(otherEntry);
|
||||
|
||||
final NetworkStats statsEbpf = new NetworkStats(TEST_START, 3)
|
||||
.insertEntry(appEntry)
|
||||
.insertEntry(rootUidEntry)
|
||||
.insertEntry(otherEntry);
|
||||
stats.apply464xlatAdjustments(stackedIface);
|
||||
|
||||
statsXt.apply464xlatAdjustments(stackedIface, false);
|
||||
statsEbpf.apply464xlatAdjustments(stackedIface, true);
|
||||
|
||||
assertEquals(3, statsXt.size());
|
||||
assertEquals(3, statsEbpf.size());
|
||||
assertEquals(3, stats.size());
|
||||
final NetworkStats.Entry expectedAppUid = new NetworkStats.Entry(
|
||||
v4Iface, appUid, SET_DEFAULT, TAG_NONE,
|
||||
30949510,
|
||||
@@ -955,12 +948,9 @@ public class NetworkStatsTest {
|
||||
17607,
|
||||
97,
|
||||
0);
|
||||
assertEquals(expectedAppUid, statsXt.getValues(0, null));
|
||||
assertEquals(expectedRootUid, statsXt.getValues(1, null));
|
||||
assertEquals(otherEntry, statsXt.getValues(2, null));
|
||||
assertEquals(expectedAppUid, statsEbpf.getValues(0, null));
|
||||
assertEquals(expectedRootUid, statsEbpf.getValues(1, null));
|
||||
assertEquals(otherEntry, statsEbpf.getValues(2, null));
|
||||
assertEquals(expectedAppUid, stats.getValues(0, null));
|
||||
assertEquals(expectedRootUid, stats.getValues(1, null));
|
||||
assertEquals(otherEntry, stats.getValues(2, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -985,7 +975,7 @@ public class NetworkStatsTest {
|
||||
.insertEntry(secondEntry);
|
||||
|
||||
// Empty map: no adjustment
|
||||
stats.apply464xlatAdjustments(new ArrayMap<>(), false);
|
||||
stats.apply464xlatAdjustments(new ArrayMap<>());
|
||||
|
||||
assertEquals(2, stats.size());
|
||||
assertEquals(firstEntry, stats.getValues(0, null));
|
||||
|
||||
Reference in New Issue
Block a user