Changeset 3913 in Sophya
- Timestamp:
- Nov 26, 2010, 2:45:39 PM (15 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/acqparam_exemple.d
r3909 r3913 4 4 # 2009 - 2010 5 5 ################################################################# 6 ##### Variables d'environnement de configuration 7 ## BRACQ_TMPDIR , TMPDIR : Repertoire de fichiers temporaires (defaut=/tmp/) 8 ## BRACQ_BASEDIR : Base directory (/Raid) 9 ## BRACQ_FIBERIDS : FiberIds (defaut 1,2,3,4,5,6,7,8) 10 ################################################################# 11 6 12 # Liste des fibres - @fibres I[,J,K...] ou @fibers 7 13 # @fibers 1,2,3 OU @fibres 1,2,3 … … 58 64 # @ethrtargets Target1 [ Target2 ... ] 59 65 ethrtargets machine1 machine2 ... 66 ## Liste de cible pour chaque machine 67 # @ethrtargetsf1 targ1 [targ2 ...] 68 # @ethrtargetsf8 targ1 [targ2 ...] 69 ethrtargetsf1 machine1 machine2 ... 70 ethrtargetsf2 machine1 machine2 ... 71 ## 60 72 # Activation du mode transfert direct DMA -> Ethernet , sans decoupage/verification en paquet a la source 61 73 # @pci2ethdirect -
trunk/AddOn/TAcq/brparam.cc
r3911 r3913 42 42 } 43 43 44 #define PMAXNBFIBRES 64 44 45 /* --Methode-- */ 45 46 BRConfList::BRConfList() 46 : basedir_("./") 47 { 47 : basedir_("./"), fiberIds_(PMAXNBFIBRES), tmpdir_("/tmp") 48 { 49 InitFromEnv(); 48 50 } 49 51 50 52 /* --Methode-- */ 51 53 BRConfList::BRConfList(string basedir) 52 : basedir_(basedir) 53 { 54 : basedir_("./"), fiberIds_(PMAXNBFIBRES), tmpdir_("/tmp") 55 { 56 InitFromEnv(); 57 SetBaseDirectory(basedir); 54 58 } 55 59 56 60 /* --Methode-- */ 57 61 BRConfList::BRConfList(string basedir, vector<ADCBoardDesc> boards) 58 : basedir_(basedir), boards_(boards) 59 { 60 size_t len = basedir_.length(); 61 if ((len>1)&&(basedir_[len-1]!='/')) basedir_ += '/'; 62 : basedir_("./"), fiberIds_(PMAXNBFIBRES), tmpdir_("/tmp") 63 { 64 InitFromEnv(); 65 SetBaseDirectory(basedir); 66 boards_=boards; 62 67 } 63 68 64 69 /* --Methode-- */ 65 70 BRConfList::BRConfList(BRConfList const & cf) 66 : basedir_(cf.basedir_), boards_(cf.boards_) 67 { 68 } 69 70 /* --Methode-- */ 71 void BRConfList::SetBaseDirectory(string basedir) 72 { 71 : basedir_(cf.basedir_), boards_(cf.boards_), fiberIdsS_(cf.fiberIdsS_), fiberIds_(cf.fiberIds_), tmpdir_(cf.tmpdir_) 72 { 73 } 74 75 /* --Methode-- */ 76 void BRConfList::InitFromEnv() 77 { 78 const char* venvp = NULL; 79 venvp=getenv("BRACQ_TMPDIR"); 80 if (venvp!=NULL) tmpdir_=venvp; 81 else { 82 if (venvp!=NULL) tmpdir_=venvp; 83 venvp = getenv("TMPDIR"); 84 } 85 venvp=getenv("BRACQ_BASEDIR"); 86 if (venvp!=NULL) { 87 string ebd=venvp; 88 SetBaseDirectory(ebd); 89 } 90 string fibids="1,2,3,4,5,6,7,8"; 91 venvp=getenv("BRACQ_FIBERIDS"); 92 if (venvp!=NULL) fibids=venvp; 93 SetFiberIds(fibids); 94 } 95 96 /* --Methode-- */ 97 int BRConfList::SetFiberIds(string& sfids) 98 { 99 fiberIdsS_=sfids; 100 vector<string> fibids; 101 FillVStringFrString(sfids, fibids, ','); 102 int rc=0; 103 for (size_t fib=0; fib<fibids.size(); fib++) { 104 if (fib>fiberIds_.size()) break; 105 fiberIds_[fib]=atoi(fibids[fib].c_str()); 106 rc++; 107 } 108 return rc; 109 } 110 111 /* --Methode-- */ 112 void BRConfList::SetBaseDirectory(string& basedir) 113 { 114 if (basedir.length()<1) return; 73 115 basedir_=basedir; 74 116 size_t len = basedir_.length(); … … 77 119 78 120 /* --Methode-- */ 79 voidBRConfList::Set(BRConfList const & cf)121 BRConfList& BRConfList::Set(BRConfList const & cf) 80 122 { 81 123 basedir_=cf.basedir_; 82 124 boards_=cf.boards_; 125 fiberIdsS_=cf.fiberIdsS_; 126 fiberIds_=cf.fiberIds_; 127 tmpdir_=cf.tmpdir_; 128 return (*this); 83 129 } 84 130 … … 86 132 ostream& BRConfList::Print(ostream& os) 87 133 { 88 os << " ----- BRConfList:: BaseDir:" << basedir_ << " NBoards= " << boards_.size() << endl; 134 os << " ----- BRConfList:: BaseDir=" << basedir_ << " TmpDir=" << tmpdir_ 135 << " NBoards= " << boards_.size() << endl; 89 136 for(size_t k=0; k<boards_.size(); k++) boards_[k].Print(os); 137 os << " FiberIdString=" << fiberIdsS_ << endl; 90 138 return os; 91 139 } … … 98 146 99 147 // Classe qui memorise tous les parametres importants de l'acquisition 100 #define PMAXNBFIBRES 64101 148 102 149 /* --Methode-- */ … … 110 157 111 158 FiberListS=fibres; 112 FiberIdsS="1,2,3,4,5,6,7,8";113 for (int ii=0; ii<PMAXNBFIBRES; ii++) FiberIds.push_back(ii+1);114 159 115 160 PaqSize=paqsz; … … 188 233 189 234 FiberListS=p.FiberListS; 190 FiberNum=p.FiberNum; 191 FiberIdsS=p.FiberIdsS; 192 FiberIds=p.FiberIds; 235 fiberNum_=p.fiberNum_; 193 236 194 237 PaqSize=p.PaqSize; … … 222 265 pci2eth_fgdirect=p.pci2eth_fgdirect; 223 266 eths_targets=p.eths_targets; 267 eths_stargs=p.eths_stargs; 268 eths_fibtargs=p.eths_fibtargs; 269 224 270 ethr_nlink=p.ethr_nlink; 225 271 ethr_forcesamefc_=p.ethr_forcesamefc_; … … 254 300 else if(conf.HasKey("fibers")) 255 301 FiberListS= conf.SParam("fibers",0,"1"); 256 if(conf.HasKey("fiberids"))257 FiberIdsS= conf.SParam("fiberids",0,"1");258 302 259 303 OutPathName= conf.SParam("outpathname",0,"TstAcq"); … … 280 324 tcpportid=conf.IParam("tcpportid",0,BRSPORTID); 281 325 if (conf.HasKey("pci2ethdirect")) pci2eth_fgdirect = true; // Transfer direct DMA -> Ethernet 282 if (conf.HasKey("ethrtargets")) { // Machines destinations des paquets 326 if (conf.HasKey("ethrtargets")) { // Machines destinations des paquets - memes destinations pour toutes les fibres 283 327 for(int it=0; it<conf.NbParam("ethrtargets"); it++) 284 eths_targets.push_back(conf.SParam("ethrtargets",it)); 285 } 328 eths_stargs.push_back(conf.SParam("ethrtargets",it)); 329 } 330 331 const char* ethtf[9]={"ethrtargetsf1","ethrtargetsf2","ethrtargetsf3","ethrtargetsf4", 332 "ethrtargetsf5","ethrtargetsf6","ethrtargetsf7","ethrtargetsf8"}; 333 for(int jj=0;jj<8;jj++) { 334 if (conf.HasKey( ethtf[jj] )) { 335 vector<string> ftargs; 336 int fid=jj+1; 337 for(int it=0; it<conf.NbParam( ethtf[jj] ); it++) 338 ftargs.push_back(conf.SParam( ethtf[jj] ,it)); 339 eths_fibtargs[fid]=ftargs; 340 } 341 } 342 286 343 ethr_nlink=conf.IParam("ethrnlink",0,0); // Nombre de sources de paquets en reception ethernet 287 344 if (conf.HasKey("ethrforcesamefc")) { … … 328 385 vector<string> fiblist; 329 386 FillVStringFrString(FiberListS, fiblist, ','); 330 FiberNum.resize(fiblist.size());387 fiberNum_.resize(fiblist.size()); 331 388 for (int fib=0; fib<fiblist.size(); fib++) { 332 FiberNum[fib]=atoi(fiblist[fib].c_str()); 333 } 334 vector<string> fibids; 335 FillVStringFrString(FiberIdsS, fibids, ','); 336 for (int fib=0; fib<fibids.size(); fib++) { 337 FiberIds[fib]=atoi(fibids[fib].c_str()); 389 fiberNum_[fib]=atoi(fiblist[fib].c_str()); 390 } 391 392 eths_targets.resize(fiberNum_.size()); 393 for (int fib=0; fib<fiberNum_.size(); fib++) { 394 map< int, vector<string> >::const_iterator itm=eths_fibtargs.find(fiberNum_[fib]); 395 if (itm != eths_fibtargs.end()) eths_targets[fib]=itm->second; 396 else eths_targets[fib]=eths_stargs; 338 397 } 339 398 … … 414 473 os << " ------ BRParList::Print() ----- " << endl; 415 474 os << " FiberListS=" << FiberListS ; 416 os << " FiberIdsS=" << FiberIdsS ;417 os << " Fibers (Num->Id): ";418 for(size_t f=0; f<NbFibers(); f++) cout << FiberNum[f] << " -> " << FiberIds[f] << " ; " ;419 os << endl;420 475 os << " PaqSize=" <<PaqSize; 421 476 os << " DMA_Size_kb=" <<dmasizekb << " (EndDMA: Maxkw=" << maxkwedma_ << " NRetry=" << nretrydma_ … … 432 487 os << " PaquetSize Reduction, ReducedSize=" << redpqsize << " Offset=" << reducoffset << endl; 433 488 } 434 if (eths_targets.size()>0) { 435 cout << " DMA->Ethernet NbTargets=" << eths_targets.size() 436 << ((pci2eth_fgdirect)?" (DirectTransferMode) " : " " ) << " :"; 437 for(size_t it=0; it<eths_targets.size(); it++) cout << eths_targets[it] << " , "; 438 cout << endl; 439 } 440 cout << " TCP-PortId=" << tcpportid << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink << endl; 489 if ((eths_stargs.size()>0)||(eths_fibtargs.size()>0)) { 490 os << " DMA->Ethernet Targets=" << eths_targets.size() 491 << ((pci2eth_fgdirect)?" (DirectTransferMode) " : " " ) << endl; 492 493 for(size_t fib=0; fib<eths_targets.size(); fib++) { 494 os << " Fiber Num=" << fiberNum_[fib] << " --> eth_targets: "; 495 for(size_t it=0; it<eths_targets[fib].size(); it++) 496 os << eths_targets[fib][it] << " ; "; 497 os << endl; 498 } 499 } 500 os << " TCP-PortId=" << tcpportid << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink << endl; 441 501 if (ethr_forcesamefc_) 442 cout<< "EthernetReader mode: ForceSameFrameCounter read mode with Max_PaquetCounterDiff= "502 os << "EthernetReader mode: ForceSameFrameCounter read mode with Max_PaquetCounterDiff= " 443 503 << ethr_sfc_maxdpc_ << " MaxNbResync=" << ethr_sfc_maxresync_ 444 504 << ((ethr_waitendmsg_)?" Wait_For_END_Message_Before_Terminate ":" ") << endl; 445 505 else 446 cout<< "EthernetReader mode: AllOKPaquets read mode "506 os << "EthernetReader mode: AllOKPaquets read mode " 447 507 << ((ethr_waitendmsg_)?" Wait_For_END_Message_Before_Terminate ":" ") << endl; 448 508 … … 483 543 config_->Print(os); 484 544 param_->Print(os); 545 os << " Fibers f: Num->Id "; 546 for(size_t f=0; f<NbFibers(); f++) 547 os << f << ": " << FiberNum(f) << " -> " << FiberId(f) << " ; " ; 548 os << endl; 485 549 os << " ----------------------------------------------------- " << endl; 486 550 } … … 501 565 memset(cmd,0,1024); 502 566 for (int i= 0; i< NFibers() ; i++) { 503 sprintf(cmd,"mkdir %s%s/Fiber%d",config_->BaseDirectory().c_str(), param_->OutPathName.c_str(),param_-> FiberNum[i]);567 sprintf(cmd,"mkdir %s%s/Fiber%d",config_->BaseDirectory().c_str(), param_->OutPathName.c_str(),param_->fiberNum_[i]); 504 568 if (system(cmd) < 0) { 505 569 cout << "CreateOutputDirectories()/Error: Can not create subdirectory " … … 529 593 { 530 594 char buff[24]; 531 sprintf(buff,"Fiber%d/",param_-> FiberNum[ifib]);595 sprintf(buff,"Fiber%d/",param_->fiberNum_[ifib]); 532 596 return ( config_->BaseDirectory() + param_->OutPathName + buff ); 533 597 } -
trunk/AddOn/TAcq/brparam.h
r3909 r3913 20 20 #include <string> 21 21 #include <vector> 22 #include <map> 22 23 #include <iostream> 23 24 #include "brpaqu.h" … … 61 62 BRConfList(BRConfList const & cf); 62 63 63 void SetBaseDirectory(string basedir); 64 void Set(BRConfList const & cf); 64 void SetBaseDirectory(string& basedir); 65 BRConfList& Set(BRConfList const & cf); 66 inline BRConfList& operator = (BRConfList const & cf) { return Set(cf); } 67 68 int SetFiberIds(string& sfids); // Identification absolue des fibres sous forme de 3,5,8 69 65 70 ostream& Print(ostream& os) ; 66 71 void ReadDCFile(string file); 67 72 inline const string& BaseDirectory() const { return basedir_; } 73 inline const string& TmpDirectory() const { return tmpdir_; } 74 75 inline int FiberId(int numfib) 76 { size_t ff=numfib-1; if (ff<fiberIds_.size()) return fiberIds_[ff]; else return 0; } 77 78 void InitFromEnv(); // initialisation a partir de variables d'environnement 68 79 //....................................... 69 80 string basedir_; 70 81 vector<ADCBoardDesc> boards_; 82 string fiberIdsS_; // String_liste des numeros 'absolu' des fibres 12,13,14,15 par exemple 83 vector<int> fiberIds_; // liste des numero d'identification 'absolu' des fibres {12,13,14,15} par ex. 84 string tmpdir_; // repertoire pour fichiers temporaires 71 85 }; 72 86 … … 86 100 void ReadDCFile(string file); 87 101 88 // Nombre de fibres 89 inline size_t NFibers() { return FiberNum.size(); } 90 inline size_t NbFibers() { return FiberNum.size(); } 102 // Nombre de fibres pour acquisition 103 inline size_t NFibers() { return fiberNum_.size(); } 104 inline size_t NbFibers() { return fiberNum_.size(); } 105 // Numeros des fibres pour acquisition 106 inline int FiberNum(size_t fib) 107 { if (fib<fiberNum_.size()) return fiberNum_[fib]; else return 0; } 91 108 // Taille des operations DMA (en octets) 92 109 inline uint_4 DMASizeBytes() { return dmasizekb*1024; } … … 114 131 inline uint_4 PatternSize() { return ((PaqSize-(BRHDRSIZE+BRTRLSIZE))/4); } 115 132 116 // Liste des machines cibles pour transfert sur ethernet 117 inline void SetEthTargets(vector<string>& targs) { eths_targets=targs; return; } 118 inline vector<string>& GetEthTargets() { return eths_targets; } 133 inline vector< vector<string> >& GetEthTargets() { return eths_targets; } 119 134 // Nombre de liens ethernet comme source de donnees (paquets) 120 135 inline int NbEthLinks() { return ethr_nlink; } … … 130 145 bool fgsinglechannel; // true -> un seul canal par fibre (par defaut=2 canaux/fibres) 131 146 132 string FiberListS ; // String_liste des fibres a utiliser 1,3,4 par exemple 133 vector<int> FiberNum; // liste des fibres a utiliser {1,3,4} par exemple 134 string FiberIdsS ; // String_liste des numeros 'absolu' des fibres 12,13,14,15 par exemple 135 vector<int> FiberIds; // liste des numero d'identification 'absolu' des fibres {12,13,14,15} par ex. 147 string FiberListS ; // String_liste des numeros de fibres a utiliser 1,3,4 par exemple 148 vector<int> fiberNum_; // liste des numeros fibres a utiliser {1,3,4} par exemple 136 149 137 150 string OutPathName; // directory de base … … 170 183 // Cote Send DMA -> Ethernet 171 184 bool pci2eth_fgdirect; // true -> direct transfer DMA to Ethernet 172 vector< string > eths_targets; // Liste des machines cibles pour les transferts DMA -> ethernet 185 vector< vector<string> > eths_targets; // Liste des machines cibles pour les transferts DMA -> ethernet pour chaque fibre 186 vector<string> eths_stargs; // cibles communes pour toutes les fibres 187 map< int, vector<string> > eths_fibtargs; // Cibles specifiees pour les differentes fibres ds les datacards 173 188 // Cote reception 174 int ethr_nlink; // Nombre total de source d'envoi (= nb total de fibre de fibre)189 int ethr_nlink; // Nombre total de source d'envoi (= nb total de fibres = nb total liens ethernet) 175 190 bool ethr_forcesamefc_; // true -> on force receptions de paquets avec SAME FrameCounter sur tous les liens 176 191 uint_4 ethr_sfc_maxdpc_; // valeur maximum de difference tolere entre compteurs de paquets de differentes fibres … … 241 256 inline bool GetFileDevNull() { return param_->fgnulldev4fits; }; 242 257 243 // Nombre de fibres 258 // Nombre de fibres pour l'acquisition 244 259 inline int NFibers() { return param_->NbFibers(); } 245 260 inline int NbFibers() { return param_->NbFibers(); } 261 // Numeros des fibres pour l'acquisition 262 inline int FiberNum(size_t fib) { return param_->FiberNum(fib); } 263 // Identificateurs des fibres 264 inline int FiberId(size_t fib) { return config_->FiberId( param_->FiberNum(fib) ); } 246 265 247 266 // Taille des operations DMA (en octets) … … 273 292 inline string OutputDirectory() { return (config_->BaseDirectory()+param_->OutPathName); } 274 293 string OutputDirectoryFib(int fib); 294 // repertoire temporaire 295 inline const string& TmpDirectory() const { return config_->TmpDirectory(); } 275 296 276 297 protected: -
trunk/AddOn/TAcq/mfacq.cc
r3909 r3913 53 53 54 54 const char* desact[4] = {"PCIE_To_Ethernet", "Ethernet_To_Disk", "Ethernet_To_Visibilities","PCIE_DMA_To_Disk"}; 55 string action=arg[1];56 int act = 0;57 if ((action != "-pci2eth")&&(action != "-pci2disk")&&(action != "-eth2disk")&&(action != "-eth2visib")) {58 cout << " mfacq/Error , Bad action argument : " << action << endl;59 return 2;60 }61 if (action == "-pci2eth") act=0;62 else if (action == "-eth2disk") act=1;63 else if (action == "-eth2visib") act=2;64 else if (action == "-pci2disk") act=3;65 66 string pardcfile=arg[2];67 #ifndef NOPCIECARD68 string basedir="/Raid";69 #else70 string basedir="./";71 #endif72 vector<string> oargs;73 if (narg>3) {74 basedir=arg[2];75 for(int jj=3; jj<narg; jj++) oargs.push_back(arg[jj]);76 }77 55 try { 78 56 // Creation/initialisation parametres Acq 79 BRAcqConfig acpar; 80 acpar.ReadParamFile(pardcfile); 81 acpar.GetConfig().SetBaseDirectory(basedir); 82 if ((act==0)&&(oargs.size()>0)) 83 acpar.GetParams().SetEthTargets(oargs); 84 // Creation des repertoires 85 if (act > 0) 86 if (acpar.CreateOutputDirectories()!=0) return 9; 87 acpar.GetParams().fgdoVisiC=false; 88 if (act == 2) acpar.GetParams().fgdoVisiC=true; 89 90 acpar.Print(cout); 91 struct sigaction siact; 92 if (!acpar.GetParams().fg_hard_ctrlc) { 93 siact.sa_handler=Stop; 94 sigaction(SIGINT,&siact,NULL); 57 int act = DecodeArgs(narg,arg); 58 if ((act < 0)||(act>3)) { 59 cout << "mfacq/ERROR decoding arguments act=" << act << " -> exit -5" << endl; 60 return -5; 95 61 } 62 cout << " mfacq/INFO action: " << desact[act] << endl; 96 63 switch (act) { 97 64 case 0: … … 139 106 void Usage(bool fgshort) 140 107 { 141 cout << " Usage: mfacq Action DataCardFile [BaseDirectory /TargetMachines]" << endl;108 cout << " Usage: mfacq Action DataCardFileName [-dc DataCard -dc DataCard] [TargetMachines]" << endl; 142 109 if (fgshort) return; 143 110 cout << " o Action = -pci2disk , -pci2eth , -eth2disk , -eth2visib \n " … … 145 112 << " fibres outpathname skysource paqsize dmasizekb nbfiles \n" 146 113 << " nblocperfile acqmode memmgr monitor reducpaqsz ... "<< endl; 147 cout << " o BaseDirectory (default= /Raid ) for -pci2disk , -eth2disk" << endl;114 cout << " o -dc DataCard : datacard appended for DataCardFileName" << endl; 148 115 cout << " o TargetMachines : List of target machines for PCIe2Ethernet (-pci2eth) \n " << endl; 149 116 return; 150 117 } 151 118 119 /* --Nouvelle-Fonction-- */ 120 int DecodeArgs(int narg, char* arg[]) 121 { 122 string action=arg[1]; 123 int act = 0; 124 if ((action != "-pci2eth")&&(action != "-pci2disk")&&(action != "-eth2disk")&&(action != "-eth2visib")) { 125 cout << " mfacq/Error , Bad action argument : " << action << endl; 126 return -2; 127 } 128 if (action == "-pci2eth") act=0; 129 else if (action == "-eth2disk") act=1; 130 else if (action == "-eth2visib") act=2; 131 else if (action == "-pci2disk") act=3; 132 133 BRAcqConfig acpar; 134 char tmpdcname[128]; 135 sprintf(tmpdcname,"%s/dc_XXXXXX",acpar.TmpDirectory().c_str()); 136 mktemp(tmpdcname); 137 string dcardfile=tmpdcname; 138 dcardfile+=".d"; 139 string pardcfile=arg[2]; 140 char cmd[512]; 141 sprintf(cmd,"cp %s %s",pardcfile.c_str(),dcardfile.c_str()); 142 cout << " mfacq/DecodeArgs() executing command: " << cmd << endl; 143 int rc; 144 rc=system(cmd); 145 if (rc!=0) { 146 cout << " mfacq/ERROR system(cmd) , Rc=" << rc << endl; 147 return -3; 148 } 149 150 vector<string> oargs; 151 int aoff=3; 152 { 153 ofstream dcf( dcardfile.c_str(), ios_base::out|ios_base::app); 154 dcf << "#### Appended datacards from command line " << endl; 155 while (aoff<(narg-1)) { 156 if (strcmp(arg[aoff],"-dc") != 0) break; 157 dcf << arg[aoff+1] << endl; 158 } 159 if ((act==0)&&(aoff<narg)) { // default ethernet target destinations 160 dcf << "@ethrtargets "; 161 for(int jj=aoff; jj<narg; jj++) dcf << arg[jj] << " "; 162 dcf << endl; 163 } 164 } 165 166 acpar.GetParams().fgdoVisiC=false; 167 if (act == 2) acpar.GetParams().fgdoVisiC=true; 168 169 acpar.ReadParamFile(dcardfile); 170 acpar.CreateOutputDirectories(); 171 172 sprintf(cmd,"cp %s %s/acqparm.d",dcardfile.c_str(),acpar.OutputDirectory().c_str()); 173 cout << " mfacq/DecodeArgs() executing command: " << cmd << endl; 174 rc=system(cmd); 175 if (rc!=0) { 176 cout << " mfacq/ERROR system(cmd) , Rc=" << rc << endl; 177 return -3; 178 } 179 180 acpar.Print(cout); 181 string pflnm=acpar.OutputDirectory(); 182 pflnm+="/params.log"; 183 ofstream pfile(pflnm.c_str()); 184 acpar.Print(pfile); 185 186 struct sigaction siact; 187 if (!acpar.GetParams().fg_hard_ctrlc) { 188 siact.sa_handler=Stop; 189 sigaction(SIGINT,&siact,NULL); 190 } 191 192 return act; 193 } 152 194 153 195 /* --Nouvelle-Fonction-- */ … … 210 252 vector<PCIEWrapperInterface*> vec_pciw; 211 253 for (size_t i=0 ;i<bpar.NFibers();i++) { 212 pciwp[i]->SetFiberNumId( acpar.FiberNum[i], acpar.FiberIds[i]);254 pciwp[i]->SetFiberNumId(bpar.FiberNum(i), bpar.FiberId(i)); 213 255 vec_pciw.push_back( pciwp[i]); 214 256 // cout << " mfacq[3.b]/Debug - pciwp[" << i << "] " << hex << pciwp[i] << dec << endl; … … 299 341 vector<PCIEWrapperInterface*> vec_pciw; 300 342 for (size_t i=0 ;i<bpar.NFibers();i++) { 301 pciwp[i]->SetFiberNumId( acpar.FiberNum[i], acpar.FiberIds[i]);343 pciwp[i]->SetFiberNumId(bpar.FiberNum(i), bpar.FiberId(i)); 302 344 vec_pciw.push_back( pciwp[i]); 303 345 } … … 329 371 } 330 372 331 332 /* Fonction-Utilitaire : Voir en fin de fichier */333 MemZaction ConvertMemZ_Status2Action( MemZStatus st );334 373 335 374 /* --Nouvelle-Fonction-- */ … … 385 424 string ppath=bpar.OutputDirectory(); 386 425 MonitorProc PrThr(mmgr); 387 PrThr.SetMemZAction( ConvertMemZ_Status2Action( mskmon ) );426 PrThr.SetMemZAction( RAcqMemZoneMgr::Convert_Status2Action( mskmon ) ); 388 427 BRVisCalcGroup VCGThr(acpar.nbcalgrpVisiC, mmgr, bpar.OutputDirectory(), acpar.nmeanVisiC, acpar.nthrVisiC); 389 428 VCGThr.SelectFreqBinning(acpar.freqminVisiC, acpar.freqmaxVisiC, acpar.nbinfreqVisiC); … … 436 475 437 476 438 /* --Nouvelle-Fonction-Utilitaire */439 MemZaction ConvertMemZ_Status2Action( MemZStatus st )440 {441 MemZaction ra=MemZA_None;442 switch (st) {443 case MemZS_Filled:444 ra=MemZA_Fill;445 break;446 case MemZS_Saved:447 ra=MemZA_Save;448 break;449 case MemZS_Proc:450 ra=MemZA_Proc;451 break;452 case MemZS_ProcA:453 ra=MemZA_ProcA;454 break;455 case MemZS_ProcB:456 ra=MemZA_ProcB;457 break;458 case MemZS_ProcC:459 ra=MemZA_ProcC;460 break;461 case MemZS_ProcD:462 ra=MemZA_ProcD;463 break;464 case MemZS_ProcE:465 ra=MemZA_ProcE;466 break;467 case MemZS_ProcF:468 ra=MemZA_ProcF;469 break;470 default:471 ra=MemZA_None;472 break;473 }474 return ra;475 } -
trunk/AddOn/TAcq/mfacq.h
r3876 r3913 3 3 #include <signal.h> 4 4 #include <iostream> 5 #include <fstream> 6 5 7 #include <stdlib.h> 6 8 #include <string.h> … … 40 42 // Fonctions appelees par le main 41 43 void Usage(bool fgshort=true); 42 int DecodeArgs(string Fibres); 43 44 int DecodeArgs(int narg, char* arg[]); 44 45 45 46 int PCIEToEthernetTransfer(); -
trunk/AddOn/TAcq/racqueth.cc
r3911 r3913 32 32 /* --Methode-- */ 33 33 PCIEToEthernet::PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw, vector<string>& destname, BRParList const& par, int portid) 34 : par_(par), vec_pciw_ (vec_pciw), destname_(destname), tcpportid_(portid) 34 : par_(par), vec_pciw_ (vec_pciw), tcpportid_(portid) 35 { 36 if (vec_pciw_.size() > MAXNBFIB) 37 throw ParmError("PCIEToEthernet:ERROR/ vec_pciw.size() > MAXNBFIB "); 38 for(size_t i=0; i<vec_pciw_.size(); i++) destname_.push_back(destname); 39 InitConnections(); 40 } 41 42 /* --Methode-- */ 43 PCIEToEthernet::PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw, vector< vector<string> >& destname, BRParList const& par, int portid) 44 : par_(par), vec_pciw_ (vec_pciw), tcpportid_(portid) 45 { 46 if (vec_pciw_.size() > MAXNBFIB) 47 throw ParmError("PCIEToEthernet:ERROR/ vec_pciw.size() > MAXNBFIB "); 48 if (destname.size()!=vec_pciw.size()) 49 throw ParmError("PCIEToEthernet:ERROR/ vec_pciw.size() != destname_.size() "); 50 destname_= destname; 51 InitConnections(); 52 } 53 54 /* --Methode-- */ 55 void PCIEToEthernet::InitConnections() 35 56 { 36 57 nmaxpaq_ = par_.MaxNbPaquets(); … … 40 61 packSizeInMgr_=par_.MMgrPaquetSize(); 41 62 sizeFr_=par_.DMASizeBytes(); 42 if (vec_pciw.size() > MAXNBFIB) 43 throw ParmError("PCIEToEthernet:ERROR/ vec_pciw.size() > MAXNBFIB "); 44 nbDma_= vec_pciw.size(); 63 64 nbDma_= vec_pciw_.size(); 45 65 46 66 // true -> direct transfer of data to ethernet … … 51 71 vector<ClientSocket> vskt; 52 72 vector<uint_8> verrcnt; 53 for(size_t j=0; j<destname_.size(); j++) { 54 ClientSocket sok(destname_[j], tcpportid_); 73 vector<string>& sdestnm=destname_[i]; 74 for(size_t j=0; j<sdestnm.size(); j++) { 75 ClientSocket sok(sdestnm[j], tcpportid_); 55 76 for(int ii=0; ii<BRTCPMSGLEN; ii++) msg[ii]='\0'; 56 77 uint_4 dmasz = (fgdirectsend_) ? vec_pciw_[0]->TransferSize() : 0; … … 66 87 throw SocketException("PCIEToEthernet:ERROR/ Connection to EthernetReader not established "); 67 88 } 68 cout << " PCIEToEthernet: Ethernet connection established for DMA/fiber" << i << " with " << destname_[j] << endl;89 cout << " PCIEToEthernet: Ethernet connection established for DMA/fiber" << i << " with " << sdestnm[j] << endl; 69 90 vskt.push_back(sok); 70 91 verrcnt.push_back(0); … … 78 99 totrdsnd_ = 0; 79 100 stopreason_="??Unknown??"; 80 SetPrintLevel(par .prtlevel_,par.prtmodulo_);101 SetPrintLevel(par_.prtlevel_,par_.prtmodulo_); 81 102 } 82 103 … … 87 108 vector<ClientSocket>& vskt = vvec_skt_[i]; 88 109 vector<uint_8>& verrcnt = vvec_errorcnt_[i]; 89 for(size_t j=0; j< destname_.size(); j++) {110 for(size_t j=0; j<vskt.size(); j++) { 90 111 cout << " ~PCIEToEthernet() closing socket, fiber/pcieNum=" << i << " ethernet_destNum=" << j 91 112 << " ErrorCount=" << verrcnt[j] << endl; … … 162 183 throw SocketException("PCIEToEthernet:ERROR/ BAD Go message from EthernetReader "); 163 184 } 164 cout << " PCIEToEthernet::run() Received GO message for Fiber/DMA " << i << " from " << destname_[ j] << endl;185 cout << " PCIEToEthernet::run() Received GO message for Fiber/DMA " << i << " from " << destname_[i][j] << endl; 165 186 } 166 187 } … … 175 196 vec_pciw_[i]->SetMaxWaitEndDMA(par_.first_maxkwedma_,par_.first_nretrydma_); 176 197 198 bool fg_change_timeout=true; 177 199 while (npaqfaitg < nmaxpaq_) { // Boucle global G 178 200 if (fgarret) break; … … 184 206 // Lancement des DMA 185 207 for (int dma=0; dma < (int)nbDma_ ;dma++) vec_pciw_[dma]->StartTransfers(); 186 if ( npaqfaitg==1) {208 if ((npaqfaitg>1)&&fg_change_timeout) { 187 209 for (int i=0;i< (int)nbDma_ ;i++) 188 210 vec_pciw_[i]->SetMaxWaitEndDMA(par_.maxkwedma_,par_.nretrydma_); 211 fg_change_timeout=false; 189 212 } 190 213 -
trunk/AddOn/TAcq/racqueth.h
r3911 r3913 51 51 class PCIEToEthernet : public ZThread { 52 52 public: 53 PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw , vector<string>& destname, BRParList const& par, int portid=BRSPORTID); 53 // Specification de destinations : nom_de_machine ou numero IP (192.168.55.2 ...) 54 // Meme series de destination pour toutes les fibres (DMA) 55 PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw, vector<string>& destname, BRParList const& par, int portid=BRSPORTID); 56 // Une serie de destinations pour chaque fibres 57 PCIEToEthernet(vector<PCIEWrapperInterface*> vec_pciw, vector< vector<string> >& destname, BRParList const& par, int portid=BRSPORTID); 54 58 virtual ~PCIEToEthernet(); 55 59 virtual void run(); … … 61 65 62 66 protected: 67 virtual void InitConnections(); 63 68 virtual size_t SendToTargets(int fib, Byte* data, size_t len, bool fgfin=false); 64 69 virtual void CleanUpEndSendAllLinks(); … … 71 76 unsigned int sizeFr_ ; 72 77 vector<PCIEWrapperInterface *> vec_pciw_; 73 vector< string> destname_;78 vector< vector<string> > destname_; 74 79 int tcpportid_; 75 80 vector< vector<ClientSocket> > vvec_skt_; -
trunk/AddOn/TAcq/racqumem.cc
r3909 r3913 263 263 } 264 264 265 /* --Methode-- */ 265 266 ostream& RAcqMemZoneMgr::Print(ostream& os) 266 267 { … … 280 281 } 281 282 283 /* --Methode-- */ 282 284 void RAcqMemZoneMgr::Stop() 283 285 { … … 287 289 mex.broadcast(); 288 290 } 291 292 /* --Methode-- */ 293 MemZaction RAcqMemZoneMgr::Convert_Status2Action(MemZStatus st) 294 // methode statique 295 { 296 MemZaction ra=MemZA_None; 297 switch (st) { 298 case MemZS_Filled: 299 ra=MemZA_Fill; 300 break; 301 case MemZS_Saved: 302 ra=MemZA_Save; 303 break; 304 case MemZS_Proc: 305 ra=MemZA_Proc; 306 break; 307 case MemZS_ProcA: 308 ra=MemZA_ProcA; 309 break; 310 case MemZS_ProcB: 311 ra=MemZA_ProcB; 312 break; 313 case MemZS_ProcC: 314 ra=MemZA_ProcC; 315 break; 316 case MemZS_ProcD: 317 ra=MemZA_ProcD; 318 break; 319 case MemZS_ProcE: 320 ra=MemZA_ProcE; 321 break; 322 case MemZS_ProcF: 323 ra=MemZA_ProcF; 324 break; 325 default: 326 ra=MemZA_None; 327 break; 328 } 329 return ra; 330 } -
trunk/AddOn/TAcq/racqumem.h
r3909 r3913 169 169 { runstate_ = st; return runstate_; } 170 170 171 // Conversion Status -> action 172 static MemZaction Convert_Status2Action(MemZStatus st); 173 171 174 protected: 172 175 void Init(); // Fait l'allocation des differents buffers - est appele par les constructeurs -
trunk/AddOn/TAcq/racqurw.cc
r3911 r3913 546 546 for (int i=0;i< (int)nbDma_ ;i++) npaqfait[i]=0; 547 547 // Byte* nextdma = locdata+((kmz%memgr.NbZones())*(paqsz*memgr.NbPaquets())); 548 uint_4 npaqfaitg = 0; 548 uint_4 npaqfaitg = 0; 549 bool fg_change_timeout=true; 549 550 // for (uint_4 i=0; i<memgr.NbPaquets(); i += pktInDMATr) { // attention pktInDMATr paquets dans 1 seul DMA 550 551 while (npaqfaitg < nmax_*memgr.NbPaquets()) { // Boucle global G … … 554 555 // Lancement des DMA 555 556 for (int dma=0; dma < (int)nbDma_ ;dma++) vec_pciw_[dma]->StartTransfers(); 556 if ( npaqfaitg==1) {557 if ((npaqfaitg>1)&&fg_change_timeout) { 557 558 for (int i=0;i< (int)nbDma_ ;i++) 558 559 vec_pciw_[i]->SetMaxWaitEndDMA(par_.maxkwedma_,par_.nretrydma_); 560 fg_change_timeout=false; 559 561 } 560 562 // On pointe vers le debut de la zone a remplir aver le prochain DMA … … 938 940 mff[fib].AddKeyS("BRPAQCFMT", BRPaquet::FmtConvToString(acpar.GetParams().GetDataConvFg()), 939 941 " BAORadio BRPaquet DataFormatConversion" ); 940 mff[fib].AddKeyI("FIBERNUM", acpar. GetParams().FiberNum[fib], " Fiber number") ;942 mff[fib].AddKeyI("FIBERNUM", acpar.FiberNum(fib), " Fiber number") ; 941 943 mff[fib].AddKeyI("FIBERID",memgr.FiberId(fib), " Fiber identifier (absolute id)"); 942 944 if (hassrc)
Note:
See TracChangeset
for help on using the changeset viewer.