Ignore:
Timestamp:
11/19/18 15:52:54 (5 years ago)
Author:
yushan
Message:

branch_openmp merged with trunk r1597

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/src/timer.cpp

    r1158 r1601  
    66#include <sstream> 
    77#include "tracer.hpp" 
     8using namespace ep_lib; 
    89 
    910namespace xios 
    1011{ 
    11   std::map<std::string,CTimer> CTimer::allTimer; 
     12  std::map<std::string,CTimer> *CTimer::allTimer_ptr = 0; 
    1213   
    1314  CTimer::CTimer(const std::string& name_) : name(name_)  
     
    5455  CTimer& CTimer::get(const std::string name) 
    5556  { 
    56     std::map<std::string,CTimer>::iterator it = allTimer.find(name); 
    57     if (it == allTimer.end()) 
    58       it = allTimer.insert(std::make_pair(name, CTimer(name))).first; 
     57    if(allTimer_ptr == NULL) allTimer_ptr = new std::map<std::string,CTimer>; 
     58 
     59    std::map<std::string,CTimer>::iterator it = allTimer_ptr->find(name); 
     60 
     61    if (it == allTimer_ptr->end()) 
     62      it = allTimer_ptr->insert(std::make_pair(name, CTimer(name))).first; 
     63 
    5964    return it->second; 
    6065  } 
     
    6368  { 
    6469    std::ostringstream strOut ; 
    65     for(std::map<std::string,CTimer>::iterator it=allTimer.begin();it!=allTimer.end();++it) 
     70    if(allTimer_ptr == 0) allTimer_ptr = new std::map<std::string,CTimer>; 
     71 
     72    for(std::map<std::string,CTimer>::iterator it=allTimer_ptr->begin();it!=allTimer_ptr->end();++it) 
    6673      strOut<<"Timer : "<<it->first<<"    -->   cumulated time : "<<it->second.getCumulatedTime()<<std::endl ; 
    6774    return strOut.str() ; 
Note: See TracChangeset for help on using the changeset viewer.