Use new NetworkStats#addEntries API
Currently, NetworkStats#addEntry creates a new instance containing the requested result instead of mutating the original object. This creates a heavy memory footprint when the caller invokes it in a loop because a new NetworkStats instance is created whenever an addEntry is called. This is a no-op change except it utilizes the newly created API to add a list of entries at once. This approach only clones the instance once, thereby reducing the required memory footprint. Test: atest CtsStatsdAtomHostTestCases:android.cts.statsdatom.net.BytesTransferredTest Test: adb shell cmd stats pull-source 10000 Test: atest FrameworksServicesTests:com.android.server.stats.pull.netstats.NetworkStatsUtilsTest Flag: com.android.server.stats.netstats_use_add_entries Bug: 335680025 Change-Id: I1b8195d1cacc53e6dc77f154ac1a8108a0220c5b
Loading
Please register or sign in to comment