void profiling_utils::Profiler::status(std::ostream &out, bool merge) { stop(); out << std::endl; out << " *** Profiling statistics. Total counted time : " << m_tinfo.total.to_double() << " seconds" << std::endl; if (merge) { PerThread combined; for (std::map<unsigned long int, PerThread>::const_iterator it = m_data.begin() ; it != m_data.end() ; ++it) { for (std::map<std::string, unsigned int>::const_iterator iev = it->second.events.begin() ; iev != it->second.events.end(); ++iev) combined.events[iev->first] += iev->second; for (std::map<std::string, TimeInfo>::const_iterator itm = it->second.time.begin() ; itm != it->second.time.end(); ++itm) combined.time[itm->first].total = combined.time[itm->first].total + itm->second.total; } printThreadInfo(out, combined); } else for (std::map<unsigned long int, PerThread>::const_iterator it = m_data.begin() ; it != m_data.end() ; ++it) { out << "Thread " << it->first << ":" << std::endl; printThreadInfo(out, it->second); } }
void fcl::tools::Profiler::status(std::ostream &out, bool merge) { stop(); lock_.lock(); printOnDestroy_ = false; out << std::endl; out << " *** Profiling statistics. Total counted time : " << time::seconds(tinfo_.total) << " seconds" << std::endl; if (merge) { PerThread combined; for (std::map<std::thread::id, PerThread>::const_iterator it = data_.begin() ; it != data_.end() ; ++it) { for (std::map<std::string, unsigned long int>::const_iterator iev = it->second.events.begin() ; iev != it->second.events.end(); ++iev) combined.events[iev->first] += iev->second; for (std::map<std::string, AvgInfo>::const_iterator iavg = it->second.avg.begin() ; iavg != it->second.avg.end(); ++iavg) { combined.avg[iavg->first].total += iavg->second.total; combined.avg[iavg->first].totalSqr += iavg->second.totalSqr; combined.avg[iavg->first].parts += iavg->second.parts; } for (std::map<std::string, TimeInfo>::const_iterator itm = it->second.time.begin() ; itm != it->second.time.end(); ++itm) { TimeInfo &tc = combined.time[itm->first]; tc.total = tc.total + itm->second.total; tc.parts = tc.parts + itm->second.parts; if (tc.shortest > itm->second.shortest) tc.shortest = itm->second.shortest; if (tc.longest < itm->second.longest) tc.longest = itm->second.longest; } } printThreadInfo(out, combined); } else for (std::map<std::thread::id, PerThread>::const_iterator it = data_.begin() ; it != data_.end() ; ++it) { out << "Thread " << it->first << ":" << std::endl; printThreadInfo(out, it->second); } lock_.unlock(); }