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/CMakeLists.txt8
-rwxr-xr-xgnuradio-core/src/tests/benchmark_dotprod46
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_ccc.cc151
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_ccf.cc153
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_fcc.cc152
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_fff.cc148
-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/test_all.cc4
-rwxr-xr-xgnuradio-core/src/tests/test_buffers.py15
-rw-r--r--gnuradio-core/src/tests/test_filter.cc42
11 files changed, 10 insertions, 1011 deletions
diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt
index dbd52f05c7..e99015d7f2 100644
--- a/gnuradio-core/src/tests/CMakeLists.txt
+++ b/gnuradio-core/src/tests/CMakeLists.txt
@@ -40,18 +40,10 @@ link_directories(
# Build benchmarks and non-registered tests
########################################################################
set(tests_not_run #single source per test
- benchmark_dotprod_fff.cc
- benchmark_dotprod_fsf.cc
- benchmark_dotprod_ccf.cc
- benchmark_dotprod_fcc.cc
- benchmark_dotprod_scc.cc
- benchmark_dotprod_ccc.cc
benchmark_nco.cc
benchmark_vco.cc
test_runtime.cc
test_general.cc
- test_filter.cc
- #test_atsc.cc
test_vmcircbuf.cc
)
diff --git a/gnuradio-core/src/tests/benchmark_dotprod b/gnuradio-core/src/tests/benchmark_dotprod
deleted file mode 100755
index 82f3b5c3fc..0000000000
--- a/gnuradio-core/src/tests/benchmark_dotprod
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2008 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.
-#
-
-DIR=.
-
-tests="
-benchmark_dotprod_fff
-benchmark_dotprod_ccf
-benchmark_dotprod_ccc
-benchmark_dotprod_fcc
-benchmark_dotprod_scc
-benchmark_dotprod_fsf
-"
-
-echo "uname -a"
-uname -a
-
-if test -e /proc/cpuinfo
-then
- cat /proc/cpuinfo
-fi
-
-for t in $tests
-do
- echo
- echo "$t":
- $DIR/$t
-done
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc
deleted file mode 100644
index 8ef26a40dc..0000000000
--- a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- 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 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 <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]; // not always 16-bit aligned
- gr_complex *input = new gr_complex[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() / 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() / 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;
- delete [] input;
-}
-
-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
deleted file mode 100644
index ed3c491651..0000000000
--- a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- 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 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 <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]; // not always 16-bit aligned
- gr_complex *input = new gr_complex[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() / 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() / 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;
- delete [] input;
-}
-
-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
deleted file mode 100644
index e9eeee43a1..0000000000
--- a/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- 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 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 <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_fff.cc b/gnuradio-core/src/tests/benchmark_dotprod_fff.cc
deleted file mode 100644
index 56e0645062..0000000000
--- a/gnuradio-core/src/tests/benchmark_dotprod_fff.cc
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- 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 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 <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_fsf.cc b/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc
deleted file mode 100644
index a254a8eab4..0000000000
--- a/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- 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 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 <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
deleted file mode 100644
index 9a65bb4c62..0000000000
--- a/gnuradio-core/src/tests/benchmark_dotprod_scc.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-/* -*- 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 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 <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/test_all.cc b/gnuradio-core/src/tests/test_all.cc
index 8a1423e9ea..fb45cbf8f4 100644
--- a/gnuradio-core/src/tests/test_all.cc
+++ b/gnuradio-core/src/tests/test_all.cc
@@ -26,8 +26,6 @@
#include <gr_unittests.h>
#include <qa_runtime.h>
#include <qa_general.h>
-#include <qa_filter.h>
-// #include <qa_atsc.h>
// FIXME add atsc back in.
@@ -40,8 +38,6 @@ main (int argc, char **argv)
runner.addTest (qa_runtime::suite ());
runner.addTest (qa_general::suite ());
- runner.addTest (qa_filter::suite ());
- // runner.addTest (qa_atsc::suite ());
runner.setOutputter(xmlout);
bool was_successful = runner.run ("", false);
diff --git a/gnuradio-core/src/tests/test_buffers.py b/gnuradio-core/src/tests/test_buffers.py
index b867c727c6..2664c136c6 100755
--- a/gnuradio-core/src/tests/test_buffers.py
+++ b/gnuradio-core/src/tests/test_buffers.py
@@ -25,9 +25,14 @@ from gnuradio import audio
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-import time
+import time, math
import sys
+def sig_source_f(samp_rate, freq, amp, N):
+ t = map(lambda x: float(x)/samp_rate, xrange(N))
+ y = map(lambda x: math.sin(2.*math.pi*freq*x), t)
+ return y
+
# 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.
@@ -60,10 +65,11 @@ class my_graph(gr.top_block):
sample_rate = int(options.sample_rate)
ampl = 0.1
+ nsamples=int(sample_rate * seconds) #1 seconds
- src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl)
+ data = sig_source_f(sample_rate, 350, ampl, nsamples)
+ src0 = gr.vector_source_f(data)
- 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,
@@ -93,9 +99,8 @@ class my_graph(gr.top_block):
#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))
+ self.connect (src0,test,(dst, 0))
if __name__ == '__main__':
diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc
deleted file mode 100644
index 8b17034c60..0000000000
--- a/gnuradio-core/src/tests/test_filter.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002,2010,2011 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 <cppunit/TextTestRunner.h>
-#include <cppunit/XmlOutputter.h>
-
-#include <gr_unittests.h>
-#include <qa_filter.h>
-
-int
-main (int argc, char **argv)
-{
- CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(get_unittest_path("gnuradio_core_filter.xml").c_str());
- CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
-
- runner.addTest (qa_filter::suite ());
- runner.setOutputter(xmlout);
-
- bool was_successful = runner.run ("", false);
-
- return was_successful ? 0 : 1;
-}