[DEBUG] build is back

This commit is contained in:
Edouard DUPIN 2017-11-07 13:38:04 +01:00
parent c76d433d50
commit 7f3ffb9a12

View File

@ -11,20 +11,22 @@
#include <echrono/Steady.hpp>
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
class Performance {
private:
echrono::Steady m_timeStart;
echrono::Steady m_timeStop;
echrono::nanoseconds m_totalTimeProcessing;
echrono::nanoseconds m_minProcessing;
echrono::nanoseconds m_maxProcessing;
echrono::Duration m_totalTimeProcessing;
echrono::Duration m_minProcessing;
echrono::Duration m_maxProcessing;
int32_t m_totalIteration;
public:
Performance() :
m_totalTimeProcessing(0),
m_minProcessing(99999999999999LL),
m_minProcessing(int64_t(99999999999999LL)),
m_maxProcessing(0),
m_totalIteration(0) {
@ -34,7 +36,7 @@ class Performance {
}
void toc() {
m_timeStop = echrono::Steady::now();
echrono::nanoseconds time = m_timeStop - m_timeStart;
echrono::Duration time = m_timeStop - m_timeStart;
m_minProcessing = etk::min(m_minProcessing, time);
m_maxProcessing = etk::max(m_maxProcessing, time);
m_totalTimeProcessing += time;
@ -42,13 +44,13 @@ class Performance {
}
echrono::nanoseconds getTotalTimeProcessing() {
echrono::Duration getTotalTimeProcessing() {
return m_totalTimeProcessing;
}
echrono::nanoseconds getMinProcessing() {
echrono::Duration getMinProcessing() {
return m_minProcessing;
}
echrono::nanoseconds getMaxProcessing() {
echrono::Duration getMaxProcessing() {
return m_maxProcessing;
}
int32_t getTotalIteration() {
@ -86,13 +88,13 @@ float performanceResamplerStepFloat(float _sampleRateIn, float _sampleRateOut, i
ethread::sleepMilliSeconds((1));
}
TEST_INFO(" blockSize=" << input.size() << " sample");
TEST_INFO(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
<< perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing().count() << "ns ");
float avg = (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0;
TEST_INFO(" min < avg < max= " << (float((perfo.getMinProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
TEST_INFO(" min < avg < max =" << perfo.getMinProcessing() << " < "
<< perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing());
float avg = (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0;
TEST_INFO(" min < avg < max= " << (float((perfo.getMinProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< avg << "% < "
<< (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
<< (float((perfo.getMaxProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
TEST_PRINT("float : " << _sampleRateIn << " -> " << _sampleRateOut << " quality=" << int32_t(_quality) << " : " << avg << "%");
return avg;
}
@ -126,13 +128,13 @@ float performanceResamplerStepI16(float _sampleRateIn, float _sampleRateOut, int
ethread::sleepMilliSeconds((1));
}
TEST_INFO(" blockSize=" << input.size() << " sample");
TEST_INFO(" min < avg < max =" << perfo.getMinProcessing().count() << "ns < "
<< perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing().count() << "ns ");
float avg = (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0;
TEST_INFO(" min < avg < max= " << (float((perfo.getMinProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
TEST_INFO(" min < avg < max =" << perfo.getMinProcessing() << " < "
<< perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration() << "ns < "
<< perfo.getMaxProcessing());
float avg = (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRate)/double(input.size()))/1000000000.0)*100.0;
TEST_INFO(" min < avg < max= " << (float((perfo.getMinProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "% < "
<< avg << "% < "
<< (float((perfo.getMaxProcessing().count()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
<< (float((perfo.getMaxProcessing().get()*sampleRate)/double(input.size()))/1000000000.0)*100.0 << "%");
TEST_PRINT("int16_t : " << _sampleRateIn << " -> " << _sampleRateOut << " quality=" << int32_t(_quality) << " : " << avg << "%");
return avg;
}
@ -267,13 +269,13 @@ int main(int _argc, const char** _argv) {
if (perf == true) {
TEST_INFO("Performance Result: ");
TEST_INFO(" blockSize=" << blockSize << " sample");
TEST_INFO(" min=" << perfo.getMinProcessing().count() << " ns");
TEST_INFO(" max=" << perfo.getMaxProcessing().count() << " ns");
TEST_INFO(" avg=" << perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration() << " ns");
TEST_INFO(" min=" << perfo.getMinProcessing());
TEST_INFO(" max=" << perfo.getMaxProcessing());
TEST_INFO(" avg=" << perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration() << " ns");
TEST_INFO(" min=" << (float((perfo.getMinProcessing().count()*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
TEST_INFO(" max=" << (float((perfo.getMaxProcessing().count()*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
TEST_INFO(" avg=" << (float(((perfo.getTotalTimeProcessing().count()/perfo.getTotalIteration())*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
TEST_INFO(" min=" << (float((perfo.getMinProcessing().get()*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
TEST_INFO(" max=" << (float((perfo.getMaxProcessing().get()*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
TEST_INFO(" avg=" << (float(((perfo.getTotalTimeProcessing().get()/perfo.getTotalIteration())*sampleRateIn)/blockSize)/1000000000.0)*100.0 << " %");
}
etk::FSNodeWriteAllDataType<int16_t>(outputName, output);
}