[DEV] Better test perf

This commit is contained in:
Edouard DUPIN 2015-04-17 21:42:11 +02:00
parent 3657121ea0
commit b34881a3da
2 changed files with 27 additions and 10 deletions

View File

@ -15,16 +15,16 @@ namespace appl {
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_PRINT(data) APPL_BASE(-1, data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)
#define APPL_WARNING(data) APPL_BASE(3, data)
#define APPL_INFO(data) APPL_BASE(4, data)
#ifdef DEBUG
#define APPL_INFO(data) APPL_BASE(4, data)
#define APPL_DEBUG(data) APPL_BASE(5, data)
#define APPL_VERBOSE(data) APPL_BASE(6, data)
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
#else
#define APPL_INFO(data) do { } while(false)
#define APPL_DEBUG(data) do { } while(false)
#define APPL_VERBOSE(data) do { } while(false)
#define APPL_TODO(data) do { } while(false)

View File

@ -10,6 +10,7 @@
#include <audio/algo/aec/Nlms.h>
#include <etk/os/FSNode.h>
#include <etk/chrono.h>
#include <etk/thread/tools.h>
#include <unistd.h>
#undef __class__
@ -19,6 +20,7 @@
int main(int _argc, const char** _argv) {
// the only one init for etk:
etk::init(_argc, _argv);
etk::thread::setName("test thread");
std::string fbName = "";
std::string micName = "";
int32_t filterSize = 0;
@ -41,6 +43,7 @@ int main(int _argc, const char** _argv) {
} else if (data == "--nlms") {
nlms = true;
} else if (data == "--perf") {
etk::thread::setPriority(-2);
perf = true;
} else if (etk::start_with(data,"--sample-rate=")) {
data = &data[14];
@ -134,15 +137,29 @@ int main(int _argc, const char** _argv) {
filter = algo.getFilter();
}
if (perf == true) {
APPL_INFO("Performance Result: ");
APPL_INFO(" blockSize=" << blockSize << " sample");
APPL_INFO(" min=" << minProcessing.count() << " ns");
APPL_INFO(" max=" << maxProcessing.count() << " ns");
APPL_INFO(" avg=" << totalTimeProcessing.count()/totalIteration << " ns");
APPL_PRINT("Performance Result: ");
APPL_PRINT(" blockSize=" << blockSize << " sample");
APPL_PRINT(" total data time=" << int64_t(totalIteration)*int64_t(blockSize)*1000000000LL/int64_t(sampleRate) << " ns");
APPL_PRINT(" min=" << minProcessing.count() << " ns");
APPL_PRINT(" max=" << maxProcessing.count() << " ns");
APPL_PRINT(" avg=" << totalTimeProcessing.count()/totalIteration << " ns");
APPL_INFO(" min=" << (float((minProcessing.count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_INFO(" max=" << (float((maxProcessing.count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_INFO(" avg=" << (float(((totalTimeProcessing.count()/totalIteration)*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_PRINT(" " << sampleRate << " Hz");
APPL_PRINT(" min=" << (float((minProcessing.count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_PRINT(" max=" << (float((maxProcessing.count()*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_PRINT(" avg=" << (float(((totalTimeProcessing.count()/totalIteration)*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_PRINT(" 48000 Hz");
sampleRate = 48000;
APPL_PRINT(" avg=" << (float(((totalTimeProcessing.count()/totalIteration)*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_PRINT(" 32000 Hz");
sampleRate = 32000;
APPL_PRINT(" avg=" << (float(((totalTimeProcessing.count()/totalIteration)*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_PRINT(" 16000 Hz");
sampleRate = 16000;
APPL_PRINT(" avg=" << (float(((totalTimeProcessing.count()/totalIteration)*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
APPL_PRINT(" 8000 Hz");
sampleRate = 8000;
APPL_PRINT(" avg=" << (float(((totalTimeProcessing.count()/totalIteration)*sampleRate)/blockSize)/1000000000.0)*100.0 << " %");
}
etk::FSNodeWriteAllDataType<int16_t>("output.raw", output);
etk::FSNodeWriteAllDataType<float>("filter.raw", filter);