///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2018 Edouard Griffiths, F4EXB. //
// //
// Swagger server adapter interface //
// //
// This program 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 as version 3 of the License, or //
// //
// This program 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 V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see . //
///////////////////////////////////////////////////////////////////////////////////
#include
#include
#include "mainbench.h"
MainBench *MainBench::m_instance = 0;
MainBench::MainBench(qtwebapp::LoggerWithFile *logger, const ParserBench& parser, QObject *parent) :
QObject(parent),
m_logger(logger),
m_parser(parser),
m_uniform_distribution_f(-1.0, 1.0),
m_uniform_distribution_s16(-2048, 2047)
{
qDebug() << "MainBench::MainBench: start";
m_instance = this;
qDebug() << "MainBench::MainBench: end";
}
MainBench::~MainBench()
{}
void MainBench::run()
{
qDebug() << "MainBench::run: parameters:"
<< " testStr: " << m_parser.getTestStr()
<< " testType: " << (int) m_parser.getTestType()
<< " nsamples: " << m_parser.getNbSamples()
<< " repet: " << m_parser.getRepetition()
<< " log2f: " << m_parser.getLog2Factor();
if (m_parser.getTestType() == ParserBench::TestDecimatorsII) {
testDecimateII();
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsInfII) {
testDecimateII(ParserBench::TestDecimatorsInfII);
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsSupII) {
testDecimateII(ParserBench::TestDecimatorsSupII);
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsIF) {
testDecimateIF();
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsFI) {
testDecimateFI();
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsFF) {
testDecimateFF();
} else {
qDebug() << "MainBench::run: unknown test type: " << m_parser.getTestType();
}
emit finished();
}
void MainBench::testDecimateII(ParserBench::TestType testType)
{
QElapsedTimer timer;
qint64 nsecs = 0;
qDebug() << "MainBench::testDecimateII: create test data";
qint16 *buf = new qint16[m_parser.getNbSamples()*2];
m_convertBuffer.resize(m_parser.getNbSamples()/(1<