[hamradio-commits] [gnss-sdr] 13/20: Add test of FFT execution times for different lengths
Carles Fernandez
carles_fernandez-guest at moszumanska.debian.org
Thu Jun 30 20:08:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
carles_fernandez-guest pushed a commit to branch master
in repository gnss-sdr.
commit 394048f5e7fc33e79122af38ac03a8d9967d1026
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date: Thu May 26 19:30:14 2016 +0200
Add test of FFT execution times for different lengths
---
src/tests/arithmetic/fft_length_test.cc | 66 +++++++++++++++++++++++++++++++++
src/tests/test_main.cc | 1 +
2 files changed, 67 insertions(+)
diff --git a/src/tests/arithmetic/fft_length_test.cc b/src/tests/arithmetic/fft_length_test.cc
new file mode 100644
index 0000000..649cd7a
--- /dev/null
+++ b/src/tests/arithmetic/fft_length_test.cc
@@ -0,0 +1,66 @@
+/*!
+ * \file fft_length_test.cc
+ * \brief This file implements timing tests for the FFT.
+ * \author Carles Fernandez-Prades, 2016. cfernandez(at)cttc.es
+ *
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2016 (see AUTHORS file for a list of contributors)
+ *
+ * GNSS-SDR is a software defined Global Navigation
+ * Satellite Systems receiver
+ *
+ * This file is part of GNSS-SDR.
+ *
+ * GNSS-SDR 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 of the License, or
+ * (at your option) any later version.
+ *
+ * GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+#include <ctime>
+#include <gnuradio/fft/fft.h>
+
+
+DEFINE_int32(fft_iterations_test, 1000, "Number of averaged iterations in FFT length timing test");
+
+TEST(FFT_Length_Test, MeasureExecutionTime)
+{
+ unsigned int d_fft_size;
+ struct timeval tv;
+
+ unsigned int fft_sizes [18] = { 1000, 1024, 1960, 2000, 2048, 4000, 4096, 4725, 8000, 8192, 10368, 12000, 16000, 16384, 27000, 32768, 50000, 65536 };
+ double execution_times [18];
+ EXPECT_NO_THROW(
+ for(int i = 0; i < 18; i++)
+ {
+ gr::fft::fft_complex* d_fft;
+ d_fft_size = fft_sizes[i];
+ d_fft = new gr::fft::fft_complex(d_fft_size, true);
+ std::fill_n( d_fft->get_inbuf(), d_fft_size, gr_complex( 0.0, 0.0 ) );
+
+ gettimeofday(&tv, NULL);
+ long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
+ for(int k = 0; k < FLAGS_fft_iterations_test; k++)
+ {
+ d_fft->execute();
+ }
+ gettimeofday(&tv, NULL);
+ long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
+ execution_times[i] = static_cast<double>(end - begin) / (1000000.0 * static_cast<double>(FLAGS_fft_iterations_test));
+ std::cout << "FFT execution time for length=" << d_fft_size << " : " << execution_times[i] << " [s]" << std::endl;
+ delete d_fft;
+ }
+ );
+}
diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc
index d55a88a..a3dabce 100644
--- a/src/tests/test_main.cc
+++ b/src/tests/test_main.cc
@@ -75,6 +75,7 @@ DECLARE_string(log_dir);
#include "arithmetic/multiply_test.cc"
#include "arithmetic/code_generation_test.cc"
#include "arithmetic/tracking_loop_filter_test.cc"
+#include "arithmetic/fft_length_test.cc"
#include "configuration/file_configuration_test.cc"
#include "configuration/in_memory_configuration_test.cc"
#include "control_thread/control_message_factory_test.cc"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git
More information about the pkg-hamradio-commits
mailing list