discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Is it safe to use get_tags_in_range within foreca


From: Markus Wirsing
Subject: Re: [Discuss-gnuradio] Is it safe to use get_tags_in_range within forecast?
Date: Wed, 17 Jan 2018 12:28:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

Thank you for your reply.

What I want to do is write a block that copies a certain number of
samples after a certain tag to the output and drops all other samples.
I'll go through your questions below. But any further ideas on how to
implement this would also be appreciated.

Am 16.01.2018 um 14:37 schrieb Andy Walls:
>> From:        Markus Wirsing
>> Date:        Tue, 16 Jan 2018 10:24:50 +0100
> 
>> Hello,
>>
>> I am trying to write a block that produces a different amount of
>> output 
>> depending on the tags.
>> For that I would need to access the tags in the forecast function.
>> Would it be 
>> safe to do that?
> 
> Yes, for the tags.  However, you will be introducing inefficiency.
> 
> The block executor calls forecast() multiple times in an effort to give
> the block a number of input samples that will produce some output.  So
> forecast() can be called many times before general_work(), and you will
> have to refetch and process the tags on every call to forecast().
> 
> Be careful with your return value from forecast().  If you're smart
> about it, you can probably minimize the number of time you go around in
> the 'try_again' loop in the scheduler.
> 
> https://github.com/gnuradio/gnuradio/blob/master/gnuradio-runtime/lib/block_executor.cc#L397
> 
If I understand it correctly that means I should try to avoid calling
get_tags_in_range from forecast (unless I want to implement some caching
to avoid performance penalties). I should also think about what to
output in cases where the number of visible tags does not allow me to
forecast the number of required input for the requested output.

> 
> I'll ask some leading questions:
> 
> What happens if there are no tags on input?  Do you say you can't
> produce output?  If so, what if the input buffer is full, such that no
> new tags will ever appear, until some input is drained?
> 

I didn't think about the aspect yet that my general_work function might
not get called at all then. I thought I would be able to drain the input
by just calling consume()

I'm currently thinking that it might be best to just return a fixed
multiple of the parameter given to consume. Does this have disadvantages
other than potentially degraded performance due to more calls to
general_work()?

> 
>> Or can the tags still change in between the call to forecast and the
>> call to 
>> general_work?
> 
> Yes, they can.  In the small window of time between the final call to
> forecast() and the call general_work(), you can get additional tags;
> tags won't be removed.
> 

That should not be too much of a problem if I understand the system
correctly. As the number returned by forecast does not have to be exact.

> -Andy
> 
>> I was not able to find information about that in the documentation.
>> And I don't 
>> have sufficient knowledge of gnuradio's inner workings to certainly
>> answer that 
>> question myself.
>>
>> Thanks for any help.
>>
>> Markus
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]