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/server.cpp

    r2591 r2628  
    5252    CServersRessource* CServer::serversRessource_=nullptr ; 
    5353    CThirdPartyDriver* CServer::driver_ =nullptr ; 
    54  
     54    extern CLogType logTimers ; 
    5555        
    5656    void CServer::initialize(void) 
     
    622622      report(0)<<"Performance report : Time spent in processing events : "<<CTimer::get("Process events").getCumulatedTime()<<endl  ; 
    623623      report(0)<<"Performance report : Ratio : "<<CTimer::get("Process events").getCumulatedTime()/CTimer::get("XIOS server").getCumulatedTime()*100.<<"%"<<endl  ; 
    624       report(100)<<CTimer::getAllCumulatedTime()<<endl ; 
     624 
     625      if (info.isActive(logProfile)) 
     626      { 
     627        printProfile(); 
     628      } 
     629       
     630      if (info.isActive(logTimers)) report(0)<<"\n"<<CTimer::getAllCumulatedTime()<<endl ; 
    625631      if (CXios::reportMemory) 
    626632      { 
     
    630636      CWorkflowGraph::drawWorkFlowGraph_server(); 
    631637      xios::releaseStaticAllocation() ; // free memory from static allocation 
     638    } 
     639     
     640    void CServer::printProfile() 
     641    { 
     642      list< pair<string,int> > timer_name; 
     643      timer_name.push_back({"XIOS server",0}); 
     644      timer_name.push_back({"XIOS initialize",0}); 
     645      timer_name.push_back({"XIOS event loop",0}); 
     646      //timer_name.push_back({"Recv event loop (p2p)",1});      // timer concerned by yield and thread (if reader embedded) 
     647      //timer_name.push_back({"Recv event loop (legacy)",1});   // timer concerned by yield and thread 
     648      timer_name.push_back({"Process events",2}); 
     649      timer_name.push_back({"Context : close definition",3}); 
     650      timer_name.push_back({"Reader workflow data entry",3}); 
     651      timer_name.push_back({"Files : reading data",4}); 
     652      //timer_name.push_back({"Field : send data (read)",4});   // timer concerned by yield and thread 
     653      timer_name.push_back({"Server workflow data entry",3}); 
     654      timer_name.push_back({"Server workflow",3}); 
     655      timer_name.push_back({"Applying filters",4}); 
     656      timer_name.push_back({"Transformation transfers",5}); 
     657      timer_name.push_back({"Transformation MPI",6}); 
     658      timer_name.push_back({"Temporal filters",5}); 
     659      timer_name.push_back({"Field : send data",4}); 
     660      //timer_name.push_back({"Scatter event",5});              // timer concerned by yield and thread 
     661      //timer_name.push_back({"Blocking time",6});              // timer concerned by yield and thread 
     662      timer_name.push_back({"Files : create headers",4}); 
     663      timer_name.push_back({"Files : writing data",4}); 
     664      timer_name.push_back({"Context finalize",3});             // timer concerned by yield and thread 
     665      timer_name.push_back({"Files : close",4}); 
     666       
     667      report(0)<< endl; 
     668      double total_time = CTimer::get("Process events").getCumulatedTime(); 
     669      for(auto it_timer_name = timer_name.begin(); it_timer_name != timer_name.end(); it_timer_name++) 
     670      { 
     671        double timer_time = CTimer::get(it_timer_name->first).getCumulatedTime(); 
     672        if ( timer_time / total_time > 0.001 ) 
     673        { 
     674          ostringstream printed_line; 
     675          printed_line << setprecision(3) << std::fixed; 
     676          for(int itab=0;itab<it_timer_name->second;itab++) 
     677              printed_line << "  "; 
     678          printed_line << it_timer_name->first << " : " << timer_time <<endl; 
     679          string string_line = printed_line.str(); 
     680          report(0)<< string_line; 
     681        } 
     682      } 
    632683    } 
    633684 
Note: See TracChangeset for help on using the changeset viewer.