summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/tests')
-rw-r--r--gnuradio-core/src/tests/Makefile.am96
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod.cc148
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_ccc.cc149
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_ccf.cc151
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_fcc.cc152
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_fsf.cc151
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_scc.cc151
-rw-r--r--gnuradio-core/src/tests/benchmark_nco.cc219
-rw-r--r--gnuradio-core/src/tests/benchmark_vco.cc166
-rw-r--r--gnuradio-core/src/tests/nco_results48
-rw-r--r--gnuradio-core/src/tests/test_all.cc46
-rw-r--r--gnuradio-core/src/tests/test_atsc.cc37
-rwxr-xr-xgnuradio-core/src/tests/test_buffers.py136
-rw-r--r--gnuradio-core/src/tests/test_filter.cc37
-rw-r--r--gnuradio-core/src/tests/test_general.cc37
-rw-r--r--gnuradio-core/src/tests/test_runtime.cc37
-rw-r--r--gnuradio-core/src/tests/test_vmcircbuf.cc44
17 files changed, 1805 insertions, 0 deletions
diff --git a/gnuradio-core/src/tests/Makefile.am b/gnuradio-core/src/tests/Makefile.am
new file mode 100644
index 0000000000..1dd3dd0615
--- /dev/null
+++ b/gnuradio-core/src/tests/Makefile.am
@@ -0,0 +1,96 @@
+#
+# Copyright 2001 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES)
+
+# list of programs run by "make check" and "make distcheck"
+
+TESTS = test_all
+
+
+# test_atsc
+
+#Test program to test setting up buffers using gr_test which can be run manually
+EXTRA_DIST = \
+ test_buffers.py
+
+noinst_PROGRAMS = \
+ benchmark_dotprod \
+ benchmark_dotprod_fsf \
+ benchmark_dotprod_fcc \
+ benchmark_dotprod_scc \
+ benchmark_dotprod_ccc \
+ benchmark_dotprod_ccf \
+ benchmark_nco \
+ benchmark_vco \
+ test_runtime \
+ test_general \
+ test_all \
+ test_filter \
+ test_vmcircbuf
+
+
+LIBGNURADIO = $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core.la
+LIBGNURADIOQA = $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core-qa.la $(LIBGNURADIO)
+
+benchmark_dotprod_SOURCES = benchmark_dotprod.cc
+benchmark_dotprod_LDADD = $(LIBGNURADIO)
+
+benchmark_dotprod_fsf_SOURCES = benchmark_dotprod_fsf.cc
+benchmark_dotprod_fsf_LDADD = $(LIBGNURADIO)
+
+benchmark_dotprod_ccf_SOURCES = benchmark_dotprod_ccf.cc
+benchmark_dotprod_ccf_LDADD = $(LIBGNURADIO)
+
+benchmark_dotprod_fcc_SOURCES = benchmark_dotprod_fcc.cc
+benchmark_dotprod_fcc_LDADD = $(LIBGNURADIO)
+
+benchmark_dotprod_scc_SOURCES = benchmark_dotprod_scc.cc
+benchmark_dotprod_scc_LDADD = $(LIBGNURADIO)
+
+benchmark_dotprod_ccc_SOURCES = benchmark_dotprod_ccc.cc
+benchmark_dotprod_ccc_LDADD = $(LIBGNURADIO)
+
+benchmark_nco_SOURCES = benchmark_nco.cc
+benchmark_nco_LDADD = $(LIBGNURADIO)
+
+benchmark_vco_SOURCES = benchmark_vco.cc
+benchmark_vco_LDADD = $(LIBGNURADIO)
+
+test_runtime_SOURCES = test_runtime.cc
+test_runtime_LDADD = $(LIBGNURADIOQA)
+
+test_general_SOURCES = test_general.cc
+test_general_LDADD = $(LIBGNURADIOQA)
+
+test_filter_SOURCES = test_filter.cc
+test_filter_LDADD = $(LIBGNURADIOQA)
+
+# test_atsc_SOURCES = test_atsc.cc
+#test_atsc_LDADD = $(LIBGNURADIOQA)
+
+test_vmcircbuf_SOURCES = test_vmcircbuf.cc
+test_vmcircbuf_LDADD = $(LIBGNURADIOQA)
+
+test_all_SOURCES = test_all.cc
+test_all_LDADD = $(LIBGNURADIOQA)
diff --git a/gnuradio-core/src/tests/benchmark_dotprod.cc b/gnuradio-core/src/tests/benchmark_dotprod.cc
new file mode 100644
index 0000000000..8986f72556
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod.cc
@@ -0,0 +1,148 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_fff.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_fff* (*fir_maker_t)(const std::vector<float> &taps);
+typedef gr_fir_fff filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ float coeffs[NTAPS];
+ float input[BLOCK_SIZE + NTAPS];
+ long n;
+ float result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = random() - RANDOM_MAX/2;
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = random() - RANDOM_MAX/2;
+
+ std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double) clock () * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end -clock_start;
+#endif
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_fff_info> info;
+ gr_fir_util::get_gr_fir_fff_info (&info); // get all known FFF implementations
+
+ for (std::vector<gr_fir_fff_info>::iterator p = info.begin ();
+ p != info.end ();
+ ++p){
+
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc
new file mode 100644
index 0000000000..afc24e0715
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc
@@ -0,0 +1,149 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_ccc.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_ccc* (*fir_maker_t)(const std::vector<gr_complex> &taps);
+typedef gr_fir_ccc filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ gr_complex coeffs[NTAPS];
+ gr_complex input[BLOCK_SIZE + NTAPS];
+ long n;
+ gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter ((gr_complex*)&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_ccc_info> info;
+ gr_fir_util::get_gr_fir_ccc_info (&info); // get all known CCC implementations
+
+ for (std::vector<gr_fir_ccc_info>::iterator p = info.begin ();
+ p != info.end () ;
+ ++p){
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc
new file mode 100644
index 0000000000..866f7f61ae
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_ccf.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_ccf* (*fir_maker_t)(const std::vector<float> &taps);
+typedef gr_fir_ccf filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ float coeffs[NTAPS];
+ gr_complex input[BLOCK_SIZE + NTAPS];
+ long n;
+ gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = random() - RANDOM_MAX/2;
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_ccf_info> info;
+ gr_fir_util::get_gr_fir_ccf_info (&info); // get all known CCF implementations
+
+ for (std::vector<gr_fir_ccf_info>::iterator p = info.begin ();
+ p != info.end () ;
+ ++p){
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc b/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc
new file mode 100644
index 0000000000..af54707b8d
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc
@@ -0,0 +1,152 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_fcc.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_fcc* (*fir_maker_t)(const std::vector<gr_complex> &taps);
+typedef gr_fir_fcc filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ gr_complex coeffs[NTAPS];
+ float input[BLOCK_SIZE + NTAPS];
+ long n;
+ gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = random() - RANDOM_MAX/2;
+
+ std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_fcc_info> info;
+ gr_fir_util::get_gr_fir_fcc_info (&info); // get all known FCC implementations
+
+ for (std::vector<gr_fir_fcc_info>::iterator p = info.begin ();
+ p != info.end () ;
+ ++p){
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc b/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc
new file mode 100644
index 0000000000..7317e83983
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_fsf.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_fsf* (*fir_maker_t)(const std::vector<float> &taps);
+typedef gr_fir_fsf filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ float coeffs[NTAPS];
+ float input[BLOCK_SIZE + NTAPS];
+ long n;
+ short result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = random() - RANDOM_MAX/2;
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = random() - RANDOM_MAX/2;
+
+ std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_fsf_info> info;
+ gr_fir_util::get_gr_fir_fsf_info (&info); // get all known FFF implementations
+
+ for (std::vector<gr_fir_fsf_info>::iterator p = info.begin ();
+ p != info.end ();
+ ++p){
+
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_scc.cc b/gnuradio-core/src/tests/benchmark_dotprod_scc.cc
new file mode 100644
index 0000000000..d67fad556e
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_dotprod_scc.cc
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_fir_util.h>
+#include <gr_fir_scc.h>
+#include <random.h>
+
+#define TOTAL_TEST_SIZE (40 * 1000 * 1000L)
+#define NTAPS 256
+#define BLOCK_SIZE (50 * 1000) /* fits in cache */
+
+#if ((TOTAL_TEST_SIZE % BLOCK_SIZE) != 0)
+#error "TOTAL_TEST_SIZE % BLOCK_SIZE must equal 0"
+#endif
+
+typedef gr_fir_scc* (*fir_maker_t)(const std::vector<gr_complex> &taps);
+typedef gr_fir_scc filter_t;
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (fir_maker_t filter_maker, const char *implementation_name)
+{
+ int i;
+ gr_complex coeffs[NTAPS];
+ short input[BLOCK_SIZE + NTAPS];
+ long n;
+ gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
+
+ // setup coefficients and input data
+
+ for (i = 0; i < NTAPS; i++)
+ coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+
+ for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
+ input[i] = random() - RANDOM_MAX/2;
+
+ std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]);
+ filter_t *f = filter_maker (taps);
+
+ // get starting CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+
+ // do the actual work
+
+ for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
+ int j;
+ for (j = 0; j < BLOCK_SIZE; j++){
+ result = f->filter (&input[j]);
+ }
+ }
+
+ // get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end= (double) clock () * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end -clock_start;
+#endif
+
+ double macs = NTAPS * (double) TOTAL_TEST_SIZE;
+
+ printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
+ implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
+
+ delete f;
+}
+
+static void
+do_all ()
+{
+ std::vector<gr_fir_scc_info> info;
+ gr_fir_util::get_gr_fir_scc_info (&info); // get all known SCC implementations
+
+ for (std::vector<gr_fir_scc_info>::iterator p = info.begin ();
+ p != info.end () ;
+ ++p){
+ benchmark (p->create, p->name);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ do_all ();
+ return 0;
+}
diff --git a/gnuradio-core/src/tests/benchmark_nco.cc b/gnuradio-core/src/tests/benchmark_nco.cc
new file mode 100644
index 0000000000..fb0fe687b2
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_nco.cc
@@ -0,0 +1,219 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,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 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_nco.h>
+#include <gr_fxpt_nco.h>
+
+#define ITERATIONS 20000000
+#define BLOCK_SIZE (10 * 1000) // fits in cache
+
+#define FREQ 5003.123
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (void test (float *x, float *y), const char *implementation_name)
+{
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+ float output[2*BLOCK_SIZE];
+ float *x = &output[0], *y = &output[BLOCK_SIZE];
+
+ // touch memory
+ memset(output, 0, 2*BLOCK_SIZE*sizeof(float));
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+ // do the actual work
+
+ test (x, y);
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double) clock () * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ printf ("%18s: cpu: %6.3f steps/sec: %10.3e\n",
+ implementation_name, total, ITERATIONS / total);
+}
+
+// ----------------------------------------------------------------
+// Don't compare the _vec with other functions since memory store's
+// are involved.
+
+void basic_sincos_vec (float *x, float *y)
+{
+ gr_nco<float,float> nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS/BLOCK_SIZE; i++){
+ for (int j = 0; j < BLOCK_SIZE; j++){
+ nco.sincos (&x[2*j+1], &x[2*j]);
+ nco.step ();
+ }
+ }
+}
+
+void native_sincos_vec (float *x, float *y)
+{
+ gr_nco<float,float> nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS/BLOCK_SIZE; i++){
+ nco.sincos ((gr_complex*)x, BLOCK_SIZE);
+ }
+}
+
+void fxpt_sincos_vec (float *x, float *y)
+{
+ gr_fxpt_nco nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS/BLOCK_SIZE; i++){
+ nco.sincos ((gr_complex*)x, BLOCK_SIZE);
+ }
+}
+
+// ----------------------------------------------------------------
+
+void native_sincos (float *x, float *y)
+{
+ gr_nco<float,float> nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS; i++){
+ nco.sincos (x, y);
+ nco.step ();
+ }
+}
+
+void fxpt_sincos (float *x, float *y)
+{
+ gr_fxpt_nco nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS; i++){
+ nco.sincos (x, y);
+ nco.step ();
+ }
+}
+
+// ----------------------------------------------------------------
+
+void native_sin (float *x, float *y)
+{
+ gr_nco<float,float> nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS; i++){
+ *x = nco.sin ();
+ nco.step ();
+ }
+}
+
+void fxpt_sin (float *x, float *y)
+{
+ gr_fxpt_nco nco;
+
+ nco.set_freq (2 * M_PI / FREQ);
+
+ for (int i = 0; i < ITERATIONS; i++){
+ *x = nco.sin ();
+ nco.step ();
+ }
+}
+
+// ----------------------------------------------------------------
+
+void nop_fct (float *x, float *y)
+{
+}
+
+void nop_loop (float *x, float *y)
+{
+ for (int i = 0; i < ITERATIONS; i++){
+ nop_fct (x, y);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ benchmark (nop_loop, "nop loop");
+ benchmark (native_sin, "native sine");
+ benchmark (fxpt_sin, "fxpt sine");
+ benchmark (native_sincos, "native sin/cos");
+ benchmark (fxpt_sincos, "fxpt sin/cos");
+ benchmark (basic_sincos_vec, "basic sin/cos vec");
+ benchmark (native_sincos_vec, "native sin/cos vec");
+ benchmark (fxpt_sincos_vec, "fxpt sin/cos vec");
+}
diff --git a/gnuradio-core/src/tests/benchmark_vco.cc b/gnuradio-core/src/tests/benchmark_vco.cc
new file mode 100644
index 0000000000..1b290dfa50
--- /dev/null
+++ b/gnuradio-core/src/tests/benchmark_vco.cc
@@ -0,0 +1,166 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2004,2005 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <stdio.h>
+#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+#include <unistd.h>
+#include <gr_vco.h>
+#include <gr_fxpt_vco.h>
+
+#define ITERATIONS 5000000
+#define BLOCK_SIZE (10 * 1000) // fits in cache
+
+#define FREQ 5003.123
+#define K 4.9999999
+#define AMPLITUDE 2.444444444
+
+
+static double
+timeval_to_double (const struct timeval *tv)
+{
+ return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6;
+}
+
+
+static void
+benchmark (void test (float *x, const float *y), const char *implementation_name)
+{
+#ifdef HAVE_SYS_RESOURCE_H
+ struct rusage rusage_start;
+ struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
+ float output[BLOCK_SIZE];
+ float input[BLOCK_SIZE];
+
+ // touch memory
+ memset(output, 0, BLOCK_SIZE*sizeof(float));
+ for (int i = 0; i<BLOCK_SIZE; i++)
+ input[i] = sin(i);
+
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+#else
+ clock_start = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+#endif
+ // do the actual work
+
+ test (output, input);
+
+ // get ending CPU usage
+
+#ifdef HAVE_SYS_RESOURCE_H
+ if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
+ perror ("getrusage");
+ exit (1);
+ }
+
+ // compute results
+
+ double user =
+ timeval_to_double (&rusage_stop.ru_utime)
+ - timeval_to_double (&rusage_start.ru_utime);
+
+ double sys =
+ timeval_to_double (&rusage_stop.ru_stime)
+ - timeval_to_double (&rusage_start.ru_stime);
+
+ double total = user + sys;
+#else
+ clock_end = (double) clock () * (1000000. / CLOCKS_PER_SEC);
+ double total = clock_end - clock_start;
+#endif
+
+ printf ("%18s: cpu: %6.3f steps/sec: %10.3e\n",
+ implementation_name, total, ITERATIONS / total);
+}
+
+// ----------------------------------------------------------------
+
+void basic_vco (float *output, const float *input)
+{
+ double phase = 0;
+
+ for (int j = 0; j < ITERATIONS/BLOCK_SIZE; j++){
+ for (int i = 0; i < BLOCK_SIZE; i++){
+ output[i] = cos(phase) * AMPLITUDE;
+ phase += input[i] * K;
+
+ while (phase > 2 * M_PI)
+ phase -= 2 * M_PI;
+
+ while (phase < -2 * M_PI)
+ phase += 2 * M_PI;
+ }
+ }
+}
+
+void native_vco (float *output, const float *input)
+{
+ gr_vco<float,float> vco;
+
+ for (int j = 0; j < ITERATIONS/BLOCK_SIZE; j++){
+ vco.cos(output, input, BLOCK_SIZE, K, AMPLITUDE);
+ }
+ }
+
+void fxpt_vco (float *output, const float *input)
+{
+ gr_fxpt_vco vco;
+
+ for (int j = 0; j < ITERATIONS/BLOCK_SIZE; j++){
+ vco.cos(output, input, BLOCK_SIZE, K, AMPLITUDE);
+ }
+}
+
+// ----------------------------------------------------------------
+
+void nop_fct (float *x, const float *y)
+{
+}
+
+void nop_loop (float *x, const float *y)
+{
+ for (int i = 0; i < ITERATIONS; i++){
+ nop_fct (x, y);
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+ benchmark (nop_loop, "nop loop");
+ benchmark (basic_vco, "basic vco");
+ benchmark (native_vco, "native vco");
+ benchmark (fxpt_vco, "fxpt vco");
+}
diff --git a/gnuradio-core/src/tests/nco_results b/gnuradio-core/src/tests/nco_results
new file mode 100644
index 0000000000..5bdf5dd1cb
--- /dev/null
+++ b/gnuradio-core/src/tests/nco_results
@@ -0,0 +1,48 @@
+================================================================
+These are on a 1.4 GHz Pentium M using g++ 3.4.1
+================================================================
+
+Default compiler options -O2
+
+ nop loop: cpu: 0.015 steps/sec: 6.668e+08
+ native sine: cpu: 0.900 steps/sec: 1.111e+07
+ fxpt sine: cpu: 0.281 steps/sec: 3.559e+07
+ native sin/cos: cpu: 1.138 steps/sec: 8.789e+06
+ fxpt sin/cos: cpu: 0.550 steps/sec: 1.818e+07
+
+-O2 -march=pentium-m -fomit-frame-pointer
+
+ nop loop: cpu: 0.015 steps/sec: 6.668e+08
+ native sine: cpu: 0.903 steps/sec: 1.108e+07
+ fxpt sine: cpu: 0.271 steps/sec: 3.691e+07
+ native sin/cos: cpu: 1.092 steps/sec: 9.159e+06
+ fxpt sin/cos: cpu: 0.542 steps/sec: 1.845e+07
+
+Inlined fxpt::sin & cos
+-O2 -march=pentium-m -fomit-frame-pointer
+
+ nop loop: cpu: 0.015 steps/sec: 6.668e+08
+ native sine: cpu: 0.904 steps/sec: 1.106e+07
+ fxpt sine: cpu: 0.187 steps/sec: 5.348e+07
+ native sin/cos: cpu: 1.091 steps/sec: 9.167e+06
+ fxpt sin/cos: cpu: 0.373 steps/sec: 2.681e+07
+
+================================================================
+These are on a 1.5 GHz Athon MP 1800+
+================================================================
+
+Default compiler options: -O2
+
+ nop loop: cpu: 0.013 steps/sec: 7.693e+08
+ native sine: cpu: 0.733 steps/sec: 1.364e+07
+ fxpt sine: cpu: 0.210 steps/sec: 4.763e+07
+ native sin/cos: cpu: 1.183 steps/sec: 8.454e+06
+ fxpt sin/cos: cpu: 0.420 steps/sec: 2.381e+07
+
+-O2 -fomit-frame-pointer -march=athlon-mp
+
+ nop loop: cpu: 0.013 steps/sec: 7.693e+08
+ native sine: cpu: 0.679 steps/sec: 1.473e+07
+ fxpt sine: cpu: 0.200 steps/sec: 5.001e+07
+ native sin/cos: cpu: 1.147 steps/sec: 8.720e+06
+ fxpt sin/cos: cpu: 0.444 steps/sec: 2.253e+07
diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc
new file mode 100644
index 0000000000..b5e1b46127
--- /dev/null
+++ b/gnuradio-core/src/tests/test_all.cc
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cppunit/TextTestRunner.h>
+
+#include <qa_runtime.h>
+#include <qa_general.h>
+#include <qa_filter.h>
+// #include <qa_atsc.h>
+
+// FIXME add atsc back in.
+
+int
+main (int argc, char **argv)
+{
+
+ CppUnit::TextTestRunner runner;
+
+ runner.addTest (qa_runtime::suite ());
+ runner.addTest (qa_general::suite ());
+ runner.addTest (qa_filter::suite ());
+ // runner.addTest (qa_atsc::suite ());
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_atsc.cc b/gnuradio-core/src/tests/test_atsc.cc
new file mode 100644
index 0000000000..cca96d5583
--- /dev/null
+++ b/gnuradio-core/src/tests/test_atsc.cc
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <qa_atsc.h>
+
+int
+main (int argc, char **argv)
+{
+
+ CppUnit::TextTestRunner runner;
+
+ runner.addTest (qa_atsc::suite ());
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_buffers.py b/gnuradio-core/src/tests/test_buffers.py
new file mode 100755
index 0000000000..b3211329b9
--- /dev/null
+++ b/gnuradio-core/src/tests/test_buffers.py
@@ -0,0 +1,136 @@
+#!/usr/bin/env python
+#
+# Copyright 2006 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+from gnuradio import gr, gru
+from gnuradio import audio
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+import time
+import sys
+
+# Test script to test setting up the buffers using gr_test
+# For very large buffers it will fail when you hit the circbuf memory limit.
+# On linux this limit is shmmax, it will fail when it tries to create a buffer > shmmax.
+# With a 2.6 or later kernel you can set the shmmax limit manually in a root console
+#show current shmmax limit
+#$ cat /proc/sys/kernel/shmmax
+#33554432
+
+#set shmmax limit manually to 300MB
+#echo 300000000 >/proc/sys/kernel/shmmax
+
+#show new shmmax limit
+#$ cat /proc/sys/kernel/shmmax
+#300000000
+
+class my_graph(gr.flow_graph):
+
+ def __init__(self, seconds,history,output_multiple):
+ gr.flow_graph.__init__(self)
+
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("-O", "--audio-output", type="string", default="",
+ help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
+ parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
+ help="set sample rate to RATE (48000)")
+ (options, args) = parser.parse_args ()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ sample_rate = int(options.sample_rate)
+ ampl = 0.1
+
+ src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl)
+
+ nsamples=int(sample_rate * seconds) #1 seconds
+ # gr.test (const std::string &name=std::string("gr_test"),
+ # int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1,
+ # int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1,
+ # unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0,
+ # bool fixed_rate=true,gr_consume_type_t cons_type=CONSUME_NOUTPUT_ITEMS, gr_produce_type_t prod_type=PRODUCE_NOUTPUT_ITEMS);
+ name="gr_test"
+ min_inputs=1
+ max_inputs=1
+ sizeof_input_item=gr.sizeof_float
+ min_outputs=1
+ max_outputs=1
+ sizeof_output_item=gr.sizeof_float
+ #history=1 # problems start at 8150
+ #output_multiple=1 #problems start at 8000 in combination with large history
+ relative_rate=1.0
+ fixed_rate=True
+ consume_type=gr.CONSUME_NOUTPUT_ITEMS
+ produce_type=gr.PRODUCE_NOUTPUT_ITEMS
+ test = gr.test(name, min_inputs,max_inputs,sizeof_input_item,
+ min_outputs,max_outputs,sizeof_output_item,
+ history,output_multiple,relative_rate,
+ fixed_rate, consume_type,produce_type)
+ #test = gr.test("gr_test",1,1,gr.sizeof_float,
+ # 1,1,gr.sizeof_float,
+ # 1,1,1.0,
+ # True, gr.CONSUME_NOUTPUT_ITEMS,gr.PRODUCE_NOUTPUT_ITEMS)
+ #unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0,
+ #bool fixed_rate=false
+ dst = audio.sink (sample_rate, options.audio_output)
+ head= gr.head(gr.sizeof_float, nsamples)
+
+ self.connect (src0,test,head,(dst, 0))
+
+
+if __name__ == '__main__':
+
+ seconds=5.0
+ output_multiple=1
+ for history in (1,1000,8000,8100,8150,8175,8190,8191,8192,8193,8194,8195,9000,10000,100000,1000000,10000000): #,100000000):
+ sys.stdout.flush()
+ sys.stderr.flush()
+ print 'Test with history=', history, 'output_multiple=',output_multiple
+ sys.stdout.flush()
+ sys.stderr.flush()
+ succeed=True
+ starttime=time.time()
+ try:
+ my_graph(seconds,history,output_multiple).run()
+ except KeyboardInterrupt:
+ pass
+ except:
+ print "\nAn exception has terminated the graph."
+ exception=True
+ succeed=False
+ sys.stdout.flush()
+ sys.stderr.flush()
+ if succeed:
+ print ''
+ endtime=time.time()
+ duration=endtime - starttime
+ if (duration < 0.5*seconds) and (succeed):
+ print "A problem has terminated the graph."
+ succeed=False
+ if (duration > 1.5*seconds) and (succeed):
+ print "Something slowed the graph down considerably."
+ succeed=False
+
+ print 'The test result was:' , succeed
+ print 'Test duration' , duration
+ print ''
diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc
new file mode 100644
index 0000000000..1b2c57be17
--- /dev/null
+++ b/gnuradio-core/src/tests/test_filter.cc
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <qa_filter.h>
+
+int
+main (int argc, char **argv)
+{
+
+ CppUnit::TextTestRunner runner;
+
+ runner.addTest (qa_filter::suite ());
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_general.cc b/gnuradio-core/src/tests/test_general.cc
new file mode 100644
index 0000000000..9f93b9d70d
--- /dev/null
+++ b/gnuradio-core/src/tests/test_general.cc
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <qa_general.h>
+
+int
+main (int argc, char **argv)
+{
+
+ CppUnit::TextTestRunner runner;
+
+ runner.addTest (qa_general::suite ());
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc
new file mode 100644
index 0000000000..72290a9be9
--- /dev/null
+++ b/gnuradio-core/src/tests/test_runtime.cc
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cppunit/TextTestRunner.h>
+#include <qa_runtime.h>
+
+int
+main (int argc, char **argv)
+{
+
+ CppUnit::TextTestRunner runner;
+
+ runner.addTest (qa_runtime::suite ());
+
+ bool was_successful = runner.run ("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/gnuradio-core/src/tests/test_vmcircbuf.cc b/gnuradio-core/src/tests/test_vmcircbuf.cc
new file mode 100644
index 0000000000..e00b1706a9
--- /dev/null
+++ b/gnuradio-core/src/tests/test_vmcircbuf.cc
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gr_vmcircbuf.h>
+#include <stdio.h>
+
+int
+main (int argc, char **argv)
+{
+ int verbose = 1; // summary
+
+ if (argc > 1)
+ verbose = 2; // extra chatty
+
+ bool ok = gr_vmcircbuf_sysconfig::test_all_factories (verbose);
+
+ if (ok){
+ fprintf (stdout, "test_vmcircbuf: OK. We've got at least one workable solution\n");
+ return 0;
+ }
+ else {
+ fprintf (stdout, "test_vmcircbuf: NOT OK. We don't have a workable solution\n");
+ return 1;
+ }
+}