Do you really need the count, or do you just need some code to process FFTs
as the block computes them? I suspect a little bit more understanding of
GNU Radio will help you achieve what you want.

Assuming that I have some DSP stuff I want to operate on an FFT output, I
would go about this in one of the following ways:

Option 1) Write my DSP stuff in GNU Radio blocks in my own out of tree
module. This is the GNU Radio way to do things. The GNU Radio scheduler
will call my code to process FFT chunks as they are available.

Option 2) Connect the output of the GNU Radio FFT block to something like a
gr-zeromq block or TCP block and write a receiver for this on my
application. This is better than a file (but can actually *look* like a
file if I use a something like zeromq's ipc:// protocol or a FD block
because an actual file flushes buffers (actually commits the write to disk)
at unknown times, so it may not actually be particularly close to
real-time. Then instead of reopening a file and seeking to the end every
time I can just read from the socket/icp FD to get all of the latest stuff.

There's no way to get a count of FFTs that are written to the file because
the FFT block and the file block are not deterministicly scheduled. You
could use the performance counters to see how many items the file block has
read, but that's a horrible abuse of that counter and still doesn't
guarantee the number actually written to disk because you don't know when
the file buffer is actually being flushed. Rethinking the problem is likely
the best way forward.

I highly recommend option 1 and option 2 as a last resort. Option 2 is
better for when you're no longer doing DSP and passing something like bits
to another process that's great at handling bits.

On Mon, Sep 19, 2016 at 9:07 PM, Hasini Abeywickrama <hva...@gmail.com>
wrote:

> Hi Nathan,
>
> That's not quite what I want. I do not want the file to have a certain
> number of FFTs. I want to have a counter which is dynamically updated as
> the FFTs are written to a file. Ideally I want to know when a new FFT is
> written to the file so I can trigger another function to process it. I need
> this to be done real time and that's why I'm looking for the most efficient
> way.
>
> Regards,
> Hasini
>
> On Tue, Sep 20, 2016 at 10:34 AM, West, Nathan <
> n...@ostatemail.okstate.edu> wrote:
>
>>
>> On Mon, Sep 19, 2016 at 6:57 AM, Hasini Abeywickrama <hva...@gmail.com>
>> wrote:
>>
>>> Hi Marcus,
>>>
>>> That's what I'm currently doing. It's not very efficient as I have to
>>> constantly check the file size. If I can have a counter that is increments
>>> each time an FFT is written to the file by the flow graph I would be able
>>> to trigger an event based on the counter value. That was my concern.
>>>
>>> Regards,
>>> Hasini
>>>
>>> On Sep 19, 2016, at 3:29 PM, Marcus Müller <marcus.muel...@ettus.com>
>>> wrote:
>>>
>>> If you need to do that externally, I'd just watch the file size and
>>> divide it by the item size (4B per floating point number) and by the FFT
>>> length.
>>>
>>>
>>> Best regards,
>>>
>>> Marcus
>>>
>>> On 09/18/2016 11:21 PM, Hasini Abeywickrama wrote:
>>>
>>> Hi Marcus,
>>>
>>> It's like I need to start reading and processing the file after a
>>> certain number of FFTs are being written to the file. For that I would need
>>> to maintain a counter and I'm trying to figure out how to do it.
>>>
>>> Regards,
>>> Hasini
>>>
>>>
>> You can do this with the head block. It let's N number of items through
>> and then stops the flowgraph. Set N to your certain number and then the
>> file will have N FFTs.
>>
>>
>>
>>>
>>> On Mon, Sep 19, 2016 at 2:58 PM, Marcus Müller <marcus.muel...@ettus.com
>>> > wrote:
>>>
>>>> What would you need that counter for? There's the 1/(FFT length) fixed
>>>> relation between samples processed and numbers of FFTs done, so this is
>>>> pretty much a redundant piece of info, but maybe I'm just missing the use
>>>> case.
>>>>
>>>> Best regards,
>>>>
>>>> Marcus
>>>>
>>>> On 09/18/2016 10:23 PM, Hasini Abeywickrama wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I have a GNU Radio flowgraph which uses a USRP to receive a signal,
>>>> converts it to log power FFT and then writes the result to a file, using
>>>> File Sink. I want to have a counter which increments with each FFT written
>>>> to the file.
>>>>
>>>> Is there a way of maintaining and increasing count of the FFTs written
>>>> to the file, while the flowgraph is still running?
>>>>
>>>>
>>>> _______________________________________________
>>>> Discuss-gnuradio mailing 
>>>> listDiscuss-gnuradio@gnu.orghttps://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>>
>>>> _______________________________________________ Discuss-gnuradio
>>>> mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/
>>>> listinfo/discuss-gnuradio
>>>
>>>
>>> _______________________________________________
>>> Discuss-gnuradio mailing list
>>> Discuss-gnuradio@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>
>>>
>>
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to