[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Overrun when there shouldn't be
From: |
Juha Vierinen |
Subject: |
Re: [Discuss-gnuradio] Overrun when there shouldn't be |
Date: |
Wed, 11 Feb 2009 05:02:13 +0000 |
Hi,
I tried your code and also got overruns. I have had better luck by
increasing the fusb_blocksize and fusb_nblocks to really large values
like fusb_blocksize=4096 and fusb_nblocks=4096 (or sometimes even
16384). In my opinion the default values are too small.
I made the following modification to your code. It takes care of the
overruns for me:
usrp_standard_rx* rx = usrp_standard_rx::make(UsrpNumber,
DecimRate,2,-1,0,4096,4096);
If I recall correctly, others have told me this is a stupid idea
because it uses up a lot of kernel space memory. I agree that this
might waste a couple of megabytes of RAM, but I have a lot of memory
and it is very important in my applications to sample without
overflows. Increasing fusb_nblocks is the only way that has
consistently worked for me. I have also tried the realtime stuff, but
it didn't give very consistent results.
I actually challenge anyone to send me code that doesn't overflow on
my computer (core2 duo macbook pro) during eigth hours of
full-bandwidth operation. The rules are no realtime scheduling, and
use the default fusb_nblocks and fusb_blocksize. The code should have
the same functionality as the code that Chris sent. I will buy a beer
to the first person that proves me wrong.
Others in the thread seem to have commented about the gradual
degradation in the performance of gnuradio. I can only report the
contrary. Gnuradio has only improved as a function of time. The
C-interfaces and multithreaded schedulers rock!
BR,
juha
On Tue, Feb 10, 2009 at 03:07, Chris Stankevitz <address@hidden> wrote:
> Hi,
>
> I wrote a c++ program that grabs data from the USRP in an infinite loop
> and does nothing with it. It overruns. Can anyone help me figure out why?
>
> This runs on a 2.4GHz computer that isn't doing anything else. I'm
> sampling the A and B channel of a BasicRX at 4MHz with shorts. CPU runs
> about 15%. I've tried many different values for NumBytes. Profile
> results show nothing abnormal. This is driving me nuts!
>
> Thank you,
>
> Chris
>
> #include <usrp_standard.h>
> #include <iostream>
>
> using namespace std;
>
> static const unsigned DecimRate = 16;
>
> //-----------------------------------------------------------------------------
> //-----------------------------------------------------------------------------
> int main(int argc, char** argv)
> {
>
> static const int UsrpNumber = 0;
>
> const unsigned Format = usrp_standard_rx::make_format(
> 16, // width across usb
> 0, // shift
> true, // want Q
> false // bypass halfband
> );
>
> usrp_standard_rx* rx = usrp_standard_rx::make(UsrpNumber, DecimRate);
>
> static const int Mux = 0x33221100;
>
> rx->set_decim_rate(DecimRate);
>
> static const double DdcFreq = -12000e3;
>
> static const int NumChannels = 2;
>
> rx->set_nchannels(NumChannels);
>
> for(int i = 0; i < NumChannels; ++i)
> {
> rx->set_rx_freq(i, DdcFreq);
> }
>
> rx->set_mux(Mux);
> rx->set_pga(0, 0);
> rx->set_pga(1, 0);
>
> rx->set_format(Format);
>
> static const unsigned NumBytes = 4096;
>
> char* Buffer = new char[NumBytes];
>
> rx->start();
>
> bool Overrun = false;
>
> // Throw away first 32kB of data because it's fouled up
> // with some kind of sinc
> int NumTossed = 0;
> while(NumTossed < 32768)
> {
> NumTossed += rx->read(Buffer, NumBytes, &Overrun);
> }
>
> while(true)
> {
> rx->read(Buffer, NumBytes, &Overrun);
>
> if(Overrun)
> {
> Overrun = false;
> cerr << "Overrun\n";
> }
>
> //std::cout.write(Buffer, NumBytes);
> }
>
> rx->stop();
>
> delete [] Buffer;
>
> return 0;
> }
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
Re: [Discuss-gnuradio] Overrun when there shouldn't be,
Juha Vierinen <=