title: Tracking an application's network statistics (netstats) using ADB
body: <p>I have a feeling this is possible, I'm just not quite sure where the information is held.</p>
  
  <p>I want to get the up/down statistics for specific applications, but I want to do it using ADB and not wireshark or netty. </p>
  
  <p>I know I can see the vmData using </p>
  
  <pre><code>adb shell
  cd proc
  cd pid#
  cat status 
  </code></pre>
  
  <p>and I know I can see the netstats using: </p>
  
  <pre><code>ADB Shell dumpsys netstats details full
  </code></pre>
  
  <p>which gives me these results:</p>
  
  <pre><code>Dev stats:
  
    Pending bytes: 1410076
  
    Complete history:
  
    ident=[[type=MOBILE, subType=COMBINED, subscriberId=310260...]] uid=-1 set=ALL tag=0x0
  NetworkStatsHistory: bucketDuration=3600000
    bucketStart=1349211600000 activeTime=3600000 rxBytes=19656154 rxPackets=16897 txBytes=615620 txPackets=8084 operations=0
    bucketStart=1349215200000 activeTime=3600000 rxBytes=28854708 rxPackets=23363 txBytes=1037409 txPackets=12206 operations=0
    bucketStart=1349218800000 activeTime=3600000 rxBytes=1839274 rxPackets=1565 txBytes=89791 txPackets=914 operations=0
    bucketStart=1349222400000 activeTime=3600000 rxBytes=17421 rxPackets=88 txBytes=18376 txPackets=95 operations=0
    bucketStart=1349226000000 activeTime=3600000 rxBytes=506966 rxPackets=788 txBytes=96491 txPackets=859 operations=0
  </code></pre>
  
  <p>Unfortunately this looks like a combined netstat that does not differentiate between applications. </p>
  
  <p>So my question, is there a way to see network traffic by unique PID#'s or application names, by simply using the command prompt? </p>
  
  <hr>
  
  <p><em>EDIT</em></p>
  
  <hr>
  
  <p>Alright I made some good strides</p>
  
  <p>With this code </p>
  
  <pre><code> adb shell cat proc/1638(thePID)/net/dev &gt; C:\netstats.txt 
  </code></pre>
  
  <p>I can get this information:</p>
  
  <pre><code>Inter-|   Receive                                                |  Transmit
   face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
  lo:        3564      28    0    0    0     0          0         0     3564      28    0    0    0     0       0          0
  dummy0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  rmnet0: 117062940  191775  0    0    0     0          0         0 19344640  177574    0    0    0     0       0          0
  rmnet1: 2925492    5450    0    0    0     0          0         0  1448544    5664    0    0    0     0       0          0
  rmnet2:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  rmnet3:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  rmnet4:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  rmnet5:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  rmnet6:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  rmnet7:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
    sit0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
    vip0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  </code></pre>
  
  <p>Unfortunately after double checking these numbers with programs like "Network Usage" from the android market place, I discovered that these numbers are the total up and down across the entire device. </p>
  
  <p>So it still leaves me with, how/where the heck are programs like "Network Usage" and "Spare Parts" getting their information from? </p>