[yul-phaser] AlgorithmRunner: Print total time when showing only the top chromosome

This commit is contained in:
Kamil Śliwak 2020-03-09 19:23:25 +01:00
parent 58e3fca3de
commit 10e8d3616c
2 changed files with 8 additions and 5 deletions

View File

@ -84,7 +84,7 @@ protected:
string topChromosomePattern(size_t roundNumber, Individual const& individual) const
{
ostringstream output;
output << roundNumber << "\\|" << individualPattern(individual);
output << roundNumber << R"(\|[0-9.]+\|)" << individualPattern(individual);
return output.str();
}

View File

@ -55,14 +55,14 @@ void AlgorithmRunner::printRoundSummary(
clock_t _totalTimeStart
) const
{
clock_t now = clock();
double roundTime = static_cast<double>(now - _roundTimeStart) / CLOCKS_PER_SEC;
double totalTime = static_cast<double>(now - _totalTimeStart) / CLOCKS_PER_SEC;
if (!m_options.showOnlyTopChromosome)
{
if (m_options.showRoundInfo)
{
clock_t now = clock();
double roundTime = static_cast<double>(now - _roundTimeStart) / CLOCKS_PER_SEC;
double totalTime = static_cast<double>(now - _totalTimeStart) / CLOCKS_PER_SEC;
m_outputStream << "---------- ROUND " << _round + 1;
m_outputStream << " [round: " << fixed << setprecision(1) << roundTime << " s,";
m_outputStream << " total: " << fixed << setprecision(1) << totalTime << " s]";
@ -76,7 +76,10 @@ void AlgorithmRunner::printRoundSummary(
else if (m_population.individuals().size() > 0)
{
if (m_options.showRoundInfo)
{
m_outputStream << setw(5) << _round + 1 << " | ";
m_outputStream << setw(5) << fixed << setprecision(1) << totalTime << " | ";
}
m_outputStream << m_population.individuals()[0] << endl;
}