There is a hidden class in Android framework called NetworkStats:
/**
* Collection of active network statistics. Can contain summary details across
* all interfaces, or details with per-UID granularity. Internally stores data
* as a large table, closely matching {@code /proc/} data format. This structure
* optimizes for rapid in-memory comparison, but consider using
* {@link NetworkStatsHistory} when persisting.
*
* @hide
*/
public class NetworkStats implements Parcelable
And it has a method called
/**
* Return total statistics grouped by {@link #iface}; doesn't mutate the
* original structure.
*/
public NetworkStats groupedByIface()
And I suppose this method will fulfill your requirement. You might need to refer to the source code and to see if you can extract the useful information for your own purpose.
https://android.googlesource.com/platform/frameworks/base/+/android-4.3_r2.3/core/java/android/net/NetworkStats.java