void TimerResults::ShowResults(SHOWTIME_MODES mode) const { if (mode == SHOWTIME_NONE) return; std::cout << std::endl; TimerResultsData overallData; std::vector<dataElementType> data(_results.begin(), _results.end()); std::sort(data.begin(), data.end(), more_second_sec); size_t ordinal = 1; // maybe it would be nice to have an ordinal in output later! for (std::vector<dataElementType>::const_iterator iter=data.begin() ; iter!=data.end(); ++iter) { const double sec = iter->second.seconds(); const double secAverage = sec / (double)(iter->second._numberOfResults); overallData._clocks += iter->second._clocks; if ((mode != SHOWTIME_TOP5) || (ordinal<=5)) { std::cout << iter->first << ": " << sec << "s (avg. " << secAverage << "s - " << iter->second._numberOfResults << " result(s))" << std::endl; } ++ordinal; } const double secOverall = overallData.seconds(); std::cout << "Overall time: " << secOverall << "s" << std::endl; }
void TimerResults::ShowResults() const { TimerResultsData overallData; std::map<std::string, struct TimerResultsData>::const_iterator I = _results.begin(); const std::map<std::string, struct TimerResultsData>::const_iterator E = _results.end(); while (I != E) { const double sec = I->second.seconds(); const double secAverage = sec / (double)(I->second._numberOfResults); std::cout << I->first << ": " << sec << "s (avg. " << secAverage << "s - " << I->second._numberOfResults << " result(s))" << std::endl; overallData._clocks += I->second._clocks; ++I; } const double secOverall = overallData.seconds(); std::cout << "Overall time: " << secOverall << "s" << std::endl; }