diff options
Diffstat (limited to 'gnuradio-runtime')
55 files changed, 284 insertions, 1304 deletions
diff --git a/gnuradio-runtime/CMakeLists.txt b/gnuradio-runtime/CMakeLists.txt index 7660642509..d24c17a3f9 100644 --- a/gnuradio-runtime/CMakeLists.txt +++ b/gnuradio-runtime/CMakeLists.txt @@ -37,6 +37,7 @@ GR_REGISTER_COMPONENT("gnuradio-runtime" ENABLE_GNURADIO_RUNTIME Boost_FOUND ENABLE_VOLK PYTHONINTERP_FOUND + LOG4CPP_FOUND ) GR_SET_GLOBAL(GNURADIO_RUNTIME_INCLUDE_DIRS @@ -89,39 +90,6 @@ get_filename_component(GR_RUNTIME_PYTHONPATH ) GR_SET_GLOBAL(GR_RUNTIME_PYTHONPATH ${GR_RUNTIME_PYTHONPATH}) -######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_RUNTIME_DESCRIPTION "GNU Radio Runtime") - -CPACK_COMPONENT("runtime_runtime" - GROUP "Runtime" - DISPLAY_NAME "Runtime" - DESCRIPTION "Dynamic link libraries" - DEPENDS "runtime_runtime" -) - -CPACK_COMPONENT("runtime_devel" - GROUP "Runtime" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "runtime_devel" -) - -CPACK_COMPONENT("runtime_python" - GROUP "Runtime" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime" - DEPENDS "runtime_python;runtime_runtime" -) - -CPACK_COMPONENT("runtime_swig" - GROUP "Runtime" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "runtime_swig;runtime_python;runtime_devel" -) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-runtime.conf.in ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime.conf @@ -130,16 +98,12 @@ configure_file( install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime.conf DESTINATION ${GR_PREFSDIR} - COMPONENT "runtime_runtime" ) -if(ENABLE_GR_LOG AND HAVE_LOG4CPP) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_log_default.conf DESTINATION ${GR_PREFSDIR} - COMPONENT "runtime_runtime" ) -endif(ENABLE_GR_LOG AND HAVE_LOG4CPP) ######################################################################## # Add subdirectories @@ -166,7 +130,6 @@ configure_file( install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-runtime.pc DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "runtime_devel" ) endif(ENABLE_GNURADIO_RUNTIME) diff --git a/gnuradio-runtime/apps/CMakeLists.txt b/gnuradio-runtime/apps/CMakeLists.txt index 3dea7268ff..4a73f3c18f 100644 --- a/gnuradio-runtime/apps/CMakeLists.txt +++ b/gnuradio-runtime/apps/CMakeLists.txt @@ -37,5 +37,4 @@ target_link_libraries(gnuradio-config-info gnuradio-runtime ${Boost_LIBRARIES}) install( TARGETS gnuradio-config-info DESTINATION ${GR_RUNTIME_DIR} - COMPONENT "runtime_runtime" ) diff --git a/gnuradio-runtime/examples/mp-sched/CMakeLists.txt b/gnuradio-runtime/examples/mp-sched/CMakeLists.txt index 863cfa733a..4e07366d4f 100644 --- a/gnuradio-runtime/examples/mp-sched/CMakeLists.txt +++ b/gnuradio-runtime/examples/mp-sched/CMakeLists.txt @@ -26,11 +26,9 @@ GR_PYTHON_INSTALL(PROGRAMS synthetic.py wfm_rcv_pll_to_wav.py DESTINATION ${GR_PKG_DATA_DIR}/examples/mp-sched - COMPONENT "runtime_python" ) install( FILES README DESTINATION ${GR_PKG_DATA_DIR}/examples/mp-sched - COMPONENT "runtime_python" ) diff --git a/gnuradio-runtime/examples/mp-sched/affinity_set.py b/gnuradio-runtime/examples/mp-sched/affinity_set.py index 15d2233b6a..e6637b44bf 100755 --- a/gnuradio-runtime/examples/mp-sched/affinity_set.py +++ b/gnuradio-runtime/examples/mp-sched/affinity_set.py @@ -8,9 +8,9 @@ from gnuradio import eng_notation from gnuradio import gr from gnuradio import blocks from gnuradio import filter -from gnuradio.eng_option import eng_option +from gnuradio.eng_arg import eng_arg from gnuradio.filter import firdes -from optparse import OptionParser +from argparse import ArgumentParser import sys class affinity_set(gr.top_block): @@ -51,8 +51,8 @@ class affinity_set(gr.top_block): self.samp_rate = samp_rate if __name__ == '__main__': - parser = OptionParser(option_class=eng_option, usage="%prog: [options]") - (options, args) = parser.parse_args() + parser = ArgumentParser() + args = parser.parse_args() tb = affinity_set() tb.start() diff --git a/gnuradio-runtime/examples/mp-sched/plot_flops.py b/gnuradio-runtime/examples/mp-sched/plot_flops.py index d9d810ae2f..9bd2ff12bb 100755 --- a/gnuradio-runtime/examples/mp-sched/plot_flops.py +++ b/gnuradio-runtime/examples/mp-sched/plot_flops.py @@ -28,7 +28,7 @@ import re import sys import os import tempfile -from optparse import OptionParser +from argparse import ArgumentParser def parse_file(input_filename, output): @@ -84,14 +84,11 @@ def handle_file(input_filename): def main(): - usage = "usage: %prog [options] file.dat" - parser = OptionParser(usage=usage) - (options, args) = parser.parse_args() - if len(args) != 1: - parser.print_help() - raise SystemExit, 1 - - handle_file(args[0]) + parser = ArgumentParser() + parser.add_argument('file', help='Input file') + args = parser.parse_args() + + handle_file(args.file) if __name__ == '__main__': diff --git a/gnuradio-runtime/examples/mp-sched/run_synthetic.py b/gnuradio-runtime/examples/mp-sched/run_synthetic.py index 4896bca462..802fb9fd34 100755 --- a/gnuradio-runtime/examples/mp-sched/run_synthetic.py +++ b/gnuradio-runtime/examples/mp-sched/run_synthetic.py @@ -27,7 +27,7 @@ import re import sys import os import tempfile -from optparse import OptionParser +from argparse import ArgumentParser def write_shell_script(f, data_filename, description, ncores, gflops, max_pipes_and_stages): @@ -70,31 +70,26 @@ total runtime of about 43 minutes, assuming that your values for -n and -f are r For x86 machines, assume 3 FLOPS per processor Hz. E.g., 3 GHz machine -> 9 GFLOPS. plot_flops.py will make pretty graphs from the output data generated by %prog. """ - usage = "usage: %prog [options] output.dat" - parser = OptionParser(usage=usage, description=description) - parser.add_option("-d", "--description", metavar="DESC", - help="machine description, e.g., \"Dual quad-core Xeon 3 GHz\"", default=None) - parser.add_option("-n", "--ncores", type="int", default=1, - help="number of processor cores [default=%default]") - parser.add_option("-g", "--gflops", metavar="GFLOPS", type="float", default=3.0, - help="estimated GFLOPS per core [default=%default]") - parser.add_option("-m", "--max-pipes-and-stages", metavar="MAX", type="int", default=16, - help="maximum number of pipes and stages to use [default=%default]") - (options, args) = parser.parse_args() - if len(args) != 1: - parser.print_help() - raise SystemExit, 1 - - output_filename = args[0] + parser = ArgumentParser(description=description) + parser.add_argument("-d", "--description", metavar="DESC", + help="machine description, e.g., \"Dual quad-core Xeon 3 GHz\"") + parser.add_argument("-n", "--ncores", type=int, default=1, + help="number of processor cores [default=%(default)s]") + parser.add_argument("-g", "--gflops", metavar="GFLOPS", type=float, default=3.0, + help="estimated GFLOPS per core [default=%(default)s]") + parser.add_argument("-m", "--max-pipes-and-stages", metavar="MAX", type=int, default=16, + help="maximum number of pipes and stages to use [default=%(default)s]") + parser.add_argument("output_file_name", metavar="FILE", help="output file name") + args = parser.parse_args() shell = os.popen("/bin/sh", "w") write_shell_script(shell, - output_filename, - options.description, - options.ncores, - options.gflops, - options.max_pipes_and_stages) + args.output_file_name, + args.description, + args.ncores, + args.gflops, + args.max_pipes_and_stages) if __name__ == '__main__': main() diff --git a/gnuradio-runtime/examples/mp-sched/synthetic.py b/gnuradio-runtime/examples/mp-sched/synthetic.py index d815879cff..16e39734ae 100755 --- a/gnuradio-runtime/examples/mp-sched/synthetic.py +++ b/gnuradio-runtime/examples/mp-sched/synthetic.py @@ -21,8 +21,8 @@ from gnuradio import gr, eng_notation from gnuradio import blocks, filter -from gnuradio.eng_option import eng_option -from optparse import OptionParser +from gnuradio.eng_arg import eng_float, intx +from argparse import ArgumentParser import os @@ -50,38 +50,35 @@ class top(gr.top_block): gr.top_block.__init__(self) default_nsamples = 10e6 - parser=OptionParser(option_class=eng_option) - parser.add_option("-p", "--npipelines", type="intx", default=1, - metavar="NPIPES", help="the number of pipelines to create (default=%default)") - parser.add_option("-s", "--nstages", type="intx", default=1, - metavar="NSTAGES", help="the number of stages in each pipeline (default=%default)") - parser.add_option("-N", "--nsamples", type="eng_float", default=default_nsamples, + parser = ArgumentParser() + parser.add_argument("-p", "--npipelines", type=intx, default=1, + metavar="NPIPES", help="the number of pipelines to create (default=%(default)s)") + parser.add_argument("-s", "--nstages", type=intx, default=1, metavar="NSTAGES", + help="the number of stages in each pipeline (default=%(default)s)") + parser.add_argument("-N", "--nsamples", type=eng_float, default=default_nsamples, help=("the number of samples to run through the graph (default=%s)" % (eng_notation.num_to_str(default_nsamples)))) - parser.add_option("-m", "--machine-readable", action="store_true", default=False, + parser.add_argument("-m", "--machine-readable", action="store_true", default=False, help="enable machine readable output") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 + args = parser.parse_args() - self.npipes = options.npipelines - self.nstages = options.nstages - self.nsamples = options.nsamples - self.machine_readable = options.machine_readable + self.npipes = args.npipelines + self.nstages = args.nstages + self.nsamples = args.nsamples + self.machine_readable = args.machine_readable ntaps = 256 # Something vaguely like floating point ops - self.flop = 2 * ntaps * options.npipelines * options.nstages * options.nsamples + self.flop = 2 * ntaps * args.npipelines * args.nstages * args.nsamples src = blocks.null_source(gr.sizeof_float) - head = blocks.head(gr.sizeof_float, int(options.nsamples)) + head = blocks.head(gr.sizeof_float, int(args.nsamples)) self.connect(src, head) - for n in range(options.npipelines): - self.connect(head, pipeline(options.nstages, ntaps)) + for n in range(args.npipelines): + self.connect(head, pipeline(args.nstages, ntaps)) def time_it(tb): diff --git a/gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py b/gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py index 1a43dc3a11..bb3296d428 100755 --- a/gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py +++ b/gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py @@ -24,8 +24,8 @@ from gnuradio import gr, gru, eng_notation, filter from gnuradio import audio from gnuradio import analog from gnuradio import blocks -from gnuradio.eng_option import eng_option -from optparse import OptionParser +from gnuradio.eng_arg import eng_float, intx +from argparse import ArgumentParser import sys import math @@ -33,24 +33,20 @@ class wfm_rx_block (gr.top_block): def __init__(self): gr.top_block.__init__(self) - usage = "usage: %prog [options] input-samples-320kS.dat output.wav" - parser=OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-V", "--volume", type="eng_float", default=None, - help="set volume (default is midpoint)") + parser = ArgumentParser(description="Decode WFM signal into WAV file.") + parser.add_argument("-V", "--volume", type=eng_float, + help="Volume (dB) <%r, %r> (default is midpoint)" % \ + self.volume_range()[:2]) + parser.add_argument("input_file", help="Input file (complex samples)") + parser.add_argument("output_file", help="Output WAV file") - (options, args) = parser.parse_args() - if len(args) != 2: - parser.print_help() - sys.exit(1) - - input_filename = args[0] - output_filename = args[1] + args = parser.parse_args() self.vol = 0 # build graph - self.src = blocks.file_source(gr.sizeof_gr_complex, input_filename, False) + self.src = blocks.file_source(gr.sizeof_gr_complex, args.input_file, False) adc_rate = 64e6 # 64 MS/s usrp_decim = 200 @@ -80,10 +76,10 @@ class wfm_rx_block (gr.top_block): # wave file as final sink if 1: - sink = blocks.wavfile_sink(output_filename, 2, int(audio_rate), 16) + sink = blocks.wavfile_sink(args.output_file, 2, int(audio_rate), 16) else: sink = audio.sink (int (audio_rate), - options.audio_output, + args.audio_output, False) # ok_to_block # now wire it all together @@ -96,15 +92,15 @@ class wfm_rx_block (gr.top_block): pass #print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet" - if options.volume is None: + if args.volume is None: g = self.volume_range() - options.volume = float(g[0]+g[1])/2 + args.volume = float(g[0]+g[1])/2 # set initial values - self.set_vol(options.volume) + self.set_vol(args.volume) try: - self.guts.stereo_carrier_pll_recovery.set_lock_threshold(options.squelch) + self.guts.stereo_carrier_pll_recovery.set_lock_threshold(args.squelch) except: pass #print "FYI: This implementation of the stereo_carrier_pll_recovery has no squelch implementation yet" diff --git a/gnuradio-runtime/examples/network/CMakeLists.txt b/gnuradio-runtime/examples/network/CMakeLists.txt index 92eb734768..08f498b469 100644 --- a/gnuradio-runtime/examples/network/CMakeLists.txt +++ b/gnuradio-runtime/examples/network/CMakeLists.txt @@ -25,6 +25,4 @@ GR_PYTHON_INSTALL(PROGRAMS vector_sink.py vector_source.py DESTINATION ${GR_PKG_DATA_DIR}/examples/network - COMPONENT "runtime_python" ) - diff --git a/gnuradio-runtime/examples/network/audio_sink.py b/gnuradio-runtime/examples/network/audio_sink.py index de20abe48d..9b91db5d1e 100755 --- a/gnuradio-runtime/examples/network/audio_sink.py +++ b/gnuradio-runtime/examples/network/audio_sink.py @@ -22,8 +22,7 @@ from gnuradio import gr from gnuradio import blocks -from gnuradio.eng_option import eng_option -from optparse import OptionParser +from argparse import ArgumentParser import sys try: @@ -40,26 +39,22 @@ class audio_sink(gr.top_block): self.connect(src, dst) if __name__ == '__main__': - parser = OptionParser(option_class=eng_option) - parser.add_option("", "--host", type="string", default="0.0.0.0", + parser = ArgumentParser() + parser.add_argument("--host", default="0.0.0.0", help="local host name (domain name or IP address)") - parser.add_option("", "--port", type="int", default=65500, + parser.add_argument("--port", type=int, default=65500, help="port value to listen to for connection") - parser.add_option("", "--packet-size", type="int", default=1472, + parser.add_argument("--packet-size", type=int, default=1472, help="packet size.") - parser.add_option("-r", "--sample-rate", type="int", default=32000, - help="audio signal sample rate [default=%default]") - parser.add_option("", "--no-eof", action="store_true", default=False, + parser.add_argument("-r", "--sample-rate", type=int, default=32000, + help="audio signal sample rate [default=%(default)r]") + parser.add_argument("--no-eof", action="store_true", default=False, help="don't send EOF on disconnect") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - + args = parser.parse_args() # Create an instance of a hierarchical block - top_block = audio_sink(options.host, options.port, - options.packet_size, options.sample_rate, - not options.no_eof) + top_block = audio_sink(args.host, args.port, + args.packet_size, args.sample_rate, + not args.no_eof) try: # Run forever diff --git a/gnuradio-runtime/examples/network/audio_source.py b/gnuradio-runtime/examples/network/audio_source.py index 881efff81a..6a464a8f28 100755 --- a/gnuradio-runtime/examples/network/audio_source.py +++ b/gnuradio-runtime/examples/network/audio_source.py @@ -22,8 +22,7 @@ from gnuradio import gr from gnuradio import blocks -from gnuradio.eng_option import eng_option -from optparse import OptionParser +from argparse import ArgumentParser import sys try: @@ -36,30 +35,26 @@ class audio_source(gr.top_block): def __init__(self, host, port, pkt_size, sample_rate, eof): gr.top_block.__init__(self, "audio_source") self.audio = audio.source(sample_rate) - self.sink = blocks.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) + self.sink = blocks.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) self.connect(self.audio, self.sink) if __name__ == '__main__': - parser = OptionParser(option_class=eng_option) - parser.add_option("", "--host", type="string", default="127.0.0.1", + parser = ArgumentParser() + parser.add_argument("--host", default="127.0.0.1", help="Remote host name (domain name or IP address") - parser.add_option("", "--port", type="int", default=65500, + parser.add_argument("--port", type=int, default=65500, help="port number to connect to") - parser.add_option("", "--packet-size", type="int", default=1472, + parser.add_argument("--packet-size", type=int, default=1472, help="packet size.") - parser.add_option("-r", "--sample-rate", type="int", default=32000 , - help="audio signal sample rate [default=%default]") - parser.add_option("", "--no-eof", action="store_true", default=False, + parser.add_argument("-r", "--sample-rate", type=int, default=32000 , + help="audio signal sample rate [default=%(default)r]") + parser.add_argument("--no-eof", action="store_true", default=False, help="don't send EOF on disconnect") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - + args = parser.parse_args() # Create an instance of a hierarchical block - top_block = audio_source(options.host, options.port, - options.packet_size, options.sample_rate, - not options.no_eof) + top_block = audio_source(args.host, args.port, + args.packet_size, args.sample_rate, + not args.no_eof) try: # Run forever diff --git a/gnuradio-runtime/examples/network/dial_tone_sink.py b/gnuradio-runtime/examples/network/dial_tone_sink.py index 7139a13250..4b1db98649 100755 --- a/gnuradio-runtime/examples/network/dial_tone_sink.py +++ b/gnuradio-runtime/examples/network/dial_tone_sink.py @@ -22,8 +22,7 @@ from gnuradio import gr, audio from gnuradio import blocks -from gnuradio.eng_option import eng_option -from optparse import OptionParser +from argparse import ArgumentParser class dial_tone_sink(gr.top_block): def __init__(self, host, port, pkt_size, sample_rate, eof): @@ -33,26 +32,22 @@ class dial_tone_sink(gr.top_block): self.connect(udp, sink) if __name__ == '__main__': - parser = OptionParser(option_class=eng_option) - parser.add_option("", "--host", type="string", default="0.0.0.0", + parser = ArgumentParser() + parser.add_argument("--host", default="0.0.0.0", help="local host name (domain name or IP address)") - parser.add_option("", "--port", type="int", default=65500, + parser.add_argument("--port", type=int, default=65500, help="port value to listen to for connection") - parser.add_option("", "--packet-size", type="int", default=1472, + parser.add_argument("--packet-size", type=int, default=1472, help="packet size.") - parser.add_option("-r", "--sample-rate", type="int", default=8000, - help="audio signal sample rate [default=%default]") - parser.add_option("", "--no-eof", action="store_true", default=False, + parser.add_argument("-r", "--sample-rate", type=int, default=8000, + help="audio signal sample rate [default=%(default)r]") + parser.add_argument("--no-eof", action="store_true", default=False, help="don't send EOF on disconnect") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - + args = parser.parse_args() # Create an instance of a hierarchical block - top_block = dial_tone_sink(options.host, options.port, - options.packet_size, options.sample_rate, - not options.no_eof) + top_block = dial_tone_sink(args.host, args.port, + args.packet_size, args.sample_rate, + not args.no_eof) try: # Run forever diff --git a/gnuradio-runtime/examples/network/dial_tone_source.py b/gnuradio-runtime/examples/network/dial_tone_source.py index 20c9a3b800..ee2bc9529b 100755 --- a/gnuradio-runtime/examples/network/dial_tone_source.py +++ b/gnuradio-runtime/examples/network/dial_tone_source.py @@ -21,8 +21,7 @@ # from gnuradio import gr -from gnuradio.eng_option import eng_option -from optparse import OptionParser +from argparse import ArgumentParser import sys try: @@ -45,33 +44,29 @@ class dial_tone_source(gr.top_block): add = blocks.add_ff() # Throttle needed here to account for the other side's audio card sampling rate - thr = blocks.throttle(gr.sizeof_float, sample_rate) - sink = blocks.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) - self.connect(src0, (add, 0)) - self.connect(src1, (add, 1)) - self.connect(add, thr, sink) + thr = blocks.throttle(gr.sizeof_float, sample_rate) + sink = blocks.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) + self.connect(src0, (add, 0)) + self.connect(src1, (add, 1)) + self.connect(add, thr, sink) if __name__ == '__main__': - parser = OptionParser(option_class=eng_option) - parser.add_option("", "--host", type="string", default="127.0.0.1", + parser = ArgumentParser() + parser.add_argument("--host", default="127.0.0.1", help="Remote host name (domain name or IP address") - parser.add_option("", "--port", type="int", default=65500, + parser.add_argument("--port", type=int, default=65500, help="port number to connect to") - parser.add_option("", "--packet-size", type="int", default=1472, + parser.add_argument("--packet-size", type=int, default=1472, help="packet size.") - parser.add_option("-r", "--sample-rate", type="int", default=8000, - help="audio signal sample rate [default=%default]") - parser.add_option("", "--no-eof", action="store_true", default=False, + parser.add_argument("-r", "--sample-rate", type=int, default=8000, + help="audio signal sample rate [default=%(default)r]") + parser.add_argument("--no-eof", action="store_true", default=False, help="don't send EOF on disconnect") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - + args = parser.parse_args() # Create an instance of a hierarchical block - top_block = dial_tone_source(options.host, options.port, - options.packet_size, options.sample_rate, - not options.no_eof) + top_block = dial_tone_source(args.host, args.port, + args.packet_size, args.sample_rate, + not args.no_eof) try: # Run forever diff --git a/gnuradio-runtime/examples/network/vector_sink.py b/gnuradio-runtime/examples/network/vector_sink.py index c756f36f42..362f631380 100755 --- a/gnuradio-runtime/examples/network/vector_sink.py +++ b/gnuradio-runtime/examples/network/vector_sink.py @@ -22,8 +22,8 @@ from gnuradio import gr from gnuradio import blocks -from gnuradio.eng_option import eng_option -from optparse import OptionParser +from gnuradio.eng_arg import eng_float, intx +from argparse import ArgumentParser class vector_sink(gr.top_block): def __init__(self, host, port, pkt_size, eof): @@ -34,24 +34,20 @@ class vector_sink(gr.top_block): self.connect(udp, sink) if __name__ == "__main__": - parser = OptionParser(option_class=eng_option) - parser.add_option("", "--host", type="string", default="0.0.0.0", + parser = ArgumentParser() + parser.add_argument("-H", "--host", default="0.0.0.0", help="local host name (domain name or IP address)") - parser.add_option("", "--port", type="int", default=65500, + parser.add_argument("-p", "--port", type=int, default=65500, help="port value to listen to for connection") - parser.add_option("", "--packet-size", type="int", default=1471, + parser.add_argument("-s", "--packet-size", type=int, default=1471, help="packet size.") - parser.add_option("", "--no-eof", action="store_true", default=False, + parser.add_argument("--no-eof", action="store_true", default=False, help="don't send EOF on disconnect") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - + args = parser.parse_args() # Create an instance of a hierarchical block - top_block = vector_sink(options.host, options.port, - options.packet_size, - not options.no_eof) + top_block = vector_sink(args.host, args.port, + args.packet_size, + not args.no_eof) try: # Run forever diff --git a/gnuradio-runtime/examples/network/vector_source.py b/gnuradio-runtime/examples/network/vector_source.py index c13b4b1d6f..be40134bc0 100755 --- a/gnuradio-runtime/examples/network/vector_source.py +++ b/gnuradio-runtime/examples/network/vector_source.py @@ -22,8 +22,7 @@ from gnuradio import gr from gnuradio import blocks -from gnuradio.eng_option import eng_option -from optparse import OptionParser +from argparse import ArgumentParser class vector_source(gr.top_block): def __init__(self, host, port, pkt_size, eof): @@ -34,23 +33,19 @@ class vector_source(gr.top_block): self.connect(vec, udp) if __name__ == '__main__': - parser = OptionParser(option_class=eng_option) - parser.add_option("", "--host", type="string", default="127.0.0.1", + parser = ArgumentParser() + parser.add_argument("--host", default="127.0.0.1", help="Remote host name (domain name or IP address") - parser.add_option("", "--port", type="int", default=65500, + parser.add_argument("--port", type=int, default=65500, help="port number to connect to") - parser.add_option("", "--packet-size", type="int", default=1471, + parser.add_argument("--packet-size", type=int, default=1471, help="packet size.") - parser.add_option("", "--no-eof", action="store_true", default=False, + parser.add_argument("--no-eof", action="store_true", default=False, help="don't send EOF on disconnect") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - + args = parser.parse_args() # Create an instance of a hierarchical block - top_block = vector_source(options.host, options.port, options.packet_size, - not options.no_eof) + top_block = vector_source(args.host, args.port, args.packet_size, + not args.no_eof) try: # Run forever diff --git a/gnuradio-runtime/examples/volk_benchmark/CMakeLists.txt b/gnuradio-runtime/examples/volk_benchmark/CMakeLists.txt index f56675e556..076ef359e8 100644 --- a/gnuradio-runtime/examples/volk_benchmark/CMakeLists.txt +++ b/gnuradio-runtime/examples/volk_benchmark/CMakeLists.txt @@ -25,11 +25,9 @@ GR_PYTHON_INSTALL(PROGRAMS volk_test_funcs.py volk_types.py DESTINATION ${GR_PKG_DATA_DIR}/examples/volk_benchmark - COMPONENT "runtime_python" ) install( FILES README DESTINATION ${GR_PKG_DATA_DIR}/examples/volk_benchmark - COMPONENT "runtime_python" ) diff --git a/gnuradio-runtime/include/gnuradio/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/CMakeLists.txt index 472f91847b..230f8d6e6d 100644 --- a/gnuradio-runtime/include/gnuradio/CMakeLists.txt +++ b/gnuradio-runtime/include/gnuradio/CMakeLists.txt @@ -44,6 +44,7 @@ install(FILES hier_block2.h high_res_timer.h io_signature.h + logger.h math.h message.h misc.h @@ -81,9 +82,7 @@ install(FILES rpcserver_booter_aggregator.h rpcserver_booter_base.h rpcserver_selector.h - ${CMAKE_CURRENT_BINARY_DIR}/logger.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "runtime_devel" ) if(THRIFT_FOUND) @@ -92,14 +91,5 @@ install(FILES thrift_application_base.h thrift_server_template.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "runtime_devel" ) endif(THRIFT_FOUND) - -########################################################################## -# Configure logger -########################################################################## -CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/logger.h.in - ${CMAKE_CURRENT_BINARY_DIR}/logger.h -) diff --git a/gnuradio-runtime/include/gnuradio/basic_block.h b/gnuradio-runtime/include/gnuradio/basic_block.h index 25d9fb5a78..7c343220b9 100644 --- a/gnuradio-runtime/include/gnuradio/basic_block.h +++ b/gnuradio-runtime/include/gnuradio/basic_block.h @@ -252,13 +252,6 @@ namespace gr { */ pmt::pmt_t delete_head_nowait( pmt::pmt_t which_port); - /*! - * \param[in] which_port The message port from which to get the message. - * \param[in] millisec Optional timeout value (0=no timeout). - * \returns returns pmt at head of queue or pmt::pmt_t() if empty. - */ - pmt::pmt_t delete_head_blocking(pmt::pmt_t which_port, unsigned int millisec = 0); - msg_queue_t::iterator get_iterator(pmt::pmt_t which_port) { return msg_queue[which_port].begin(); } @@ -376,14 +369,15 @@ namespace gr { d_msg_handlers[which_port] = msg_handler_t(msg_handler); } - virtual void set_processor_affinity(const std::vector<int> &mask) - { throw std::runtime_error("set_processor_affinity not overloaded in child class."); } + virtual void set_processor_affinity(const std::vector<int> &mask) = 0; + + virtual void unset_processor_affinity() = 0; + + virtual std::vector<int> processor_affinity() = 0; - virtual void unset_processor_affinity() - { throw std::runtime_error("unset_processor_affinity not overloaded in child class."); } + virtual void set_log_level(std::string level) = 0; - virtual std::vector<int> processor_affinity() - { throw std::runtime_error("processor_affinity not overloaded in child class."); } + virtual std::string log_level() = 0; }; inline bool operator<(basic_block_sptr lhs, basic_block_sptr rhs) diff --git a/gnuradio-runtime/include/gnuradio/block.h b/gnuradio-runtime/include/gnuradio/block.h index 3e85f22823..21d41c0b63 100644 --- a/gnuradio-runtime/include/gnuradio/block.h +++ b/gnuradio-runtime/include/gnuradio/block.h @@ -633,6 +633,30 @@ namespace gr { */ void system_handler(pmt::pmt_t msg); + /*! + * \brief Set the logger's output level. + * + * Sets the level of the logger. This takes a string that is + * translated to the standard levels and can be (case insensitive): + * + * \li off , notset + * \li debug + * \li info + * \li notice + * \li warn + * \li error + * \li crit + * \li alert + * \li fatal + * \li emerg + */ + void set_log_level(std::string level); + + /*! + * \brief Get the logger's output level + */ + std::string log_level(); + /*! * \brief returns true when execution has completed due to a message connection */ diff --git a/gnuradio-runtime/include/gnuradio/hier_block2.h b/gnuradio-runtime/include/gnuradio/hier_block2.h index 08a5389e96..b7c6be2441 100644 --- a/gnuradio-runtime/include/gnuradio/hier_block2.h +++ b/gnuradio-runtime/include/gnuradio/hier_block2.h @@ -267,6 +267,31 @@ namespace gr { std::vector<int> processor_affinity(); /*! + * \brief Set the logger's output level. + * + * Sets the level of the logger for all connected blocks. This takes + * a string that is translated to the standard levels and can be + * (case insensitive): + * + * \li off , notset + * \li debug + * \li info + * \li notice + * \li warn + * \li error + * \li crit + * \li alert + * \li fatal + * \li emerg + */ + void set_log_level(std::string level); + + /*! + * \brief Get the logger's output level + */ + std::string log_level(); + + /*! * \brief Get if all block min buffers should be set. * * \details this returns whether all the block min output buffers diff --git a/gnuradio-runtime/include/gnuradio/logger.h.in b/gnuradio-runtime/include/gnuradio/logger.h index 08cb209c7b..74b9ee2ea5 100644 --- a/gnuradio-runtime/include/gnuradio/logger.h.in +++ b/gnuradio-runtime/include/gnuradio/logger.h @@ -20,12 +20,6 @@ * Boston, MA 02110-1301, USA. */ -/******************************************************************************* -* Author: Mark Plett -* Description: -* The gr::logger module wraps the log4cpp library for logging in gnuradio -*******************************************************************************/ - #ifndef INCLUDED_GR_LOGGER_H #define INCLUDED_GR_LOGGER_H @@ -35,15 +29,8 @@ * */ -#ifndef ENABLE_GR_LOG -#cmakedefine ENABLE_GR_LOG -#endif -#ifndef HAVE_LOG4CPP -#cmakedefine HAVE_LOG4CPP -#endif - #ifdef _MSC_VER -typedef unsigned short mode_t; +typedef int mode_t; #else #include <sys/types.h> #endif @@ -56,71 +43,6 @@ typedef unsigned short mode_t; #include <boost/thread.hpp> #include <boost/format.hpp> #include <pmt/pmt.h> - -#ifdef ENABLE_GR_LOG - -// We have three configurations... first logging to stdout/stderr -#ifndef HAVE_LOG4CPP - -namespace gr { - //#warning GR logging Enabled and using std::cout - typedef std::string logger_ptr; -} /* namespace gr */ - -#define GR_LOG_DECLARE_LOGPTR(logger) -#define GR_LOG_ASSIGN_LOGPTR(logger,name) -#define GR_CONFIG_LOGGER(config) -#define GR_CONFIG_AND_WATCH_LOGGER(config,period) -#define GR_LOG_GETLOGGER(logger, name) -#define GR_SET_LEVEL(name, level) -#define GR_LOG_SET_LEVEL(logger, level) -#define GR_GET_LEVEL(name, level) -#define GR_LOG_GET_LEVEL(logger, level) -#define GR_ADD_APPENDER(name,appender) -#define GR_LOG_ADD_APPENDER(logger,appender) -#define GR_SET_APPENDER(name,appender) -#define GR_LOG_SET_APPENDER(logger,appender) -#define GR_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_SET_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_SET_CONSOLE_APPENDER(logger,target,pattern) -#define GR_ADD_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern) -#define GR_SET_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_SET_FILE_APPENDER(logger,filename,append,pattern) -#define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern) -#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern) -#define GR_GET_LOGGER_NAMES(names) -#define GR_RESET_CONFIGURATION() -#define GR_DEBUG(name, msg) std::cout<<"DEBUG: "<<msg<<std::endl -#define GR_INFO(name, msg) std::cout<<"INFO: "<<msg<<std::endl -#define GR_NOTICE(name, msg) std::cout<<"NOTICE: "<<msg<<std::endl -#define GR_WARN(name, msg) std::cerr<<"WARN: "<<msg<<std::endl -#define GR_ERROR(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_ALERT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_CRIT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_FATAL(name, msg) std::cerr<<"FATAL: "<<msg<<std::endl -#define GR_EMERG(name, msg) std::cerr<<"EMERG: "<<msg<<std::endl -#define GR_ERRORIF(name, cond, msg) {if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;} -#define GR_ASSERT(name, cond, msg) {if(!(cond)) std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);} -#define GR_LOG_DEBUG(logger, msg) std::cout<<"DEBUG: "<<msg<<std::endl -#define GR_LOG_INFO(logger, msg) std::cout<<"INFO: "<<msg<<std::endl -#define GR_LOG_NOTICE(logger, msg) std::cout<<"NOTICE: "<<msg<<std::endl -#define GR_LOG_WARN(logger, msg) std::cerr<<"WARN: "<<msg<<std::endl -#define GR_LOG_ERROR(logger, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_LOG_ALERT(logger, msg) std::cerr<<"ALERT: "<<msg<<std::endl -#define GR_LOG_CRIT(logger, msg) std::cerr<<"CRIT: "<<msg<<std::endl -#define GR_LOG_FATAL(logger, msg) std::cerr<<"FATAL: "<<msg<<std::endl -#define GR_LOG_EMERG(logger, msg) std::cerr<<"EMERG: "<<msg<<std::endl -#define GR_LOG_ERRORIF(logger, cond, msg) { \ - if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;} -#define GR_LOG_ASSERT(logger, cond, msg) { \ - if(!(cond)) {std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);};} - - -#else /* HAVE_LOG4CPP */ - -// Second configuration...logging to log4cpp #include <log4cpp/Category.hh> #include <log4cpp/PropertyConfigurator.hh> #include <log4cpp/FileAppender.hh> @@ -181,20 +103,6 @@ namespace gr { #define GR_LOG_GET_LEVEL(logger, level) \ gr::logger_get_level(logger,level); -#define GR_ADD_APPENDER(name, appender) { \ - gr::logger_ptr logger = gr::logger_get_logger(name); \ - gr::logger_add_appender(logger,appender);} - -#define GR_LOG_ADD_APPENDER(logger, appender) { \ - gr::logger_add_appender(logger, appender);} - -#define GR_SET_APPENDER(name, appender) { \ - gr::logger_ptr logger = gr::logger_get_logger(name); \ - gr::logger_set_appender(logger,appender);} - -#define GR_LOG_SET_APPENDER(logger, appender) { \ - gr::logger_set_appender(logger, appender);} - #define GR_ADD_CONSOLE_APPENDER(name, target, pattern) { \ gr::logger_ptr logger = gr::logger_get_logger(name); \ gr::logger_add_console_appender(logger,target,pattern);} @@ -640,70 +548,9 @@ namespace gr { } /* namespace gr */ -#endif /* HAVE_LOG4CPP */ - // If Logger disable do nothing -#else /* ENABLE_GR_LOG */ - -namespace gr { - typedef void* logger_ptr; -} /* namespace gr */ - -#define GR_LOG_DECLARE_LOGPTR(logger) -#define GR_LOG_ASSIGN_LOGPTR(logger,name) -#define GR_CONFIG_LOGGER(config) -#define GR_CONFIG_AND_WATCH_LOGGER(config,period) -#define GR_LOG_GETLOGGER(logger, name) -#define GR_SET_LEVEL(name, level) -#define GR_LOG_SET_LEVEL(logger, level) -#define GR_GET_LEVEL(name, level) -#define GR_LOG_GET_LEVEL(logger, level) -#define GR_ADD_APPENDER(name,appender) -#define GR_LOG_ADD_APPENDER(logger,appender) -#define GR_SET_APPENDER(name,appender) -#define GR_LOG_SET_APPENDER(logger,appender) -#define GR_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_SET_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_SET_CONSOLE_APPENDER(logger,target,pattern) -#define GR_ADD_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern) -#define GR_SET_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_SET_FILE_APPENDER(logger,filename,append,pattern) -#define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern) -#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern) -#define GR_GET_LOGGER_NAMES(names) -#define GR_RESET_CONFIGURATION() -#define GR_DEBUG(name, msg) -#define GR_INFO(name, msg) -#define GR_NOTICE(name, msg) -#define GR_WARN(name, msg) -#define GR_ERROR(name, msg) -#define GR_ALERT(name, msg) -#define GR_CRIT(name, msg) -#define GR_FATAL(name, msg) -#define GR_EMERG(name, msg) -#define GR_ERRORIF(name, cond, msg) -#define GR_ASSERT(name, cond, msg) -#define GR_LOG_DEBUG(logger, msg) -#define GR_LOG_INFO(logger, msg) -#define GR_LOG_NOTICE(logger, msg) -#define GR_LOG_WARN(logger, msg) -#define GR_LOG_ERROR(logger, msg) -#define GR_LOG_ALERT(logger, msg) -#define GR_LOG_CRIT(logger, msg) -#define GR_LOG_FATAL(logger, msg) -#define GR_LOG_EMERG(logger, msg) -#define GR_LOG_ERRORIF(logger, cond, msg) -#define GR_LOG_ASSERT(logger, cond, msg) - -#endif /* ENABLE_GR_LOG */ - namespace gr { - // Even if logger is disabled we'll need for methods below to exist in python. - // The macros these call will be disabled if ENABLE_GR_LOG is undefined - /********************* Start Classes and Methods for Python ******************/ /*! * \brief Logger class for referencing loggers in python. Not @@ -769,18 +616,6 @@ namespace gr { /*! \brief inline function, wrapper for LOG4CPP_ASSERT for conditional ERROR message */ void log_assert(bool cond,std::string msg){GR_LOG_ASSERT(d_logger,cond,msg);} - /*! \brief inline function, Method to add appender to logger by - name (define appender in conf file) */ - void add_appender(std::string appender) { - GR_LOG_ADD_APPENDER(d_logger, appender); - } - - /*! \brief inline function, Method to set an appender to logger by - name (define appender in conf file) */ - void set_appender(std::string appender) { - GR_LOG_SET_APPENDER(d_logger, appender); - } - /*! \brief inline function, Method to add console appender to logger */ void add_console_appender(std::string target,std::string pattern) { GR_LOG_ADD_CONSOLE_APPENDER(d_logger, target, pattern); @@ -853,5 +688,4 @@ namespace gr { } /* namespace gr */ - #endif /* INCLUDED_GR_LOGGER_H */ diff --git a/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt index f79f2bd24f..7504cfeeb1 100644 --- a/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt +++ b/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt @@ -27,5 +27,4 @@ install(FILES msg_producer.h msg_queue.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/messages - COMPONENT "runtime_devel" ) diff --git a/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt index 8ea4bfc66e..b9a4a98c13 100644 --- a/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt +++ b/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt @@ -25,5 +25,4 @@ install(FILES thread_body_wrapper.h thread_group.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/thread - COMPONENT "runtime_devel" ) diff --git a/gnuradio-runtime/include/gnuradio/tpb_detail.h b/gnuradio-runtime/include/gnuradio/tpb_detail.h index 9b7454b508..4e660144f2 100644 --- a/gnuradio-runtime/include/gnuradio/tpb_detail.h +++ b/gnuradio-runtime/include/gnuradio/tpb_detail.h @@ -58,7 +58,10 @@ namespace gr { //! Called by pmt msg posters void notify_msg() { + gr::thread::scoped_lock guard(mutex); + input_changed = true; input_cond.notify_one(); + output_changed = true; output_cond.notify_one(); } diff --git a/gnuradio-runtime/include/gnuradio/types.h b/gnuradio-runtime/include/gnuradio/types.h index 6cb0f72834..c91538e60e 100644 --- a/gnuradio-runtime/include/gnuradio/types.h +++ b/gnuradio-runtime/include/gnuradio/types.h @@ -37,29 +37,6 @@ typedef std::vector<double> gr_vector_double; typedef std::vector<void *> gr_vector_void_star; typedef std::vector<const void *> gr_vector_const_void_star; -/* - * #include <config.h> must be placed beforehand - * in the source file including gnuradio/types.h for - * the following to work correctly - */ -#ifdef HAVE_STDINT_H #include <stdint.h> -typedef int16_t gr_int16; -typedef int32_t gr_int32; -typedef int64_t gr_int64; -typedef uint16_t gr_uint16; -typedef uint32_t gr_uint32; -typedef uint64_t gr_uint64; -#else -/* - * Note: these defaults may be wrong on 64-bit systems - */ -typedef short gr_int16; -typedef int gr_int32; -typedef long long gr_int64; -typedef unsigned short gr_uint16; -typedef unsigned int gr_uint32; -typedef unsigned long long gr_uint64; -#endif /* HAVE_STDINT_H */ #endif /* INCLUDED_GR_TYPES_H */ diff --git a/gnuradio-runtime/include/pmt/CMakeLists.txt b/gnuradio-runtime/include/pmt/CMakeLists.txt index 4ae0e22431..f4a541e0dd 100644 --- a/gnuradio-runtime/include/pmt/CMakeLists.txt +++ b/gnuradio-runtime/include/pmt/CMakeLists.txt @@ -26,4 +26,4 @@ install(FILES pmt_pool.h pmt_sugar.h DESTINATION ${GR_INCLUDE_DIR}/pmt - COMPONENT "runtime_devel") +) diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt index 3da550d37b..c6e42876ce 100644 --- a/gnuradio-runtime/lib/CMakeLists.txt +++ b/gnuradio-runtime/lib/CMakeLists.txt @@ -106,9 +106,7 @@ list(APPEND gnuradio_runtime_sources realtime.cc realtime_impl.cc scheduler.cc - scheduler_sts.cc scheduler_tpb.cc - single_threaded_scheduler.cc sptr_magic.cc sync_block.cc sync_decimator.cc @@ -203,7 +201,7 @@ endif(TRY_SHM_VMCIRCBUF) ####################################################### add_library(gnuradio-runtime SHARED ${gnuradio_runtime_sources}) target_link_libraries(gnuradio-runtime ${gnuradio_runtime_libs}) -GR_LIBRARY_FOO(gnuradio-runtime RUNTIME_COMPONENT "runtime_runtime" DEVEL_COMPONENT "runtime_devel") +GR_LIBRARY_FOO(gnuradio-runtime) add_dependencies(gnuradio-runtime pmt_generated runtime_generated_includes @@ -241,7 +239,7 @@ if(ENABLE_STATIC_LIBS) endif(NOT WIN32) install(TARGETS gnuradio-runtime_static - ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "runtime_devel" # .lib file + ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file ) endif(ENABLE_STATIC_LIBS) diff --git a/gnuradio-runtime/lib/basic_block.cc b/gnuradio-runtime/lib/basic_block.cc index 082d0753c8..89aa9b8671 100644 --- a/gnuradio-runtime/lib/basic_block.cc +++ b/gnuradio-runtime/lib/basic_block.cc @@ -228,29 +228,6 @@ namespace gr { } pmt::pmt_t - basic_block::delete_head_blocking(pmt::pmt_t which_port, unsigned int millisec) - { - gr::thread::scoped_lock guard(mutex); - - if (millisec) { - boost::system_time const timeout = boost::get_system_time() + boost::posix_time::milliseconds(millisec); - while (empty_p(which_port)) { - if (!msg_queue_ready[which_port]->timed_wait(guard, timeout)) { - return pmt::pmt_t(); - } - } - } else { - while(empty_p(which_port)) { - msg_queue_ready[which_port]->wait(guard); - } - } - - pmt::pmt_t m(msg_queue[which_port].front()); - msg_queue[which_port].pop_front(); - return m; - } - - pmt::pmt_t basic_block::message_subscribers(pmt::pmt_t port) { return pmt::dict_ref(d_message_subscribers,port,pmt::PMT_NIL); diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc index 2bae8ea9f8..4c408ab7ed 100644 --- a/gnuradio-runtime/lib/block.cc +++ b/gnuradio-runtime/lib/block.cc @@ -707,8 +707,7 @@ namespace gr { //std::cout << "system_handler " << msg << "\n"; pmt::pmt_t op = pmt::car(msg); if(pmt::eqv(op, pmt::mp("done"))){ - d_finished = pmt::to_long(pmt::cdr(msg)); - global_block_registry.notify_blk(alias()); + d_finished = pmt::to_bool(pmt::cdr(msg)); } else { std::cout << "WARNING: bad message op on system port!\n"; pmt::print(msg); @@ -716,6 +715,20 @@ namespace gr { } void + block::set_log_level(std::string level) + { + logger_set_level(d_logger, level); + } + + std::string + block::log_level() + { + std::string level; + logger_get_level(d_logger, level); + return level; + } + + void block::notify_msg_neighbors() { size_t len = pmt::length(d_message_subscribers); @@ -737,7 +750,7 @@ namespace gr { currlist = pmt::cdr(currlist); basic_block_sptr blk = global_block_registry.block_lookup(block); - blk->post(port, pmt::cons(pmt::mp("done"), pmt::mp(true))); + blk->post(port, pmt::cons(pmt::mp("done"), pmt::PMT_T)); //std::cout << "notify finished --> "; //pmt::print(pmt::cons(block,port)); @@ -750,7 +763,7 @@ namespace gr { bool block::finished() { - if((detail()->ninputs() != 0) || (detail()->noutputs() != 0)) + if(detail()->ninputs() != 0) return false; else return d_finished; diff --git a/gnuradio-runtime/lib/controlport/CMakeLists.txt b/gnuradio-runtime/lib/controlport/CMakeLists.txt index c9bdeb949e..80d31fc721 100644 --- a/gnuradio-runtime/lib/controlport/CMakeLists.txt +++ b/gnuradio-runtime/lib/controlport/CMakeLists.txt @@ -84,7 +84,6 @@ list(APPEND gnuradio_runtime_libs install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/thrift/thrift.conf.example DESTINATION ${SYSCONFDIR}/${CMAKE_PROJECT_NAME} - COMPONENT "runtime_runtime" ) endif(THRIFT_FOUND) diff --git a/gnuradio-runtime/lib/hier_block2.cc b/gnuradio-runtime/lib/hier_block2.cc index 597ae032ec..8ebbbda587 100644 --- a/gnuradio-runtime/lib/hier_block2.cc +++ b/gnuradio-runtime/lib/hier_block2.cc @@ -178,6 +178,18 @@ namespace gr { return d_detail->processor_affinity(); } + void + hier_block2::set_log_level(std::string level) + { + d_detail->set_log_level(level); + } + + std::string + hier_block2::log_level() + { + return d_detail->log_level(); + } + std::string dot_graph(hier_block2_sptr hierblock2) { diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc b/gnuradio-runtime/lib/hier_block2_detail.cc index 49eb34a6d1..e23ca2bd3d 100644 --- a/gnuradio-runtime/lib/hier_block2_detail.cc +++ b/gnuradio-runtime/lib/hier_block2_detail.cc @@ -952,4 +952,22 @@ namespace gr { return tmp[0]->processor_affinity(); } + void + hier_block2_detail::set_log_level(std::string level) + { + basic_block_vector_t tmp = d_fg->calc_used_blocks(); + for(basic_block_viter_t p = tmp.begin(); p != tmp.end(); p++) { + (*p)->set_log_level(level); + } + } + + std::string + hier_block2_detail::log_level() + { + // Assume that log_level was set for all hier_block2 blocks + basic_block_vector_t tmp = d_fg->calc_used_blocks(); + return tmp[0]->log_level(); + } + + } /* namespace gr */ diff --git a/gnuradio-runtime/lib/hier_block2_detail.h b/gnuradio-runtime/lib/hier_block2_detail.h index a5584fe92a..aa419c49bd 100644 --- a/gnuradio-runtime/lib/hier_block2_detail.h +++ b/gnuradio-runtime/lib/hier_block2_detail.h @@ -57,6 +57,9 @@ namespace gr { void set_processor_affinity(const std::vector<int> &mask); void unset_processor_affinity(); std::vector<int> processor_affinity(); + + void set_log_level(std::string level); + std::string log_level(); // Track output buffer min/max settings std::vector<size_t> d_max_output_buffer; diff --git a/gnuradio-runtime/lib/logger.cc b/gnuradio-runtime/lib/logger.cc index fd9a482c94..0bb898833b 100644 --- a/gnuradio-runtime/lib/logger.cc +++ b/gnuradio-runtime/lib/logger.cc @@ -35,10 +35,6 @@ #include <stdexcept> #include <algorithm> - -#ifdef ENABLE_GR_LOG -#ifdef HAVE_LOG4CPP - namespace gr { bool logger_config::logger_configured(false); @@ -311,8 +307,6 @@ namespace gr { } /* namespace gr */ -#endif /* HAVE_LOG4CPP */ - /****** Start Methods to provide Python the capabilities of the macros ********/ void gr_logger_config(const std::string config_filename, unsigned int watch_period) @@ -336,38 +330,12 @@ gr_logger_reset_config(void) // Remaining capability provided by gr::logger class in gnuradio/logger.h -#else /* ENABLE_GR_LOG */ - -/****** Start Methods to provide Python the capabilities of the macros ********/ -void -gr_logger_config(const std::string config_filename, unsigned int watch_period) -{ - //NOP -} - -std::vector<std::string> -gr_logger_get_logger_names(void) -{ - return std::vector<std::string>(1, ""); -} - -void -gr_logger_reset_config(void) -{ - //NOP -} - -#endif /* ENABLE_GR_LOG */ - - namespace gr { bool configure_default_loggers(gr::logger_ptr &l, gr::logger_ptr &d, const std::string name) { -#ifdef ENABLE_GR_LOG -#ifdef HAVE_LOG4CPP prefs *p = prefs::singleton(); std::string config_file = p->get_string("LOG", "log_config", ""); std::string log_level = p->get_string("LOG", "log_level", "off"); @@ -407,21 +375,11 @@ namespace gr { } d = DLOG; return true; -#endif /* HAVE_LOG4CPP */ - -#else /* ENABLE_GR_LOG */ - l = NULL; - d = NULL; - return false; -#endif /* ENABLE_GR_LOG */ - return false; } bool update_logger_alias(const std::string &name, const std::string &alias) { -#ifdef ENABLE_GR_LOG -#ifdef HAVE_LOG4CPP prefs *p = prefs::singleton(); std::string log_file = p->get_string("LOG", "log_file", ""); std::string debug_file = p->get_string("LOG", "debug_file", ""); @@ -442,10 +400,6 @@ namespace gr { } } return true; -#endif /* HAVE_LOG4CPP */ -#endif /* ENABLE_GR_LOG */ - - return false; } } /* namespace gr */ diff --git a/gnuradio-runtime/lib/pmt/CMakeLists.txt b/gnuradio-runtime/lib/pmt/CMakeLists.txt index 32c0e57a6a..e5c8f2f47e 100644 --- a/gnuradio-runtime/lib/pmt/CMakeLists.txt +++ b/gnuradio-runtime/lib/pmt/CMakeLists.txt @@ -44,7 +44,6 @@ add_custom_command( install( FILES ${PMT_SERIAL_TAGS_H} DESTINATION ${GR_INCLUDE_DIR}/pmt - COMPONENT "runtime_devel" ) include(AddFileDependencies) @@ -108,7 +107,7 @@ endif(MSVC) add_library(gnuradio-pmt SHARED ${pmt_sources}) target_link_libraries(gnuradio-pmt ${gnuradio_pmt_libs}) -GR_LIBRARY_FOO(gnuradio-pmt RUNTIME_COMPONENT "runtime_runtime" DEVEL_COMPONENT "runtime_devel") +GR_LIBRARY_FOO(gnuradio-pmt) add_dependencies(gnuradio-pmt pmt_generated @@ -125,7 +124,7 @@ if(ENABLE_STATIC_LIBS) endif(NOT WIN32) install(TARGETS gnuradio-pmt_static - ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "runtime_devel" # .lib file + ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file ) endif(ENABLE_STATIC_LIBS) diff --git a/gnuradio-runtime/lib/pmt/pmt.cc b/gnuradio-runtime/lib/pmt/pmt.cc index 3b92481549..da2a7e5cc2 100644 --- a/gnuradio-runtime/lib/pmt/pmt.cc +++ b/gnuradio-runtime/lib/pmt/pmt.cc @@ -63,7 +63,6 @@ pmt_base::operator delete(void *p, size_t size) #endif -#if ((BOOST_VERSION / 100000 >= 1) && (BOOST_VERSION / 100 % 1000 >= 53)) void intrusive_ptr_add_ref(pmt_base* p) { p->refcount_.fetch_add(1, boost::memory_order_relaxed); @@ -75,13 +74,6 @@ void intrusive_ptr_release(pmt_base* p) { delete p; } } -#else -// boost::atomic not available before 1.53 -// This section will be removed when support for boost 1.48 ceases -// NB: This code is prone to segfault on non-Intel architectures. -void intrusive_ptr_add_ref(pmt_base* p) { ++(p->count_); } -void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) delete p; } -#endif pmt_base::~pmt_base() { diff --git a/gnuradio-runtime/lib/pmt/pmt_int.h b/gnuradio-runtime/lib/pmt/pmt_int.h index da48a0ddc8..f06f507944 100644 --- a/gnuradio-runtime/lib/pmt/pmt_int.h +++ b/gnuradio-runtime/lib/pmt/pmt_int.h @@ -25,13 +25,7 @@ #include <pmt/pmt.h> #include <boost/utility.hpp> #include <boost/version.hpp> -#if ((BOOST_VERSION / 100000 >= 1) && (BOOST_VERSION / 100 % 1000 >= 53)) - #include <boost/atomic.hpp> -#else - // boost::atomic not available before 1.53 - // This section will be removed when support for boost 1.48 ceases - #include <boost/detail/atomic_count.hpp> -#endif +#include <boost/atomic.hpp> /* * EVERYTHING IN THIS FILE IS PRIVATE TO THE IMPLEMENTATION! @@ -43,23 +37,10 @@ namespace pmt { class PMT_API pmt_base : boost::noncopyable { - -#if ((BOOST_VERSION / 100000 >= 1) && (BOOST_VERSION / 100 % 1000 >= 53)) mutable boost::atomic<int> refcount_; -#else - // boost::atomic not available before 1.53 - // This section will be removed when support for boost 1.48 ceases - mutable boost::detail::atomic_count count_; -#endif protected: -#if ((BOOST_VERSION / 100000 >= 1) && (BOOST_VERSION / 100 % 1000 >= 53)) pmt_base() : refcount_(0) {}; -#else - // boost::atomic not available before 1.53 - // This section will be removed when support for boost 1.48 ceases - pmt_base() : count_(0) {}; -#endif virtual ~pmt_base(); public: diff --git a/gnuradio-runtime/lib/qa_logger.cc b/gnuradio-runtime/lib/qa_logger.cc index 904893cc4d..20d7392143 100644 --- a/gnuradio-runtime/lib/qa_logger.cc +++ b/gnuradio-runtime/lib/qa_logger.cc @@ -35,10 +35,6 @@ void qa_logger::t1() { -#ifdef ENABLE_GR_LOG - // This doesn't really test anything, more just - // making sure nothing's gone horribly wrong. - GR_LOG_GETLOGGER(LOG,"main"); GR_ADD_CONSOLE_APPENDER("main","cout","%d{%H:%M:%S} : %m%n"); GR_LOG_NOTICE(LOG,"test from c++ NOTICE"); @@ -48,5 +44,4 @@ qa_logger::t1() GR_LOG_ERROR(LOG,"test from c++ ERROR"); GR_LOG_FATAL(LOG,"test from c++ FATAL"); CPPUNIT_ASSERT(true); -#endif } diff --git a/gnuradio-runtime/lib/scheduler_sts.cc b/gnuradio-runtime/lib/scheduler_sts.cc deleted file mode 100644 index 19d05b2316..0000000000 --- a/gnuradio-runtime/lib/scheduler_sts.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "scheduler_sts.h" -#include "single_threaded_scheduler.h" -#include <gnuradio/thread/thread_body_wrapper.h> - -namespace gr { - - class sts_container - { - block_vector_t d_blocks; - - public: - sts_container(block_vector_t blocks) - : d_blocks(blocks) {} - - void operator()() - { - make_single_threaded_scheduler(d_blocks)->run(); - } - }; - - scheduler_sptr - scheduler_sts::make(flat_flowgraph_sptr ffg, int max_noutput_items) - { - return scheduler_sptr(new scheduler_sts(ffg, max_noutput_items)); - } - - scheduler_sts::scheduler_sts(flat_flowgraph_sptr ffg, int max_noutput_items) - : scheduler(ffg, max_noutput_items) - { - // Split the flattened flow graph into discrete partitions, each - // of which is topologically sorted. - - std::vector<basic_block_vector_t> graphs = ffg->partition(); - - // For each partition, create a thread to evaluate it using - // an instance of the gr_single_threaded_scheduler - - for(std::vector<basic_block_vector_t>::iterator p = graphs.begin(); - p != graphs.end(); p++) { - - block_vector_t blocks = flat_flowgraph::make_block_vector(*p); - d_threads.create_thread( - gr::thread::thread_body_wrapper<sts_container>(sts_container(blocks), - "single-threaded-scheduler")); - } - } - - scheduler_sts::~scheduler_sts() - { - stop(); - } - - void - scheduler_sts::stop() - { - d_threads.interrupt_all(); - } - - void - scheduler_sts::wait() - { - d_threads.join_all(); - } - -} /* namespace gr */ diff --git a/gnuradio-runtime/lib/scheduler_sts.h b/gnuradio-runtime/lib/scheduler_sts.h deleted file mode 100644 index b4cddb4614..0000000000 --- a/gnuradio-runtime/lib/scheduler_sts.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_GR_SCHEDULER_STS_H -#define INCLUDED_GR_SCHEDULER_STS_H - -#include <gnuradio/api.h> -#include <gnuradio/thread/thread_group.h> -#include "scheduler.h" - -namespace gr { - - /*! - * \brief Concrete scheduler that uses the single_threaded_scheduler - */ - class GR_RUNTIME_API scheduler_sts : public scheduler - { - gr::thread::thread_group d_threads; - - protected: - /*! - * \brief Construct a scheduler and begin evaluating the graph. - * - * The scheduler will continue running until all blocks until they - * report that they are done or the stop method is called. - */ - scheduler_sts(flat_flowgraph_sptr ffg, int max_noutput_items); - - public: - static scheduler_sptr make(flat_flowgraph_sptr ffg, - int max_noutput_items); - - ~scheduler_sts(); - - /*! - * \brief Tell the scheduler to stop executing. - */ - void stop(); - - /*! - * \brief Block until the graph is done. - */ - void wait(); - }; - -} /* namespace gr */ - -#endif /* INCLUDED_GR_SCHEDULER_STS_H */ diff --git a/gnuradio-runtime/lib/single_threaded_scheduler.cc b/gnuradio-runtime/lib/single_threaded_scheduler.cc deleted file mode 100644 index c86d26ca3a..0000000000 --- a/gnuradio-runtime/lib/single_threaded_scheduler.cc +++ /dev/null @@ -1,363 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "single_threaded_scheduler.h" -#include <gnuradio/block.h> -#include <gnuradio/block_detail.h> -#include <gnuradio/buffer.h> -#include <boost/thread.hpp> -#include <boost/format.hpp> -#include <iostream> -#include <limits> -#include <assert.h> -#include <stdio.h> - -namespace gr { - - // must be defined to either 0 or 1 -#define ENABLE_LOGGING 0 - -#if (ENABLE_LOGGING) -#define LOG(x) do { x; } while(0) -#else -#define LOG(x) do {;} while(0) -#endif - - static int which_scheduler = 0; - - single_threaded_scheduler_sptr - make_single_threaded_scheduler(const std::vector<block_sptr> &blocks) - { - return single_threaded_scheduler_sptr - (new single_threaded_scheduler(blocks)); - } - - single_threaded_scheduler::single_threaded_scheduler(const std::vector<block_sptr> &blocks) - : d_blocks(blocks), d_enabled(true), d_log(0) - { - if(ENABLE_LOGGING) { - std::string name = str(boost::format("sst-%d.log") % which_scheduler++); - d_log = new std::ofstream(name.c_str()); - *d_log << "single_threaded_scheduler: " - << d_blocks.size () - << " blocks\n"; - } - } - - single_threaded_scheduler::~single_threaded_scheduler() - { - if(ENABLE_LOGGING) - delete d_log; - } - - void - single_threaded_scheduler::run() - { - // d_enabled = true; // KLUDGE - main_loop (); - } - - void - single_threaded_scheduler::stop() - { - if(0) - std::cout << "gr_singled_threaded_scheduler::stop() " - << this << std::endl; - d_enabled = false; - } - - inline static unsigned int - round_up(unsigned int n, unsigned int multiple) - { - return ((n + multiple - 1) / multiple) * multiple; - } - - inline static unsigned int - round_down(unsigned int n, unsigned int multiple) - { - return (n / multiple) * multiple; - } - - // - // Return minimum available write space in all our downstream - // buffers or -1 if we're output blocked and the output we're - // blocked on is done. - // - static int - min_available_space(block_detail *d, int output_multiple) - { - int min_space = std::numeric_limits<int>::max(); - - for(int i = 0; i < d->noutputs (); i++) { - int n = round_down (d->output(i)->space_available (), output_multiple); - if(n == 0) { // We're blocked on output. - if(d->output(i)->done()) { // Downstream is done, therefore we're done. - return -1; - } - return 0; - } - min_space = std::min (min_space, n); - } - return min_space; - } - - void - single_threaded_scheduler::main_loop() - { - static const int DEFAULT_CAPACITY = 16; - - int noutput_items; - gr_vector_int ninput_items_required(DEFAULT_CAPACITY); - gr_vector_int ninput_items(DEFAULT_CAPACITY); - gr_vector_const_void_star input_items(DEFAULT_CAPACITY); - gr_vector_void_star output_items(DEFAULT_CAPACITY); - unsigned int bi; - unsigned int nalive; - int max_items_avail; - bool made_progress_last_pass; - bool making_progress; - - for(unsigned i = 0; i < d_blocks.size (); i++) - d_blocks[i]->detail()->set_done (false); // reset any done flags - - for(unsigned i = 0; i < d_blocks.size (); i++) // enable any drivers, etc. - d_blocks[i]->start(); - - bi = 0; - made_progress_last_pass = true; - making_progress = false; - - // Loop while there are still blocks alive - - nalive = d_blocks.size (); - while(d_enabled && nalive > 0) { - if(boost::this_thread::interruption_requested()) - break; - - block *m = d_blocks[bi].get (); - block_detail *d = m->detail().get (); - - LOG(*d_log << std::endl << m); - - if(d->done ()) - goto next_block; - - if(d->source_p ()) { - // Invoke sources as a last resort. As long as the previous - // pass made progress, don't call a source. - if(made_progress_last_pass) { - LOG(*d_log << " Skipping source\n"); - goto next_block; - } - - ninput_items_required.resize (0); - ninput_items.resize (0); - input_items.resize (0); - output_items.resize (d->noutputs ()); - - // determine the minimum available output space - noutput_items = min_available_space (d, m->output_multiple ()); - LOG(*d_log << " source\n noutput_items = " << noutput_items << std::endl); - if(noutput_items == -1) // we're done - goto were_done; - - if(noutput_items == 0) { // we're output blocked - LOG(*d_log << " BLKD_OUT\n"); - goto next_block; - } - - goto setup_call_to_work; // jump to common code - } - - else if(d->sink_p ()) { - ninput_items_required.resize (d->ninputs ()); - ninput_items.resize (d->ninputs ()); - input_items.resize (d->ninputs ()); - output_items.resize (0); - LOG(*d_log << " sink\n"); - - max_items_avail = 0; - for(int i = 0; i < d->ninputs (); i++) { - ninput_items[i] = d->input(i)->items_available(); - //if (ninput_items[i] == 0 && d->input(i)->done()) - if(ninput_items[i] < m->output_multiple() && d->input(i)->done()) - goto were_done; - - max_items_avail = std::max (max_items_avail, ninput_items[i]); - } - - // take a swag at how much output we can sink - noutput_items = (int) (max_items_avail * m->relative_rate ()); - noutput_items = round_down (noutput_items, m->output_multiple ()); - LOG(*d_log << " max_items_avail = " << max_items_avail << std::endl); - LOG(*d_log << " noutput_items = " << noutput_items << std::endl); - - if(noutput_items == 0) { // we're blocked on input - LOG(*d_log << " BLKD_IN\n"); - goto next_block; - } - - goto try_again; // Jump to code shared with regular case. - } - - else { - // do the regular thing - ninput_items_required.resize(d->ninputs ()); - ninput_items.resize(d->ninputs ()); - input_items.resize(d->ninputs ()); - output_items.resize(d->noutputs ()); - - max_items_avail = 0; - for(int i = 0; i < d->ninputs (); i++) { - ninput_items[i] = d->input(i)->items_available (); - max_items_avail = std::max(max_items_avail, ninput_items[i]); - } - - // determine the minimum available output space - noutput_items = min_available_space(d, m->output_multiple ()); - if(ENABLE_LOGGING){ - *d_log << " regular "; - if(m->relative_rate() >= 1.0) - *d_log << "1:" << m->relative_rate() << std::endl; - else - *d_log << 1.0/m->relative_rate() << ":1\n"; - *d_log << " max_items_avail = " << max_items_avail << std::endl; - *d_log << " noutput_items = " << noutput_items << std::endl; - } - if(noutput_items == -1) // we're done - goto were_done; - - if(noutput_items == 0) { // we're output blocked - LOG(*d_log << " BLKD_OUT\n"); - goto next_block; - } - -#if 0 - // Compute best estimate of noutput_items that we can really use. - noutput_items = - std::min((unsigned)noutput_items, - std::max((unsigned)m->output_multiple(), - round_up((unsigned)(max_items_avail * m->relative_rate()), - m->output_multiple()))); - - LOG(*d_log << " revised noutput_items = " << noutput_items << std::endl); -#endif - - try_again: - if(m->fixed_rate()) { - // try to work it forward starting with max_items_avail. - // We want to try to consume all the input we've got. - int reqd_noutput_items = m->fixed_rate_ninput_to_noutput(max_items_avail); - reqd_noutput_items = round_up(reqd_noutput_items, m->output_multiple()); - if(reqd_noutput_items > 0 && reqd_noutput_items <= noutput_items) - noutput_items = reqd_noutput_items; - } - - // ask the block how much input they need to produce noutput_items - m->forecast(noutput_items, ninput_items_required); - - // See if we've got sufficient input available - int i; - for(i = 0; i < d->ninputs (); i++) - if(ninput_items_required[i] > ninput_items[i]) // not enough - break; - - if(i < d->ninputs()) { // not enough input on input[i] - // if we can, try reducing the size of our output request - if(noutput_items > m->output_multiple ()){ - noutput_items /= 2; - noutput_items = round_up (noutput_items, m->output_multiple ()); - goto try_again; - } - - // We're blocked on input - LOG(*d_log << " BLKD_IN\n"); - if(d->input(i)->done()) // If the upstream block is done, we're done - goto were_done; - - // Is it possible to ever fulfill this request? - if(ninput_items_required[i] > d->input(i)->max_possible_items_available ()) { - // Nope, never going to happen... - std::cerr << "\nsched: <block " << m->name() - << " (" << m->unique_id() << ")>" - << " is requesting more input data\n" - << " than we can provide.\n" - << " ninput_items_required = " - << ninput_items_required[i] << "\n" - << " max_possible_items_available = " - << d->input(i)->max_possible_items_available() << "\n" - << " If this is a filter, consider reducing the number of taps.\n"; - goto were_done; - } - - goto next_block; - } - - // We've got enough data on each input to produce noutput_items. - // Finish setting up the call to work. - for(int i = 0; i < d->ninputs (); i++) - input_items[i] = d->input(i)->read_pointer(); - - setup_call_to_work: - - for(int i = 0; i < d->noutputs (); i++) - output_items[i] = d->output(i)->write_pointer(); - - // Do the actual work of the block - int n = m->general_work(noutput_items, ninput_items, - input_items, output_items); - LOG(*d_log << " general_work: noutput_items = " << noutput_items - << " result = " << n << std::endl); - - if(n == -1) // block is done - goto were_done; - - d->produce_each(n); // advance write pointers - if(n > 0) - making_progress = true; - - goto next_block; - } - assert(0); - - were_done: - LOG(*d_log << " were_done\n"); - d->set_done (true); - nalive--; - - next_block: - if(++bi >= d_blocks.size ()) { - bi = 0; - made_progress_last_pass = making_progress; - making_progress = false; - } - } - - for(unsigned i = 0; i < d_blocks.size(); i++) // disable any drivers, etc. - d_blocks[i]->stop(); - } - -} /* namespace gr */ diff --git a/gnuradio-runtime/lib/single_threaded_scheduler.h b/gnuradio-runtime/lib/single_threaded_scheduler.h deleted file mode 100644 index eccbf03b36..0000000000 --- a/gnuradio-runtime/lib/single_threaded_scheduler.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H -#define INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H - -#include <gnuradio/api.h> -#include <gnuradio/runtime_types.h> -#include <fstream> - -namespace gr { - - class single_threaded_scheduler; - typedef boost::shared_ptr<single_threaded_scheduler> single_threaded_scheduler_sptr; - - /*! - * \brief Simple scheduler for stream computations. - * \ingroup internal - */ - class GR_RUNTIME_API single_threaded_scheduler - { - public: - ~single_threaded_scheduler(); - - void run(); - void stop(); - - private: - const std::vector<block_sptr> d_blocks; - volatile bool d_enabled; - std::ofstream *d_log; - - single_threaded_scheduler(const std::vector<block_sptr> &blocks); - - void main_loop(); - - friend GR_RUNTIME_API single_threaded_scheduler_sptr - make_single_threaded_scheduler(const std::vector<block_sptr> &blocks); - }; - - GR_RUNTIME_API single_threaded_scheduler_sptr - make_single_threaded_scheduler(const std::vector<block_sptr> &blocks); - -} /* namespace gr */ - -#endif /* INCLUDED_GR_SINGLE_THREADED_SCHEDULER_H */ diff --git a/gnuradio-runtime/lib/top_block_impl.cc b/gnuradio-runtime/lib/top_block_impl.cc index 3f94867bc2..d2a07e89ef 100644 --- a/gnuradio-runtime/lib/top_block_impl.cc +++ b/gnuradio-runtime/lib/top_block_impl.cc @@ -26,7 +26,6 @@ #include "top_block_impl.h" #include "flat_flowgraph.h" -#include "scheduler_sts.h" #include "scheduler_tpb.h" #include <gnuradio/top_block.h> #include <gnuradio/prefs.h> @@ -48,8 +47,7 @@ namespace gr { const char *name; scheduler_maker f; } scheduler_table[] = { - { "TPB", scheduler_tpb::make }, // first entry is default - { "STS", scheduler_sts::make } + { "TPB", scheduler_tpb::make } // first entry is default }; static scheduler_sptr diff --git a/gnuradio-runtime/lib/tpb_thread_body.cc b/gnuradio-runtime/lib/tpb_thread_body.cc index 93591feee2..59f1d3162e 100644 --- a/gnuradio-runtime/lib/tpb_thread_body.cc +++ b/gnuradio-runtime/lib/tpb_thread_body.cc @@ -55,8 +55,6 @@ namespace gr { size_t max_nmsgs = static_cast<size_t>(p->get_long("DEFAULT", "max_messages", 100)); // Setup the logger for the scheduler -#ifdef ENABLE_GR_LOG -#ifdef HAVE_LOG4CPP #undef LOG std::string config_file = p->get_string("LOG", "log_config", ""); std::string log_level = p->get_string("LOG", "log_level", "off"); @@ -75,9 +73,6 @@ namespace gr { GR_LOG_SET_FILE_APPENDER(LOG, log_file , true,"%r :%p: %c{1} - %m%n"); } } -#endif /* HAVE_LOG4CPP */ -#endif /* ENABLE_GR_LOG */ - // Set thread affinity if it was set before fg was started. if(block->processor_affinity().size() > 0) { @@ -93,9 +88,10 @@ namespace gr { block->clear_finished(); while(1) { - tpb_loop_top: boost::this_thread::interruption_point(); + d->d_tpb.clear_changed(); + // handle any queued up messages BOOST_FOREACH(basic_block::msg_queue_map_t::value_type &i, block->msg_queue) { // Check if we have a message handler attached before getting @@ -116,97 +112,57 @@ namespace gr { } } - d->d_tpb.clear_changed(); // run one iteration if we are a connected stream block if(d->noutputs() >0 || d->ninputs()>0){ s = d_exec.run_one_iteration(); } else { s = block_executor::BLKD_IN; + // a msg port only block wants to shutdown + if(block->finished()) { + s = block_executor::DONE; + } } - // if msg ports think we are done, we are done - if(block->finished()) + if(block->finished() && s == block_executor::READY_NO_OUTPUT) { s = block_executor::DONE; + d->set_done(true); + } + + if(!d->ninputs() && s == block_executor::READY_NO_OUTPUT) { + s = block_executor::BLKD_IN; + } switch(s){ - case block_executor::READY: // Tell neighbors we made progress. + case block_executor::READY: // Tell neighbors we made progress. d->d_tpb.notify_neighbors(d); break; - case block_executor::READY_NO_OUTPUT: // Notify upstream only + case block_executor::READY_NO_OUTPUT: // Notify upstream only d->d_tpb.notify_upstream(d); break; - case block_executor::DONE: // Game over. + case block_executor::DONE: // Game over. block->notify_msg_neighbors(); d->d_tpb.notify_neighbors(d); return; - case block_executor::BLKD_IN: // Wait for input. + case block_executor::BLKD_IN: // Wait for input. { gr::thread::scoped_lock guard(d->d_tpb.mutex); - while(!d->d_tpb.input_changed) { - - // wait for input or message - while(!d->d_tpb.input_changed && block->empty_handled_p()){ - boost::system_time const timeout=boost::get_system_time()+ boost::posix_time::milliseconds(250); - if(!d->d_tpb.input_cond.timed_wait(guard, timeout)){ - goto tpb_loop_top; // timeout occurred (perform sanity checks up top) - } - } - // handle all pending messages - BOOST_FOREACH(basic_block::msg_queue_map_t::value_type &i, block->msg_queue) { - if(block->has_msg_handler(i.first)) { - while((msg = block->delete_head_nowait(i.first))) { - guard.unlock(); // release lock while processing msg - block->dispatch_msg(i.first, msg); - guard.lock(); - } - } - else { - // leave msg in queue if no handler is defined - // start dropping if we have too many - if(block->nmsgs(i.first) > max_nmsgs){ - GR_LOG_WARN(LOG,"asynchronous message buffer overflowing, dropping message"); - msg = block->delete_head_nowait(i.first); - } - } - } - if (d->done()) { - return; - } + if(!d->d_tpb.input_changed) { + boost::system_time const timeout=boost::get_system_time()+ boost::posix_time::milliseconds(250); + d->d_tpb.input_cond.timed_wait(guard, timeout); } } break; - case block_executor::BLKD_OUT: // Wait for output buffer space. + case block_executor::BLKD_OUT: // Wait for output buffer space. { - gr::thread::scoped_lock guard(d->d_tpb.mutex); - while(!d->d_tpb.output_changed) { - // wait for output room or message - while(!d->d_tpb.output_changed && block->empty_handled_p()) - d->d_tpb.output_cond.wait(guard); - - // handle all pending messages - BOOST_FOREACH(basic_block::msg_queue_map_t::value_type &i, block->msg_queue) { - if(block->has_msg_handler(i.first)) { - while((msg = block->delete_head_nowait(i.first))) { - guard.unlock(); // release lock while processing msg - block->dispatch_msg(i.first, msg); - guard.lock(); - } - } - else { - // leave msg in queue if no handler is defined - // start dropping if we have too many - if(block->nmsgs(i.first) > max_nmsgs){ - GR_LOG_WARN(LOG,"asynchronous message buffer overflowing, dropping message"); - msg = block->delete_head_nowait(i.first); - } - } - } + gr::thread::scoped_lock guard(d->d_tpb.mutex); + while(!d->d_tpb.output_changed) { + d->d_tpb.output_cond.wait(guard); } } break; diff --git a/gnuradio-runtime/python/gnuradio/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/CMakeLists.txt index d29e6aa9d2..736db499dc 100644 --- a/gnuradio-runtime/python/gnuradio/CMakeLists.txt +++ b/gnuradio-runtime/python/gnuradio/CMakeLists.txt @@ -35,5 +35,4 @@ GR_PYTHON_INSTALL(FILES gr_unittest.py gr_xmlrunner.py DESTINATION ${GR_PYTHON_DIR}/gnuradio - COMPONENT "runtime_python" ) diff --git a/gnuradio-runtime/python/gnuradio/__init__.py b/gnuradio-runtime/python/gnuradio/__init__.py index dd7b89650b..062450cb5f 100644 --- a/gnuradio-runtime/python/gnuradio/__init__.py +++ b/gnuradio-runtime/python/gnuradio/__init__.py @@ -37,13 +37,8 @@ if path.endswith(path_ending): __path__.append(os.path.join(build_path, 'gr-wavelet', 'python')) __path__.append(os.path.join(build_path, 'gr-audio', 'python')) __path__.append(os.path.join(build_path, 'gr-qtgui', 'python')) - __path__.append(os.path.join(build_path, 'gr-wxgui', 'python')) - __path__.append(os.path.join(build_path, 'gr-atsc', 'python')) - __path__.append(os.path.join(build_path, 'gr-noaa', 'python')) - __path__.append(os.path.join(build_path, 'gr-pager', 'python')) __path__.append(os.path.join(build_path, 'gr-video-sdl', 'python')) __path__.append(os.path.join(build_path, 'gr-vocoder', 'python')) - __path__.append(os.path.join(build_path, 'gr-fcd', 'python')) __path__.append(os.path.join(build_path, 'gr-comedi', 'python')) __path__.append(os.path.join(build_path, 'gr-channels', 'python')) __path__.append(os.path.join(build_path, 'gr-fec', 'python')) diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt index f40f253a72..ecf24178f9 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt +++ b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt @@ -24,7 +24,6 @@ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/icon.png DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport - COMPONENT "runtime_python" ) @@ -36,7 +35,6 @@ GR_PYTHON_INSTALL( ${CMAKE_CURRENT_SOURCE_DIR}/GNURadioControlPortClient.py ${CMAKE_CURRENT_SOURCE_DIR}/RPCConnection.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/ - COMPONENT "runtime_python" ) GR_PYTHON_INSTALL( @@ -45,7 +43,6 @@ GR_PYTHON_INSTALL( ${CMAKE_CURRENT_SOURCE_DIR}/gr-ctrlport-monitor DESTINATION ${GR_RUNTIME_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT "runtime_python" ) if(THRIFT_FOUND) @@ -60,7 +57,6 @@ GR_PYTHON_INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/RPCConnectionThrift.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/ - COMPONENT "runtime_python" ) GR_PYTHON_INSTALL( @@ -73,7 +69,6 @@ GR_PYTHON_INSTALL( ${CMAKE_CURRENT_BINARY_DIR}/GNURadio/StreamReceiver-remote ${CMAKE_CURRENT_BINARY_DIR}/GNURadio/ttypes.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/GNURadio - COMPONENT "runtime_python" ) endif(THRIFT_FOUND) diff --git a/gnuradio-runtime/python/gnuradio/eng_option.py b/gnuradio-runtime/python/gnuradio/eng_option.py index 5d8660f0f2..ae000fe442 100644 --- a/gnuradio-runtime/python/gnuradio/eng_option.py +++ b/gnuradio-runtime/python/gnuradio/eng_option.py @@ -39,25 +39,9 @@ def check_intx (option, opt, value): raise OptionValueError ( "option %s: invalid integer value: %r" % (opt, value)) -def check_subdev (option, opt, value): - """ - Value has the form: (A|B)(:0|1)? - - Returns: - a 2-tuple (0|1, 0|1) - """ - d = { 'A' : (0, 0), 'A:0' : (0, 0), 'A:1' : (0, 1), 'A:2' : (0, 2), - 'B' : (1, 0), 'B:0' : (1, 0), 'B:1' : (1, 1), 'B:2' : (1, 2) } - try: - return d[value.upper()] - except: - raise OptionValueError( - "option %s: invalid subdev: '%r', must be one of %s" % (opt, value, ', '.join(sorted(d.keys())))) - class eng_option (Option): TYPES = Option.TYPES + ("eng_float", "intx", "subdev") TYPE_CHECKER = copy (Option.TYPE_CHECKER) TYPE_CHECKER["eng_float"] = check_eng_float TYPE_CHECKER["intx"] = check_intx - TYPE_CHECKER["subdev"] = check_subdev diff --git a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt index ddad2c448a..fc966b8ece 100644 --- a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt +++ b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt @@ -32,7 +32,6 @@ GR_PYTHON_INSTALL(FILES top_block.py pubsub.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr - COMPONENT "runtime_python" ) ######################################################################## diff --git a/gnuradio-runtime/python/gnuradio/gru/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/gru/CMakeLists.txt index f0276a8d53..c1d7b701a9 100644 --- a/gnuradio-runtime/python/gnuradio/gru/CMakeLists.txt +++ b/gnuradio-runtime/python/gnuradio/gru/CMakeLists.txt @@ -32,5 +32,4 @@ GR_PYTHON_INSTALL(FILES socket_stuff.py daemon.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/gru - COMPONENT "runtime_python" ) diff --git a/gnuradio-runtime/python/pmt/CMakeLists.txt b/gnuradio-runtime/python/pmt/CMakeLists.txt index f4cba41d34..1ddfc2a46f 100644 --- a/gnuradio-runtime/python/pmt/CMakeLists.txt +++ b/gnuradio-runtime/python/pmt/CMakeLists.txt @@ -26,7 +26,6 @@ GR_PYTHON_INSTALL(FILES __init__.py pmt_to_python.py DESTINATION ${GR_PYTHON_DIR}/pmt - COMPONENT "runtime_python" ) ######################################################################## diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt index ca9ddd4039..698283fe4d 100644 --- a/gnuradio-runtime/swig/CMakeLists.txt +++ b/gnuradio-runtime/swig/CMakeLists.txt @@ -52,7 +52,6 @@ GR_SWIG_MAKE(pmt_swig pmt_swig.i) GR_SWIG_INSTALL( TARGETS pmt_swig DESTINATION ${GR_PYTHON_DIR}/pmt - COMPONENT "runtime_python" ) add_custom_target(pmt_swig DEPENDS ${SWIG_MODULE_pmt_swig_REAL_NAME}) @@ -61,12 +60,6 @@ add_custom_target(pmt_swig DEPENDS ${SWIG_MODULE_pmt_swig_REAL_NAME}) # Build gnuradio-runtime swig ############################################################### -# Only use if log4cpp is installed -# Define ENABLE_GR_LOG for the .i file to ignore it. -if(ENABLE_GR_LOG) - SET(GR_SWIG_FLAGS "-DENABLE_GR_LOG") -endif(ENABLE_GR_LOG) - if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) list(APPEND GR_SWIG_FLAGS -DGR_CTRLPORT) @@ -82,7 +75,6 @@ GR_SWIG_MAKE(runtime_swig runtime_swig.i) GR_SWIG_INSTALL( TARGETS runtime_swig DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr - COMPONENT "runtime_python" ) install( @@ -114,7 +106,6 @@ install( pmt_swig.i prefs.i realtime.i - single_threaded_scheduler.i sync_block.i sync_decimator.i sync_interpolator.i @@ -124,5 +115,4 @@ install( ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig_doc.i ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "runtime_swig" ) diff --git a/gnuradio-runtime/swig/block.i b/gnuradio-runtime/swig/block.i index 945cea79b2..64500575fb 100644 --- a/gnuradio-runtime/swig/block.i +++ b/gnuradio-runtime/swig/block.i @@ -57,6 +57,9 @@ class gr::block : public gr::basic_block uint64_t nitems_read(unsigned int which_input); uint64_t nitems_written(unsigned int which_output); + void set_log_level(std::string level); + std::string log_level(); + // Methods to manage the block's max_noutput_items size. int max_noutput_items(); void set_max_noutput_items(int m); diff --git a/gnuradio-runtime/swig/hier_block2.i b/gnuradio-runtime/swig/hier_block2.i index 12190d0452..6e964db8a1 100644 --- a/gnuradio-runtime/swig/hier_block2.i +++ b/gnuradio-runtime/swig/hier_block2.i @@ -91,6 +91,9 @@ namespace gr { void unset_processor_affinity(); std::vector<int> processor_affinity(); + void set_log_level(std::string level); + std::string log_level(); + // Methods to manage block's min/max buffer sizes. size_t max_output_buffer(int i); void set_max_output_buffer(size_t max_output_buffer); diff --git a/gnuradio-runtime/swig/single_threaded_scheduler.i b/gnuradio-runtime/swig/single_threaded_scheduler.i deleted file mode 100644 index f4fbed075c..0000000000 --- a/gnuradio-runtime/swig/single_threaded_scheduler.i +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gnuradio/runtime.h> - -class gr::single_threaded_scheduler; -typedef boost::shared_ptr<gr::single_threaded_scheduler> gr::single_threaded_scheduler_sptr; -%template(single_threaded_scheduler_sptr) boost::shared_ptr<gr::single_threaded_scheduler>; -%rename(single_threaded_scheduler) gr::make_single_threaded_scheduler; -%ignore gr::single_threaded_scheduler; - -gr::single_threaded_scheduler_sptr -gr::make_single_threaded_scheduler(const std::vector<gr::block_sptr> &modules); - -class gr::single_threaded_scheduler { - public: - ~single_threaded_scheduler (); - - // void run (); - void stop (); - - private: - single_threaded_scheduler (const std::vector<block_sptr> &modules); -}; - -#ifdef SWIGPYTHON -%inline %{ - void sts_pyrun (gr::single_threaded_scheduler_sptr s) { - Py_BEGIN_ALLOW_THREADS; // release global interpreter lock - s->run (); - Py_END_ALLOW_THREADS; // acquire global interpreter lock - } -%} -#endif - |