# About Latency

**URL:** <https://www.ruby-forum.com/t/about-latency/116365>\
**Category:** GNU Radio\
**Created:** [October 4, 2007, 9:23pm UTC](https://www.ruby-forum.com/t/about-latency/116365 "2007-10-04T21:23:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![KC\_Huang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@KC\_Huang](https://www.ruby-forum.com/u/KC_Huang)\
**Post date:** [October 4, 2007, 9:23pm UTC](https://www.ruby-forum.com/t/about-latency/116365/1 "2007-10-04T21:23:34Z")

</div>

Hi all:

I have two questions about Gnuradio latency:

1. In transmit path, the USB delay is constant due to the 32KB buffer  
between “signal source output” and “USB”. If the sampling rate is 1MS/s  
and  
each sample is complex 16 bits( sample size=4bytes), we can get the USB  
latency = 8ms. But how do we estimate the delay of signal processing by  
processor and USRP? I think these delays are variable depending on how  
complex the signal is and how fast the processor is. But are there any  
ways  
to determine what is the range of these delays?

2. fusb\_options define two parameters of “fusb\_nblocks” and  
“fusb\_block\_size”.  
This function should be used to decrease the delay of USB. But, if we  
choose  
any value of number of blocks and block size, say, nblock=8 and  
block\_size  
=2048, does that mean we need to have larger time to pass through the  
8\*2048  
Bytes packet than the smallest allowed 512 Bytes? So, in this logic, the  
latency of usb will increase although the throughput is increased. Am I  
correct? If not, what’s wrong with my thought?

Thanks for ur reply advance!!

KC Huang

---

<div class="post-metadata">

**Author:** ![KC\_Huang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@KC\_Huang](https://www.ruby-forum.com/u/KC_Huang)\
**Post date:** [October 5, 2007, 12:46am UTC](https://www.ruby-forum.com/t/about-latency/116365/2 "2007-10-05T00:46:00Z")

</div>

KC Huang-

> I have two questions about Gnuradio latency:
> 
> 1. In transmit path, the USB delay is constant due to the 32KB buffer  
> between “signal source output” and “USB”. If the sampling rate is 1MS/s and  
> each sample is complex 16 bits( sample size=4bytes), we can get the USB  
> latency = 8ms. But how do we estimate the delay of signal processing by  
> processor and USRP? I think these delays are variable depending on how  
> complex the signal is and how fast the processor is. But are there any ways  
> to determine what is the range of these delays?

Compared to PC data transfer, FPGA logic delays should be negligible.  
For example,  
FIR filtering in FPGA logic contributes at least one clock cycle per  
sample to  
latency (64 MHz clock). It could be more than one clock per, but I  
don’t know the  
FPGA code and the Cyclone (which is an old FPGA) well enough to say  
whether Matt was  
able to implement single-cycle MAC. To get some idea of comparison,  
depending on how  
it’s implemented, a 16-tap FIR filter might add from 250 nsec to a few  
usec.

-Jeff

---

<div class="post-metadata">

**Author:** ![KC\_Huang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@KC\_Huang](https://www.ruby-forum.com/u/KC_Huang)\
**Post date:** [October 5, 2007, 2:27am UTC](https://www.ruby-forum.com/t/about-latency/116365/3 "2007-10-05T02:27:05Z")

</div>

On Thu, Oct 04, 2007 at 03:22:40PM -0400, KC Huang wrote:

> Hi all:
> 
> I have two questions about Gnuradio latency:
> 
> 1. In transmit path, the USB delay is constant due to the 32KB buffer  
> between “signal source output” and “USB”.

You misunderstand how things work.

Please take a look at Thomas S.'s paper  
[http://nesl.ee.ucla.edu/document/show/242](http://nesl.ee.ucla.edu/document/show/242)  
and then if you’ve still got questions, please post again.

Eric

---

<div class="post-metadata">

**Author:** ![KC\_Huang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@KC\_Huang](https://www.ruby-forum.com/u/KC_Huang)\
**Post date:** [October 5, 2007, 7:21am UTC](https://www.ruby-forum.com/t/about-latency/116365/4 "2007-10-05T07:21:50Z")

</div>

On Thu, Oct 04, 2007 at 09:46:36PM +0800, KC Huang wrote:

> So, does that mean if u have large product of fusb\_block\_size and  
> fusb\_nblock, then the theometical maximum delay will be increased?  
> Therefore, I think that the range of USB latency is also increased. Please  
> correct me if I am wrong. Thanks!
> 
> KC

Yes that is true.

If you’re trying to minimize latency you want the smallest values that  
work reliably (no over/underruns) and with acceptable overhead. If  
you enable real time scheduling, you can reliably use smaller values.

Try fusb\_block\_size 2048 and fusb\_nblock 4 or 8. You may be able to  
run with fusb\_block\_size 1024. It depends on your data rate across  
the USB.

Eric

---

<div class="post-metadata">

**Author:** ![KC\_Huang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@KC\_Huang](https://www.ruby-forum.com/u/KC_Huang)\
**Post date:** [May 1, 2009, 12:32am UTC](https://www.ruby-forum.com/t/about-latency/116365/5 "2009-05-01T00:32:17Z")

</div>

Hi,

Where did he get this equation from? (What is this equation f?)

> Hi Eric:
> 
> I have already read that paper before. As that paper mentions, the USB  
> delay  
> is according to the equation
> 
> ## f(512, fusb\_block\_size\*fusb\_nblock)
> 
> fs\*sample\_size ,  
> which  
> f(x,y) is at least x and at most y

---

<div class="post-metadata">

**Author:** ![KC\_Huang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@KC\_Huang](https://www.ruby-forum.com/u/KC_Huang)\
**Post date:** [October 5, 2007, 3:47am UTC](https://www.ruby-forum.com/t/about-latency/116365/6 "2007-10-05T03:47:13Z")

</div>

Hi Eric:

I have already read that paper before. As that paper mentions, the USB  
delay  
is according to the equation

## f(512, fusb\_block\_size\*fusb\_nblock)

fs\*sample\_size ,  
which  
f(x,y) is at least x and at most y

So, does that mean if u have large product of fusb\_block\_size and  
fusb\_nblock, then the theometical maximum delay will be increased?  
Therefore, I think that the range of USB latency is also increased.  
Please  
correct me if I am wrong. Thanks!

KC

----- Original Message -----  
From: “Eric B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: “KC Huang” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Cc: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Friday, October 05, 2007 8:29 AM  
Subject: Re: About Latency

---

<div class="post-metadata">

**Author:** ![KC\_Huang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@KC\_Huang](https://www.ruby-forum.com/u/KC_Huang)\
**Post date:** [May 1, 2009, 12:33am UTC](https://www.ruby-forum.com/t/about-latency/116365/7 "2009-05-01T00:33:19Z")

</div>

oooo never mind just realized
