Blog‎ > ‎Tech Blog‎ > ‎

Monitor USB Throughput

posted 9 Sep 2013, 09:23 by Flip Pipe   [ updated 9 Sep 2013, 09:31 ]
Time to time, I need to see how much bandwidth an USB device is taking... for example, from an external hard drive or something like that.

Wireshark can do the job, but it is not simple to use. So I create two small scripts to help me.

The first is getUsb.sh and needs to be run as root... because it uses usbmon, which need to run as root. This parses the output of usbmon and sums the data passing through the device.

The other is speedUsb.sh, to be run as normal user and see the results. This get the total amount of data passing in the device, and make the maths and updates every second.

So if you want to try out, as root run getUsb.sh

# ./getUsb.sh

and choose the device you want:



and leave it running.

Then as normal users, run the other

 
$
./speedUSB.sh IN OUT 0.053 0.160 Mbytes/s 0.426 1.286 Mbits/s 0.001 0.204 Mbytes/s 0.012 1.634 Mbits/s 0.048 0.508 Mbytes/s 0.387 4.071 Mbits/s 0.013 0.570 Mbytes/s 0.105 4.567 Mbits/s 0.036 0.714 Mbytes/s 0.293 5.713 Mbits/s
 

I hope this help you.

warning this was only tested in my machine, so used it at your own risk. warning

ċ
Flip Pipe,
9 Sep 2013, 09:23
ċ
Flip Pipe,
9 Sep 2013, 09:23
Comments