On 02/16/2015 09:17 PM, Luke Berndt wrote: > Hi - I am trying to create optional paths in my Gnuradio Flowgraph. I > have found 2 ways of doing this in C++: - Doing a lock() / unlock() > inside my heir_block2 and either connecting the items inside the > block to the source of the block or connecting the source of the > block to a null_sink. - Putting a gr::blocks::copy inside my > heir_block2 and either enabling or disabling when I want samples to > go through the block. > > With the null_sink I get almost no CPU load when the source is > connect to the Null Sink. However with the Copy block I get a decent > amount of CPU load when the block is set to disable. > > I looked at the code and looks like a Copy Block set to disable is > about the same as a Null Sink. they both just do nothing with the > incoming samples. > > Why is the Copy Block using so much more CPU? Is it possible for it > to have the same CPU load as a null sink?
In the case of the copy block, the scheduler has no way of knowing that you're treating it like a sink. That might explain the difference. > Is there are better way of doing this? Should I write a custom > block? Are you using GRC? If so, there's the 'Selector', but I'm not sure if that does a better job than what you have. Depending on your signal setup, you might be able to use a matrix_multiply, but that might make things worse CPU-wise. M _______________________________________________ Discuss-gnuradio mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
