2

I found this post Measure data roaming traffic on Android? there it say I shall monitor file /sys/class/net. I tried to find this on my emulator to see how it looks like. I cannot find it using the file explorer. Is that old out-dated information or where can I find it?

Thanks, A.

Community
  • 1
  • 1
AndyAndroid
  • 4,039
  • 14
  • 44
  • 71

2 Answers2

2

First of all, as for Gingerbread (and Linux kernel 2.6.35) /sys/class/net is not a regular file, it's a directory with a bunch of links to directories to real devices' statistics. It's perfectly readable with any permissions. Use Android terminal emulator (AppMenu -> DevTools -> Terminal Emulator) to see how it looks like. What it looks like. All files below /sys belong to a special kernel subsystem, they're not real files, just interfaces for reading information from kernel. Monitoring means just reading dedicated files that contains counts of transmitted/received/dropped bytes/packets/etc. E.g. In the terminal emulator:

# ls -l /sys/class/net
lrwxrwxrwx root     root              2012-03-15 16:49 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx root     root              2012-03-15 16:49 eth0 -> ../../devices/platform/smc91x.0/net/eth0
lrwxrwxrwx root     root              2012-03-15 16:49 tunl0 -> ../../devices/virtual/net/tunl0
lrwxrwxrwx root     root              2012-03-15 16:49 gre0 -> ../../devices/virtual/net/gre0
# ls -l /sys/devices/platform/smc91x.0/net/eth0
   ### ... A lot of files
drwxr-xr-x root     root              2012-03-15 16:47 statistics
   ### ...
# ls -l /sys/devices/platform/smc91x.0/net/eth0/statistics
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_packets
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_packets
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_bytes
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_bytes
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_dropped
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_dropped
-r--r--r-- root     root         4096 2012-03-15 17:03 multicast
-r--r--r-- root     root         4096 2012-03-15 17:03 collisions
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_length_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_over_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_crc_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_frame_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_fifo_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_missed_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_aborted_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_carrier_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_fifo_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_heartbeat_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_window_errors
-r--r--r-- root     root         4096 2012-03-15 17:03 rx_compressed
-r--r--r-- root     root         4096 2012-03-15 17:03 tx_compressed
# cat /sys/devices/platform/smc91x.0/net/eth0/statistics/rx_bytes
410236
Dmytro Sirenko
  • 5,003
  • 21
  • 26
0

You probably need root to find it? (Not sure) And make sure you're looking in the phone memory (not sdcard)

REJH
  • 3,273
  • 5
  • 31
  • 56