Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throughput measured on usb device seems wrong #6

Closed
jrsphoto opened this issue Oct 5, 2017 · 11 comments
Closed

throughput measured on usb device seems wrong #6

jrsphoto opened this issue Oct 5, 2017 · 11 comments

Comments

@jrsphoto
Copy link

jrsphoto commented Oct 5, 2017

I have an RTL-SDR usb sdr receiver, that I've been testing with usbtop to determin how much data its sending over the usb bus. I can use the command rtl_test -s 2.4e6 to tell it to sample at 2.4MHz bandwidth, which should put around 4800kB/s on the usb bus, but I'm only geting 1160kB/sec. In fact, if I change the sample rate to 3.4Mhz, which should peg the usb2 interface, It stays at 1160kB/sec.

I'm on ubuntu 16.04.3 LTS on an i5 processor with 16gb of ram.. Source compiled direct from github and compiled with no errors or warnings.

@aguinet
Copy link
Owner

aguinet commented Nov 5, 2017

Hello @jrsphoto !

Thanks for your tests! I was actually not very confident about the algorithm used for computing the bandwidth, and your results seem to confirm that! Do you have any suggestions/improvements on how the bandwidth measurement should be done? (that is, for instance, at which frequency should we compute it, using which sizes, etc...). Thanks!

@aguinet
Copy link
Owner

aguinet commented Nov 5, 2017

For information, all bandwidth computation related code is happening here: https://github.com/aguinet/usbtop/blob/master/src/usb_stats.cpp !

@mangodan2003
Copy link

mangodan2003 commented Jan 10, 2019

Just like to add that I too think the results are inaccurate. I'm running tests between hosts with iperf using USB-Ethernet dongles.

The figures from iperf are:

Connecting to host 192.168.33.175, port 5201
[  4] local 192.168.33.1 port 49736 connected to 192.168.33.175 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  8.87 MBytes  74.4 Mbits/sec    0   50.9 KBytes       
[  4]   1.00-2.00   sec  9.10 MBytes  76.4 Mbits/sec    0   50.9 KBytes       
[  4]   2.00-3.00   sec  8.71 MBytes  73.0 Mbits/sec    0   52.3 KBytes       
[  4]   3.00-4.00   sec  8.64 MBytes  72.5 Mbits/sec    0   56.6 KBytes       
[  4]   4.00-5.00   sec  8.57 MBytes  71.9 Mbits/sec    0   80.6 KBytes       
[  4]   5.00-6.00   sec  8.51 MBytes  71.4 Mbits/sec    0   80.6 KBytes       
[  4]   6.00-7.00   sec  8.47 MBytes  71.0 Mbits/sec    0   80.6 KBytes       
[  4]   7.00-8.00   sec  8.62 MBytes  72.3 Mbits/sec    0   80.6 KBytes       
[  4]   8.00-9.00   sec  8.54 MBytes  71.6 Mbits/sec    0   80.6 KBytes       
[  4]   9.00-10.00  sec  8.55 MBytes  71.7 Mbits/sec    0    123 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  86.6 MBytes  72.6 Mbits/sec    0             sender
[  4]   0.00-10.00  sec  86.4 MBytes  72.5 Mbits/sec                  receiver

whilst usbtop is saying around about :
Device ID 3 : 744.97 kb/s 11270.87 kb/s
which seems way of the mark, maybe a factor of 10?

Would expect to see something significantly higher than 72Mb/s taking usb overhead into account.

@Nable80
Copy link

Nable80 commented Jan 10, 2019

11270.87 kB/s ~ 90.167 Mbits/s. Does it resolve your doubts?

@mangodan2003
Copy link

I would hazard a guess that its coincidence. The units displayed are kb/s - that's kilo bits per second, and USB throughput is normally measured in bits not bytes, presumably due to being a serial connection. I'll have a look at usb_stats.cpp and see if its a possibility though.

@Nable80
Copy link

Nable80 commented Jan 12, 2019

I've looked at the code (src/usb_stats.cpp and src/console_output.cpp). All the calculations are performed in bytes and bytes per second, no conversion to/from bits is used, only the final conversion from bytes per second to kiB/s (division by 1024.0 in console_output.cpp).

@mangodan2003
Copy link

ah ok, not had a chance to look back at this yet but good to know. Thanks.

@dentys03
Copy link

dentys03 commented Mar 6, 2019

Hi.

could you please clarify?
The output of usbtop is kb/s, kB/s or kiB/s ?

@aguinet
Copy link
Owner

aguinet commented Mar 6, 2019

It's in KiB/s (KiB as in https://en.wikipedia.org/wiki/Kibibyte)

@dentys03
Copy link

dentys03 commented Mar 6, 2019

Thank you.
The output includes the usb overhead too?

@aguinet
Copy link
Owner

aguinet commented Apr 22, 2019

It does. Closing this issue. Do notbhesitate to re-open if you have any question!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants