std::string formatStatistics( const PerformanceMonitor &monitor, size_t maxLinesPerMetric ) { // First show totals std::vector<std::string> names; std::vector<std::string> values; for( int m = First; m <= Last; ++m ) { PerformanceMetric metric = static_cast<PerformanceMetric>( m ); FormatTotalStatistics::ResultType p = dispatchMetric<FormatTotalStatistics>( FormatTotalStatistics( monitor.combinedStatistics() ), metric ); names.push_back( p.first ); values.push_back( p.second ); } std::stringstream ss; ss << "PerformanceMonitor Summary :\n\n"; outputItems( names, values, ss ); ss << "\n"; // Now show breakdowns by plugs in each category std::string s = ss.str(); for( int m = First; m <= Last; ++m ) { s += formatStatistics( monitor, static_cast<PerformanceMetric>( m ), maxLinesPerMetric ); if( m != Last ) { s += "\n"; } } return s; }