packages/Utils/comm/Timing_Diagnostics.cc
//---------------------------------------------------------------------------//
/*!
 * \brief Do timing output.
 *
 * This function does global reductions across all space to get the timing
 * max/mins across processors, so it should be called from all processors.
 * The output is only processed on the input processor.
 *
 * \param out Ostream for output
 * \param total total time that the invidual timers are normalized to
 */
\brief Do timing output.
This function does global reductions across all space to get the timing
max/mins across processors, so it should be called from all processors.
The output is only processed on the input processor.

\param out Ostream for output
\param total total time that the invidual timers are normalized to
\ brief Do timing output . This function does global reductions across all space to get the timing max / mins across processors so it should be called from all processors . The output is only processed on the input processor . \ param out Ostream for output \ param total total time that the invidual timers are normalized to
void Timing_Diagnostics::report(std::ostream& out, double total)
{
#if UTILS_TIMING > 0
    using std::vector;
    using std::setw;
    using std::endl;
    using std::ios;
    out.precision(4);
    Vec_Keys keys = Timing_Diagnostics::timer_keys();
    const int num_keys = keys.size();
    vector<double> max(keys.size(), 0.0);
    vector<double> min(keys.size(), 0.0);
    double v = 0.0;
    for (int i = 0; i < num_keys; ++i)
    {
        v = Timing_Diagnostics::timer_value(keys[i]);
        max[i] = v;
        min[i] = v;
    }
    global_min(&min[0], num_keys);
    global_max(&max[0], num_keys);
    global_barrier();
    if (node() == 0)
    {
        out << endl;
        out << "===================" << endl;
        out << "Final Timing Report" << endl;
        out << "===================" << endl << endl;
        out << setw(60) << "Routine" << setw(15) << "Max Fraction"
            << setw(15) << "Min Fraction" << endl;
        out << "==============================================="
            << "==========================================="
            << endl;
        for (int i = 0; i < num_keys; ++i)
        {
            out << setw(60) <<  keys[i] << setw(15)
                << std::scientific << max[i] / total
                << setw(15) << min[i] / total << endl;
        }
        out << "==============================================="
            << "==========================================="
            << endl;
    }
    global_barrier();
    reset_timers();
#endif
}
void Timing_Diagnostics :: report ( std :: ostream & out , double total ) { #if UTILS_TIMING > 0 using std :: vector ; using std :: setw ; using std :: endl ; using std :: ios ; out . precision ( 4 ) ; Vec_Keys keys = Timing_Diagnostics :: timer_keys ( ) ; const int num_keys = keys . size ( ) ; vector < double > max ( keys . size ( ) , 0.0 ) ; vector < double > min ( keys . size ( ) , 0.0 ) ; double v = 0.0 ; for ( int i = 0 ; i < num_keys ; ++ i ) { v = Timing_Diagnostics :: timer_value ( keys [ i ] ) ; max [ i ] = v ; min [ i ] = v ; } global_min ( & min [ 0 ] , num_keys ) ; global_max ( & max [ 0 ] , num_keys ) ; global_barrier ( ) ; if ( node ( ) == 0 ) { out << endl ; out << " " << endl ; out << " " << endl ; out << " " << endl << endl ; out << setw ( 60 ) << " " << setw ( 15 ) << " " << setw ( 15 ) << " " << endl ; out << " " << " " << endl ; for ( int i = 0 ; i < num_keys ; ++ i ) { out << setw ( 60 ) << keys [ i ] << setw ( 15 ) << std :: scientific << max [ i ] / total << setw ( 15 ) << min [ i ] / total << endl ; } out << " " << " " << endl ; } global_barrier ( ) ; reset_timers ( ) ; #endif }
\brief Do timing output.
\ brief Do timing output .
// get the keys // determine max/min // get the value of the timer // get the local value // get the max/min value across all processors // output the max/mins // reset the timers