[Top][All Lists]

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

Re: [Discuss-gnuradio] buffer allocation

From: Eric Blossom
Subject: Re: [Discuss-gnuradio] buffer allocation
Date: Tue, 11 Jan 2005 18:01:37 -0800
User-agent: Mutt/1.5.6i

On Tue, Jan 11, 2005 at 03:01:32PM -0600, Suvda Myagmar wrote:
> Couple of questions about how buffers are allocated and used w.r.t. flow 
> graph. References to input, output buffers are passed to a signal 
> processing block as pointers to arrays, right?


> What are signatures of  input/output streams and what's their purpose?

Type-checking the number and types of the input and output streams.

> How data stored in buffers are being consumed, in chunks or all at once?

Chunks.  E.g., there may be more data say in the input buffer, but it
won't be consumed at this momement because there isn't enough room in
the output buffer to hold the tranformed data.  A block's general_work
or work method is only called when all constraints are satisfied.  The
constraints include the output multiple, the amount of input
available, how much output room it takes to hold the output produced
from this input, etc.  
See http://www.gnu.org/software/gnuradio/doc/classgr__block.html

> During flow graph build, buffer size gets computed and allocated. Can 
> somebody explain what parameters the buffer size depend on?

Right now the buffer sizes fixed (mostly). This will probably change.
Here's the code that does the calculation (from

class buffer_sizes (object):
    """compute buffer sizes to use"""
    def __init__ (self, flow_graph):
        # We could scan the graph here and determine individual sizes
        # based on relative_rate, number of readers, etc.

        # The simplest thing that could possibly work: all buffers same size
        self.fixed_buffer_size = 32*1024

    def allocate (self, m, index):
        """allocate buffer for output index of block m"""
        item_size = m.output_signature().sizeof_stream_item (index)
        nitems = self.fixed_buffer_size / item_size
        if 1 + m.output_multiple () > nitems:
            nitems = 1 + m.output_multiple ()
        return buffer (nitems, item_size)


reply via email to

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