[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4972 - gnuradio/branches/developers/eb/ibu/mblock/src
From: |
eb |
Subject: |
[Commit-gnuradio] r4972 - gnuradio/branches/developers/eb/ibu/mblock/src/lib |
Date: |
Thu, 12 Apr 2007 14:21:51 -0600 (MDT) |
Author: eb
Date: 2007-04-12 14:21:50 -0600 (Thu, 12 Apr 2007)
New Revision: 4972
Added:
gnuradio/branches/developers/eb/ibu/mblock/src/lib/benchmark_send.cc
Modified:
gnuradio/branches/developers/eb/ibu/mblock/src/lib/
gnuradio/branches/developers/eb/ibu/mblock/src/lib/Makefile.am
gnuradio/branches/developers/eb/ibu/mblock/src/lib/qa_bitset.cc
Log:
work-in-progress on mblocks
Property changes on: gnuradio/branches/developers/eb/ibu/mblock/src/lib
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_mblock
qa_bitset_mbh.cc
+ Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_mblock
qa_bitset_mbh.cc
benchmark_send
Modified: gnuradio/branches/developers/eb/ibu/mblock/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/Makefile.am
2007-04-12 17:38:29 UTC (rev 4971)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/Makefile.am
2007-04-12 20:21:50 UTC (rev 4972)
@@ -119,9 +119,14 @@
-lstdc++
-noinst_PROGRAMS = test_mblock
+noinst_PROGRAMS = \
+ test_mblock \
+ benchmark_send
test_mblock_SOURCES = test_mblock.cc
test_mblock_LDADD = libmblock-qa.la
+benchmark_send_SOURCES = benchmark_send.cc
+benchmark_send_LDADD = libmblock-qa.la
+
CLEANFILES = $(BUILT_SOURCES) *.pyc
Added: gnuradio/branches/developers/eb/ibu/mblock/src/lib/benchmark_send.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/benchmark_send.cc
(rev 0)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/benchmark_send.cc
2007-04-12 20:21:50 UTC (rev 4972)
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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.
+ */
+
+#include <mb_runtime.h>
+#include <iostream>
+
+int
+main(int argc, char **argv)
+{
+ mb_runtime_sptr rt = mb_make_runtime();
+ pmt_t result = PMT_NIL;
+
+ long nmsgs = 1000000;
+ long batch_size = 8;
+
+ pmt_t arg = pmt_list2(pmt_from_long(nmsgs), // # of messages to send
through pipe
+ pmt_from_long(batch_size));
+
+ rt->run("top", "qa_bitset_top", arg, &result);
+
+ if (!pmt_equal(PMT_T, result)){
+ std::cerr << "benchmark_send: incorrect result";
+ return 1;
+ }
+
+ return 0;
+}
Modified: gnuradio/branches/developers/eb/ibu/mblock/src/lib/qa_bitset.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/qa_bitset.cc
2007-04-12 17:38:29 UTC (rev 4971)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/qa_bitset.cc
2007-04-12 20:21:50 UTC (rev 4972)
@@ -27,6 +27,7 @@
#include <mb_message.h>
#include <mb_class_registry.h>
#include <iostream>
+#include <sstream>
#include <bitset>
static pmt_t s_in = pmt_intern("in");
@@ -36,6 +37,14 @@
static pmt_t s_send_batch = pmt_intern("send-batch");
static pmt_t s_long0 = pmt_from_long(0);
+static std::string
+str(long x)
+{
+ std::ostringstream s;
+ s << x;
+ return s.str();
+}
+
class qa_bitset : public mb_mblock
{
mb_port_sptr d_in;
@@ -390,7 +399,9 @@
class qa_bitset_top : public mb_mblock
{
- mb_port_sptr d_cs0;
+ static const int NPIPES = 4;
+
+ std::vector<mb_port_sptr> d_cs;
long d_nmsgs; // # of messages to send
long d_batch_size; // # of messages to receive per batch
@@ -405,36 +416,48 @@
: mb_mblock(runtime, instance_name, user_arg)
{
d_nmsgs = pmt_to_long(pmt_nth(0, user_arg));
+ d_nmsgs = (d_nmsgs / NPIPES) * NPIPES;
d_batch_size = pmt_to_long(pmt_nth(1, user_arg));
- d_cs0 = define_port("cs0", "qa-bitset-cs", false, mb_port::INTERNAL);
+ /*
+ * We build NPIPES sources which feed NPIPES pipelines, each of which
+ * consists of 8-mblocks. All pipelines feed into a single sink
+ * which keeps track the results.
+ */
+ for (int i = 0; i < NPIPES; i++){
+ d_cs.push_back(define_port("cs"+str(i), "qa-bitset-cs", false,
mb_port::INTERNAL));
- // source of test messages
- define_component("src0", "qa_bitset_src",
- pmt_list3(pmt_from_long(0),
- pmt_from_long(d_nmsgs),
- pmt_from_long(d_batch_size)));
+ // sources of test messages
+ define_component("src"+str(i), "qa_bitset_src",
+ pmt_list3(pmt_from_long(i * d_nmsgs/NPIPES),
+ pmt_from_long(d_nmsgs/NPIPES),
+ pmt_from_long(d_batch_size)));
- // 32-mblock processing pipeline
- define_component("pipeline", "qa_bitset32", pmt_from_long(0));
+ // 8-mblock processing pipelines
+ define_component("pipeline"+str(i), "qa_bitset8", pmt_from_long(0));
+ }
- // sink for output of pipeline
+ // sink for output of pipelines
define_component("sink", "qa_bitset_sink",
pmt_list3(pmt_from_long(d_nmsgs),
- pmt_from_long(d_batch_size),
- pmt_from_long(0xffffffff)));
+ pmt_from_long(d_batch_size * NPIPES),
+ pmt_from_long(0x000000ff)));
- connect("self", "cs0", "src0", "cs_top");
- connect("src0", "out", "pipeline", "in");
- connect("src0", "cs", "sink", "cs0");
- connect("pipeline", "out", "sink", "in0");
+ for (int i = 0; i < NPIPES; i++){
+ connect("self", "cs"+str(i), "src"+str(i), "cs_top");
+ connect("src"+str(i), "out", "pipeline"+str(i), "in");
+ connect("src"+str(i), "cs", "sink", "cs"+str(i));
+ connect("pipeline"+str(i), "out", "sink", "in"+str(i));
+ }
}
void
qa_bitset_top::initial_transition()
{
- d_cs0->send(s_send_batch); // prime the pump
- d_cs0->send(s_send_batch);
+ for (int i = 0; i < NPIPES; i++){
+ d_cs[i]->send(s_send_batch); // prime the pump
+ d_cs[i]->send(s_send_batch);
+ }
}
REGISTER_MBLOCK_CLASS(qa_bitset_top);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4972 - gnuradio/branches/developers/eb/ibu/mblock/src/lib,
eb <=