Changeset 1054 for XIOS/dev/dev_olga/src/context_server.cpp
- Timestamp:
- 02/17/17 19:51:36 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/context_server.cpp
r1021 r1054 22 22 namespace xios 23 23 { 24 StdSize CContextServer::totalBuf_ = 0; 24 25 25 26 CContextServer::CContextServer(CContext* parent, MPI_Comm intraComm_,MPI_Comm interComm_) … … 29 30 MPI_Comm_size(intraComm,&intraCommSize); 30 31 MPI_Comm_rank(intraComm,&intraCommRank); 32 31 33 interComm=interComm_; 32 34 int flag; … … 38 40 scheduled=false; 39 41 finished=false; 40 41 42 boost::hash<string> hashString; 42 43 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 67 46 void CContextServer::setPendingEvent(void) 68 47 { … … 70 49 } 71 50 51 72 52 bool CContextServer::hasPendingEvent(void) 73 53 { … … 80 60 } 81 61 82 bool CContextServer::eventLoop( void)62 bool CContextServer::eventLoop(bool enableEventsProcessing /*= true*/) 83 63 { 84 64 listen(); 85 65 checkPendingRequest(); 86 processEvents(); 66 if (enableEventsProcessing) 67 processEvents(); 87 68 return finished; 88 69 } … … 188 169 map<size_t,CEventServer*>::iterator it; 189 170 CEventServer* event; 171 boost::hash<string> hashString; 172 size_t hashId=hashString(context->getId()); 190 173 191 174 it=events.find(currentTimeLine); … … 224 207 { 225 208 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 } 229 212 230 213 void CContextServer::dispatchEvent(CEventServer& event) … … 235 218 int rank; 236 219 list<CEventServer::SSubEvent>::iterator it; 237 CContext::setCurrent(context->getId()); 220 // CContext::setCurrent(context->getId()); 221 StdString ctxId = context->getId(); 222 CContext::setCurrent(ctxId); 238 223 239 224 if (event.classId==CContext::GetType() && event.type==CContext::EVENT_ID_CONTEXT_FINALIZE) … … 243 228 std::map<int, StdSize>::const_iterator itbMap = mapBufferSize_.begin(), 244 229 iteMap = mapBufferSize_.end(), itMap; 245 StdSize totalBuf = 0;246 230 for (itMap = itbMap; itMap != iteMap; ++itMap) 247 231 { 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; 251 236 } 252 237 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; 254 240 } 255 241 else if (event.classId==CContext::GetType()) CContext::dispatchEvent(event); … … 274 260 } 275 261 } 262 263 size_t CContextServer::getTotalBuf(void) 264 { 265 return totalBuf_; 266 } 267 276 268 }
Note: See TracChangeset
for help on using the changeset viewer.