diff options
-rw-r--r-- | benchmark/bm_registry.py | 21 | ||||
-rw-r--r-- | benchmark/run_benchmarks.py | 2 | ||||
-rw-r--r-- | benchmark/run_benchmarks.sh | 16 | ||||
-rw-r--r-- | benchmark/tb_many_rate_changes.py | 74 |
4 files changed, 108 insertions, 5 deletions
diff --git a/benchmark/bm_registry.py b/benchmark/bm_registry.py index c67d94a..c1be8ea 100644 --- a/benchmark/bm_registry.py +++ b/benchmark/bm_registry.py @@ -21,17 +21,29 @@ GR_ENV = { BENCHMARK_MANY_11_BLOCKS = tokwargs( wat='Benchmark the schedulers with many 1:1 ratio blocks', moar='''\ -- Compare simultaneous 1:1 radio blocks in each scheduler. +- Compare simultaneous 1:1 ratio blocks in each scheduler. - GRAS will use only the buffer pool allocator, and every work will fully consume available buffers.''', tests = [ - tokwargs(wat='Many 1:1 GRAS', args=['tb_many_1_to_1_blocks.py', '1e8'], env=GRAS_ENV), - #tokwargs(wat='Many 1:1 GRAS - TPP', args=['tb_many_1_to_1_blocks.py', '1e8'], env=GRAS_ENV, envextra=tokwargs(GRAS_TPP='1')), - tokwargs(wat='Many 1:1 GR', args=['tb_many_1_to_1_blocks.py', '1e8'], env=GR_ENV), + tokwargs(wat='GRAS', args=['tb_many_1_to_1_blocks.py', '1e8'], env=GRAS_ENV), + tokwargs(wat='GR', args=['tb_many_1_to_1_blocks.py', '1e8'], env=GR_ENV), ], to_result = lambda t: 1e8/t ) +BENCHMARK_MANY_RATE_BLOCKS = tokwargs( + wat='Benchmark the schedulers with many rate changing blocks', + moar='''\ +- Compare simultaneous changing ratio blocks in each scheduler. +- GRAS will use only the buffer pool allocator, +and every work will fully consume available buffers.''', + tests = [ + tokwargs(wat='GRAS', args=['tb_many_rate_changes.py', '1e4'], env=GRAS_ENV), + tokwargs(wat='GR', args=['tb_many_rate_changes.py', '1e4'], env=GR_ENV), + ], + to_result = lambda t: 1e4/t +) + BENCHMARK_FILTER_BLOCK = tokwargs( wat='Benchmark the schedulers with a filter block', moar='''\ @@ -78,6 +90,7 @@ BENCHMARK_DELAY_BLOCKS = tokwargs( BENCHMARKS = ( BENCHMARK_MANY_11_BLOCKS, + BENCHMARK_MANY_RATE_BLOCKS, BENCHMARK_FILTER_BLOCK, BENCHMARK_MATH_OPS, BENCHMARK_DELAY_BLOCKS, diff --git a/benchmark/run_benchmarks.py b/benchmark/run_benchmarks.py index fb525a2..b89b377 100644 --- a/benchmark/run_benchmarks.py +++ b/benchmark/run_benchmarks.py @@ -94,7 +94,7 @@ if __name__ == '__main__': #################################################################### ## create pdf generator #################################################################### - pdf_pages = PdfPages('gras_benchmark.pdf') + pdf_pages = PdfPages(sys.argv[1]) #################################################################### ## loop through tests diff --git a/benchmark/run_benchmarks.sh b/benchmark/run_benchmarks.sh new file mode 100644 index 0000000..1f055b2 --- /dev/null +++ b/benchmark/run_benchmarks.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +ABSOLUTE_PATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)/`basename "${BASH_SOURCE[0]}"` +SOURCEDIR=`dirname $ABSOLUTE_PATH` +BUILDDIR=$(pwd) + +OUT_PDF="gras_benchmark.pdf" +OUT_PNG="gras_benchmark.png" + +echo "source directory ${SOURCEDIR}" +echo "build directory ${BUILDDIR}" + +python -B $SOURCEDIR/run_benchmarks.py ${OUT_PDF} +convert ${OUT_PDF} /tmp/tmp_gras_bm.png +convert /tmp/tmp_gras_bm*.png -append ${OUT_PNG} +rm /tmp/tmp_gras_bm*.png diff --git a/benchmark/tb_many_rate_changes.py b/benchmark/tb_many_rate_changes.py new file mode 100644 index 0000000..f1e2072 --- /dev/null +++ b/benchmark/tb_many_rate_changes.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: Many Rate Changing +# Generated: Sun Jan 20 15:53:13 2013 +################################################## + +from gnuradio import blocks +from gnuradio import eng_notation +from gnuradio import gr +from gnuradio.eng_option import eng_option +from gnuradio.gr import firdes +from optparse import OptionParser +import numpy + +class many_rate_changing(gr.top_block): + + def __init__(self, num=1e7): + gr.top_block.__init__(self, "Many Rate Changing") + + ################################################## + # Parameters + ################################################## + self.num = num + + ################################################## + # Variables + ################################################## + self.samp_rate = samp_rate = 32000 + + ################################################## + # Blocks + ################################################## + self.random_source_x_0 = gr.vector_source_b(map(int, numpy.random.randint(0, 256, 1000)), True) + self.gr_unpacked_to_packed_xx_0 = gr.unpacked_to_packed_bb(2, gr.GR_LSB_FIRST) + self.gr_packed_to_unpacked_xx_0 = gr.packed_to_unpacked_bb(2, gr.GR_MSB_FIRST) + self.gr_null_sink_0_2 = gr.null_sink(gr.sizeof_char*1) + self.gr_head_0 = gr.head(gr.sizeof_char*1, int(num)) + self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_float, 3, 20, 0) + self.blocks_float_to_char_0 = blocks.float_to_char(1, 1) + self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) + + ################################################## + # Connections + ################################################## + self.connect((self.blocks_char_to_float_0, 0), (self.blocks_keep_m_in_n_0, 0)) + self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_float_to_char_0, 0)) + self.connect((self.blocks_float_to_char_0, 0), (self.gr_packed_to_unpacked_xx_0, 0)) + self.connect((self.gr_unpacked_to_packed_xx_0, 0), (self.blocks_char_to_float_0, 0)) + self.connect((self.random_source_x_0, 0), (self.gr_unpacked_to_packed_xx_0, 0)) + self.connect((self.gr_packed_to_unpacked_xx_0, 0), (self.gr_head_0, 0)) + self.connect((self.gr_head_0, 0), (self.gr_null_sink_0_2, 0)) + + + def get_num(self): + return self.num + + def set_num(self, num): + self.num = num + + def get_samp_rate(self): + return self.samp_rate + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + +if __name__ == '__main__': + parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("", "--num", dest="num", type="eng_float", default=eng_notation.num_to_str(1e7), + help="Set num [default=%default]") + (options, args) = parser.parse_args() + tb = many_rate_changing(num=options.num) + tb.run() + |