@@ -89,18 +89,27 @@ void reportStats(NetworkStats stats) {
8989 Bundle result = new Bundle ();
9090 long rxBytes = 0 ;
9191 long txBytes = 0 ;
92+ long rxPackets = 0 ;
93+ long txPackets = 0 ;
9294 for (int i = 0 ; i < stats .size (); ++i ) {
9395 // Label will be iface_uid_tag_set
9496 Entry statsEntry = stats .getValues (i , null );
97+ // Debugging use.
98+ /*
9599 String labelTemplate = String.format("%s_%d_%d_%d", statsEntry.iface, statsEntry.uid,
96100 statsEntry.tag, statsEntry.set) + "_%s";
97101 result.putLong(String.format(labelTemplate, "rxBytes"), statsEntry.rxBytes);
98102 result.putLong(String.format(labelTemplate, "txBytes"), statsEntry.txBytes);
103+ */
104+ rxPackets += statsEntry .rxPackets ;
99105 rxBytes += statsEntry .rxBytes ;
106+ txPackets += statsEntry .txPackets ;
100107 txBytes += statsEntry .txBytes ;
101108 }
102- result .putLong ("Total rxBytes" , rxBytes );
103- result .putLong ("Total txBytes" , txBytes );
109+ result .putLong ("Total rx Bytes" , rxBytes );
110+ result .putLong ("Total tx Bytes" , txBytes );
111+ result .putLong ("Total rx Packets" , rxPackets );
112+ result .putLong ("Total tx Packets" , txPackets );
104113 getInstrumentation ().sendStatus (INSTRUMENTATION_IN_PROGRESS , result );
105114
106115 }
0 commit comments