Ignore:
Timestamp:
04/03/24 10:33:55 (6 weeks ago)
Author:
jderouillat
Message:

New timers integration/reporting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/client.cpp

    r2627 r2628  
    3636    StdOFStream CClient::m_errorStream; 
    3737    CPoolRessource* CClient::poolRessource_=nullptr ; 
     38    extern CLogType logTimers ; 
    3839 
    3940    MPI_Comm& CClient::getInterComm(void)   { return (interComm_); } 
     
    543544      report(0)<< " Memory report : Minimum buffer size required : " << CClientBuffer::maxRequestSize << " bytes" << endl ; 
    544545      report(0)<< " Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<<endl ; 
    545       report(100)<<CTimer::getAllCumulatedTime()<<endl ; 
     546 
     547      if (info.isActive(logProfile)) 
     548      { 
     549        printProfile(); 
     550      } 
     551         
     552      if (info.isActive(logTimers)) report(0)<<"\n"<<CTimer::getAllCumulatedTime()<<endl ; 
    546553      if (CXios::reportMemory) 
    547554      { 
     
    552559      xios::releaseStaticAllocation() ; 
    553560 
     561    } 
     562 
     563    void CClient::printProfile() 
     564    { 
     565      list< pair<string,int> > timer_name; 
     566      timer_name.push_back({"XIOS init",0}); 
     567      timer_name.push_back({"XIOS init context",0}); 
     568      timer_name.push_back({"XIOS close definition",0}); 
     569      timer_name.push_back({"XIOS solve inheritance",0}); 
     570      timer_name.push_back({"XIOS update calendar",0}); 
     571      timer_name.push_back({"Check late data (read)",1}); 
     572      timer_name.push_back({"XIOS recv field",0}); 
     573      timer_name.push_back({"XIOS send field",0}); 
     574      timer_name.push_back({"Context event loop",1}); 
     575      timer_name.push_back({"Model to client",1}); 
     576      timer_name.push_back({"Client workflow",1}); 
     577      timer_name.push_back({"Applying filters",2}); 
     578      timer_name.push_back({"Transformation transfers",3}); 
     579      timer_name.push_back({"Transformation MPI",4}); 
     580      timer_name.push_back({"Temporal filters",3}); 
     581      timer_name.push_back({"Scatter event",3}); 
     582      timer_name.push_back({"Field : send data",4}); 
     583      timer_name.push_back({"Blocking time",0}); 
     584      timer_name.push_back({"XIOS context finalize",0}); 
     585      timer_name.push_back({"XIOS finalize",0}); 
     586       
     587      report(0)<< endl; 
     588      double total_time = CTimer::get("XIOS").getCumulatedTime(); 
     589      for(auto it_timer_name = timer_name.begin(); it_timer_name != timer_name.end(); it_timer_name++) 
     590      { 
     591        double timer_time = CTimer::get(it_timer_name->first).getCumulatedTime(); 
     592        if ( timer_time / total_time > 0.001 ) 
     593        { 
     594          ostringstream printed_line; 
     595          printed_line << setprecision(3) << std::fixed; 
     596          for(int itab=0;itab<it_timer_name->second;itab++) 
     597              printed_line << "  "; 
     598          printed_line << it_timer_name->first << " : " << timer_time <<endl; 
     599          string string_line = printed_line.str(); 
     600          report(0)<< string_line; 
     601        } 
     602      } 
    554603    } 
    555604     
Note: See TracChangeset for help on using the changeset viewer.