Ignore:
Timestamp:
02/17/17 19:51:36 (7 years ago)
Author:
oabramkina
Message:

dev: intermediate commit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/context_server.cpp

    r1021 r1054  
    2222namespace xios 
    2323{ 
     24  StdSize CContextServer::totalBuf_ = 0; 
    2425 
    2526  CContextServer::CContextServer(CContext* parent, MPI_Comm intraComm_,MPI_Comm interComm_) 
     
    2930    MPI_Comm_size(intraComm,&intraCommSize); 
    3031    MPI_Comm_rank(intraComm,&intraCommRank); 
     32 
    3133    interComm=interComm_; 
    3234    int flag; 
     
    3840    scheduled=false; 
    3941    finished=false; 
    40  
    4142    boost::hash<string> hashString; 
    4243    hashId=hashString(context->getId()); 
    43  
    44   } 
    45  
    46 //  CContextServer::CContextServer(CContext* parent, int srvLvl, MPI_Comm intraComm_,MPI_Comm interComm_) 
    47 //  { 
    48 //    context=parent; 
    49 //    intraComm=intraComm_; 
    50 //    MPI_Comm_size(intraComm,&intraCommSize); 
    51 //    MPI_Comm_rank(intraComm,&intraCommRank); 
    52 //    interComm=interComm_; 
    53 //    int flag; 
    54 //    MPI_Comm_test_inter(interComm,&flag); 
    55 //    if (flag) MPI_Comm_remote_size(interComm,&commSize); 
    56 //    else  MPI_Comm_size(interComm,&commSize); 
    57 // 
    58 //    currentTimeLine=0; 
    59 //    scheduled=false; 
    60 //    finished=false; 
    61 // 
    62 //    boost::hash<string> hashString; 
    63 //    StdString contextId = context->getId(); 
    64 //    hashId=hashString(contextId); 
    65 // 
    66 //  } 
     44  } 
     45 
    6746  void CContextServer::setPendingEvent(void) 
    6847  { 
     
    7049  } 
    7150 
     51 
    7252  bool CContextServer::hasPendingEvent(void) 
    7353  { 
     
    8060  } 
    8161 
    82   bool CContextServer::eventLoop(void) 
     62  bool CContextServer::eventLoop(bool enableEventsProcessing /*= true*/) 
    8363  { 
    8464    listen(); 
    8565    checkPendingRequest(); 
    86     processEvents(); 
     66    if (enableEventsProcessing) 
     67      processEvents(); 
    8768    return finished; 
    8869  } 
     
    188169    map<size_t,CEventServer*>::iterator it; 
    189170    CEventServer* event; 
     171    boost::hash<string> hashString; 
     172    size_t hashId=hashString(context->getId()); 
    190173 
    191174    it=events.find(currentTimeLine); 
     
    224207  { 
    225208    map<int,CServerBuffer*>::iterator it; 
    226     for(it=buffers.begin();it!=buffers.end();++it) delete it->second; 
    227   } 
    228  
     209    for(it=buffers.begin();it!=buffers.end();++it) 
     210      delete it->second; 
     211  } 
    229212 
    230213  void CContextServer::dispatchEvent(CEventServer& event) 
     
    235218    int rank; 
    236219    list<CEventServer::SSubEvent>::iterator it; 
    237     CContext::setCurrent(context->getId()); 
     220//    CContext::setCurrent(context->getId()); 
     221    StdString ctxId = context->getId(); 
     222    CContext::setCurrent(ctxId); 
    238223 
    239224    if (event.classId==CContext::GetType() && event.type==CContext::EVENT_ID_CONTEXT_FINALIZE) 
     
    243228      std::map<int, StdSize>::const_iterator itbMap = mapBufferSize_.begin(), 
    244229                           iteMap = mapBufferSize_.end(), itMap; 
    245       StdSize totalBuf = 0; 
    246230      for (itMap = itbMap; itMap != iteMap; ++itMap) 
    247231      { 
    248         report(10)<< " Memory report : Context <"<<context->getId()<<"> : server side : memory used for buffer of each connection to client" << endl 
    249             << "  +) With client of rank " << itMap->first << " : " << itMap->second << " bytes " << endl; 
    250         totalBuf += itMap->second; 
     232        rank = itMap->first; 
     233        report(10)<< " Memory report : Context <"<<ctxId<<"> : server side : memory used for buffer of each connection to client" << endl 
     234            << "  +) With client of rank " << rank << " : " << itMap->second << " bytes " << endl; 
     235        totalBuf_ += itMap->second; 
    251236      } 
    252237      context->finalize(); 
    253       report(0)<< " Memory report : Context <"<<context->getId()<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl; 
     238 
     239//      report(0)<< " Memory report : Context <"<<ctxId<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl; 
    254240    } 
    255241    else if (event.classId==CContext::GetType()) CContext::dispatchEvent(event); 
     
    274260    } 
    275261  } 
     262 
     263  size_t CContextServer::getTotalBuf(void) 
     264  { 
     265    return totalBuf_; 
     266  } 
     267 
    276268} 
Note: See TracChangeset for help on using the changeset viewer.