source: Sophya/trunk/AddOn/TAcq/mfacq.cc@ 4016

Last change on this file since 4016 was 4016, checked in by ansari, 14 years ago

Ajout de commentaires d'autodocumentation Doxygen, Reza 12/08/2011

File size: 18.3 KB
RevLine 
[3671]1#include "mfacq.h"
2
3//---------------------------------------------------------------
4// Programme d'acquisition BAORadio multi-fibres/multi-threads
[4016]5// LAL - 2009 - 2011
[3671]6// R. Ansari, M.Taurigna
7//---------------------------------------------------------------
[4016]8/*!
9 \ingroup TAcq
10 \file mfacq.cc
[3671]11
[4016]12 \brief BAORadio/21cm acquisition main program (see acqparam_exemple.d datacard file)
13
14 This program has four main execution modes:
15 <UL>
16 <LI> -pci2disk : PCI express DMA read of BRPaquet , data saved to disk in FITS files
17 <LI> -pci2eth : PCI express DMA read of BRPaquet, data send over ethernet to other mfacq tasks, running
18 on the same or different machines.
19 <LI> -eth2disk : read data ( BRPaquet ) on network interfaces (ethernet) and save data to disk in FITS files
20 <LI> -eth2visib : read data ( BRPaquet ) on network interfaces (ethernet), compute visibilities and save visibility
21 matrices to disk
22 </UL>
23
24 \verbatim
25 csh> mfacq -h
26 Usage: mfacq Action DataCardFileName [-dc DataCard -dc DataCard] [TargetMachines]
27 o Action = -pci2disk , -pci2eth , -eth2disk , -eth2visib
28 DataCardFile : File name for parameters list (DataCards) :
29 fibres outpathname skysource paqsize dmasizekb nbfiles
30 nblocperfile acqmode memmgr monitor reducpaqsz ...
31 o -dc DataCard : datacard appended for DataCardFileName
32 o TargetMachines : List of target machines for PCIe2Ethernet (-pci2eth)
33
34 \endverbatim
35*/
36
[3671]37static RAcqMemZoneMgr* pMmgr=NULL;
38static PCIEMultiReader* pPcierThr=NULL;
[3757]39static PCIEToEthernet* pPcie2Eth=NULL;
40static EthernetReader* pEthRdr=NULL;
[3671]41
42void Stop(int s)
43{
44 if (s == 9765) cout << " Stop after exception ..." << endl;
45 else printf("............. MAIN ... receive signal %d \n",s);
46 if (pMmgr != NULL) pMmgr->Stop();
[3757]47 if (pPcie2Eth !=NULL) pPcie2Eth->Stop();
[3671]48 if (pPcierThr !=NULL) pPcierThr->Stop();
[3757]49 if (pEthRdr !=NULL) pEthRdr->Stop();
[3671]50}
51
52
53//-----------------------------------------------------------------------
54//-------------------- le programme principal ---------------------------
55//-----------------------------------------------------------------------
56int main(int narg, char* arg[])
57{
58
59 int rc = 0;
60 cout << " ============= BAORadio / Acquisition : mfacq =================" << endl;
61 cout << " ===============================================================" << endl;
[4010]62 cout << " ========= " <<BAOR_ACQ_VER_STR << "( V= " << BAOR_ACQ_VER << " ) ===========" << endl;
[3671]63 cout << " ===============================================================" << endl;
64
65
66 InitTim();
67
68 // Initialisation
69 TArrayInitiator _arri;
70 FitsIOServerInitiator _fiosi;
71
72
[3757]73 if ((narg > 1)&&(strcmp(arg[1],"-h"))==0) {
[3671]74 Usage(false);
75 return 1;
76 }
[3757]77 if (narg < 3) {
78 Usage(true);
79 return 3;
80 }
[3671]81
[3876]82 const char* desact[4] = {"PCIE_To_Ethernet", "Ethernet_To_Disk", "Ethernet_To_Visibilities","PCIE_DMA_To_Disk"};
[3671]83 try {
84 // Creation/initialisation parametres Acq
[3913]85 int act = DecodeArgs(narg,arg);
86 if ((act < 0)||(act>3)) {
87 cout << "mfacq/ERROR decoding arguments act=" << act << " -> exit -5" << endl;
88 return -5;
[3671]89 }
[3913]90 cout << " mfacq/INFO action: " << desact[act] << endl;
[3757]91 switch (act) {
92 case 0:
93 rc = PCIEToEthernetTransfer();
94 break;
[3876]95 case 1: // ethernet --> disk
96 rc = EthernetToMemoryAcq(false);
[3757]97 break;
[3876]98 case 2: // ethernet --> visibility calculation
99 rc = EthernetToMemoryAcq(true);
100 break;
101 case 3:
[3757]102 rc = MultiFibreAcq();
103 break;
104 }
[3671]105 }
106 catch (MiniFITSException& exc) {
107 cerr << " mfacq.cc catched MiniFITSException " << exc.Msg() << endl;
108 rc = 77;
109 }
110 catch (PCIEWException& exc) {
[3683]111 cerr << " mfacq.cc catched PCIEWException " << exc.Msg() << endl;
[3671]112 rc = 75;
113 }
114 catch (PThrowable& exc) {
115 cerr << " mfacq.cc catched Exception " << exc.Msg() << endl;
116 rc = 76;
117 }
118 catch (std::exception& sex) {
119 cerr << "\n mfacq.cc std::exception :"
120 << (string)typeid(sex).name() << "\n msg= "
121 << sex.what() << endl;
122 rc = 78;
123 }
124 catch (...) {
125 cerr << " mfacq.cc : Catched ... exception " << endl;
126 rc = 79;
127 }
128 cout << "mfacq[9] ----- END --- stopping acq program " << endl;
129 return rc;
130}
131
132
133/* --Nouvelle-Fonction-- */
134void Usage(bool fgshort)
135{
[3913]136 cout << " Usage: mfacq Action DataCardFileName [-dc DataCard -dc DataCard] [TargetMachines]" << endl;
[3757]137 if (fgshort) return;
[3876]138 cout << " o Action = -pci2disk , -pci2eth , -eth2disk , -eth2visib \n "
[3766]139 << " DataCardFile : File name for parameters list (DataCards) : \n"
140 << " fibres outpathname skysource paqsize dmasizekb nbfiles \n"
141 << " nblocperfile acqmode memmgr monitor reducpaqsz ... "<< endl;
[3913]142 cout << " o -dc DataCard : datacard appended for DataCardFileName" << endl;
[3767]143 cout << " o TargetMachines : List of target machines for PCIe2Ethernet (-pci2eth) \n " << endl;
[3671]144 return;
145}
[3913]146
147/* --Nouvelle-Fonction-- */
148int DecodeArgs(int narg, char* arg[])
149{
150 string action=arg[1];
151 int act = 0;
152 if ((action != "-pci2eth")&&(action != "-pci2disk")&&(action != "-eth2disk")&&(action != "-eth2visib")) {
153 cout << " mfacq/Error , Bad action argument : " << action << endl;
154 return -2;
155 }
156 if (action == "-pci2eth") act=0;
157 else if (action == "-eth2disk") act=1;
158 else if (action == "-eth2visib") act=2;
159 else if (action == "-pci2disk") act=3;
160
161 BRAcqConfig acpar;
162 char tmpdcname[128];
163 sprintf(tmpdcname,"%s/dc_XXXXXX",acpar.TmpDirectory().c_str());
164 mktemp(tmpdcname);
165 string dcardfile=tmpdcname;
166 dcardfile+=".d";
167 string pardcfile=arg[2];
168 char cmd[512];
169 sprintf(cmd,"cp %s %s",pardcfile.c_str(),dcardfile.c_str());
170 cout << " mfacq/DecodeArgs() executing command: " << cmd << endl;
171 int rc;
172 rc=system(cmd);
173 if (rc!=0) {
174 cout << " mfacq/ERROR system(cmd) , Rc=" << rc << endl;
175 return -3;
176 }
177
178 vector<string> oargs;
179 int aoff=3;
180 {
181 ofstream dcf( dcardfile.c_str(), ios_base::out|ios_base::app);
182 dcf << "#### Appended datacards from command line " << endl;
183 while (aoff<(narg-1)) {
184 if (strcmp(arg[aoff],"-dc") != 0) break;
185 dcf << arg[aoff+1] << endl;
[3914]186 aoff+=2;
[3913]187 }
188 if ((act==0)&&(aoff<narg)) { // default ethernet target destinations
189 dcf << "@ethrtargets ";
190 for(int jj=aoff; jj<narg; jj++) dcf << arg[jj] << " ";
191 dcf << endl;
192 }
193 }
194
195 acpar.GetParams().fgdoVisiC=false;
196 if (act == 2) acpar.GetParams().fgdoVisiC=true;
197
198 acpar.ReadParamFile(dcardfile);
199 acpar.CreateOutputDirectories();
200
201 sprintf(cmd,"cp %s %s/acqparm.d",dcardfile.c_str(),acpar.OutputDirectory().c_str());
202 cout << " mfacq/DecodeArgs() executing command: " << cmd << endl;
203 rc=system(cmd);
204 if (rc!=0) {
205 cout << " mfacq/ERROR system(cmd) , Rc=" << rc << endl;
206 return -3;
207 }
208
209 acpar.Print(cout);
210 string pflnm=acpar.OutputDirectory();
211 pflnm+="/params.log";
212 ofstream pfile(pflnm.c_str());
213 acpar.Print(pfile);
214
215 struct sigaction siact;
216 if (!acpar.GetParams().fg_hard_ctrlc) {
217 siact.sa_handler=Stop;
218 sigaction(SIGINT,&siact,NULL);
219 }
220
221 return act;
222}
[3671]223
224/* --Nouvelle-Fonction-- */
225int MultiFibreAcq()
226{
227 Timer tm("mfacq/MultiFibre");
228 cout << " ---------- mfacq/ MultiFibreAcq() ------------- " << endl;
[3757]229 PCIEWrapperInterface* pciwp[16]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
230 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
[3671]231
232 BRAcqConfig bpar;
233 BRParList& acpar=bpar.GetParams();
234
[3909]235 cout << " mfacq[1]/Info: Creating RAcqMemZoneMgr for" << acpar.NbFibers() << " fibers , nZones="
[3671]236 << acpar.nZones << " NbPaquet/Zone=" << acpar.nPaqZone
[3674]237 << " MmgrPaqSize=" << acpar.MMgrPaquetSize() << endl;
[3671]238 RAcqMemZoneMgr mmgr(acpar.nZones, bpar.NFibers(), acpar.nPaqZone, acpar.MMgrPaquetSize());
239 pMmgr=&mmgr;
[3681]240 if (acpar.fgdoProc && (acpar.stepProc>0)) {
241 // Dans ce cas, toutes les zones doivent passer ds le thread de monitoring
242 // pour etre au moins marque comme traite - seul 1/acpar.stepProc sont effectivement traite
243 mmgr.SetFinalizedMask(((uint_4)MemZS_Saved) | ((uint_4)MemZS_Proc));
244 cout << " mfacq[1.b]/Info: Mmgr.SetFinalizedMask( MemZS_Saved | MemZS_Proc )" << endl;
[3758]245 //mmgr.SetFinalizedMask( (uint_4)MemZS_Saved );
246 //cout << " mfacq[1.b]/Info: Mmgr.SetFinalizedMask( MemZS_Saved )" << endl;
[3681]247 }
248
[3671]249#ifndef NOPCIECARD
[3909]250 for (size_t i=0 ;i <acpar.NFibers() ;i++) {
[3914]251 UINT32 card=(acpar.FiberNum(i)-1)/2+1;
252 UINT32 cardfiber=(acpar.FiberNum(i)-1)%2;
[3671]253 cout <<"mfacq[2] CreatePCIEWrapperV6- indice " << i << "INIT card " << card
254 << " fibre " << cardfiber << endl;
[3683]255 pciwp[i] = CreatePCIEWrapperV6(card,acpar.PatternSize(),acpar.DMASizeBytes(),acpar.activate_pattern,cardfiber);
[3671]256 }
257#else
258 TestPCIWrapperNODMA pciw1(bpar.RecvPaquetSize(), acpar.nopciLossRate);
259 TestPCIWrapperNODMA pciw2(bpar.RecvPaquetSize(), acpar.nopciLossRate);
260 TestPCIWrapperNODMA pciw3(bpar.RecvPaquetSize(), acpar.nopciLossRate);
261 TestPCIWrapperNODMA pciw4(bpar.RecvPaquetSize(), acpar.nopciLossRate);
[3757]262 TestPCIWrapperNODMA pciw5(bpar.RecvPaquetSize(), acpar.nopciLossRate);
263 TestPCIWrapperNODMA pciw6(bpar.RecvPaquetSize(), acpar.nopciLossRate);
264 TestPCIWrapperNODMA pciw7(bpar.RecvPaquetSize(), acpar.nopciLossRate);
265 TestPCIWrapperNODMA pciw8(bpar.RecvPaquetSize(), acpar.nopciLossRate);
[3671]266 pciwp[0] = &pciw1;
267 pciwp[1] = &pciw2;
268 pciwp[2] = &pciw3;
[3757]269 pciwp[3] = &pciw4;
270 pciwp[4] = &pciw5;
271 pciwp[5] = &pciw6;
272 pciwp[6] = &pciw7;
273 pciwp[7] = &pciw8;
[3671]274#endif
275
[3681]276 cout <<"mfacq[2] Creating MultiDataSaver and MonitorProc thread objects ... " << endl;
[3672]277 MultiDataSaver DsThr(mmgr); // Utilise les parametres globaux BRAcqConfig
[3671]278 string ppath=bpar.OutputDirectory();
[3681]279 MonitorProc PrThr(mmgr);
[3758]280 cout << "mfacq[3] Creating PCIEMultiReader thread object " << endl;
[3671]281 vector<PCIEWrapperInterface*> vec_pciw;
[3909]282 for (size_t i=0 ;i<bpar.NFibers();i++) {
[3913]283 pciwp[i]->SetFiberNumId(bpar.FiberNum(i), bpar.FiberId(i));
[3758]284 vec_pciw.push_back( pciwp[i]);
285 // cout << " mfacq[3.b]/Debug - pciwp[" << i << "] " << hex << pciwp[i] << dec << endl;
286 }
[3672]287 PCIEMultiReader PcierThr(vec_pciw, mmgr, bpar.GetParams());
[3681]288 // usleep(200); attente au cas ou ...
[3671]289 pPcierThr=&PcierThr;
290 tm.Split("Threads created");
[3681]291 if (acpar.fgdoProc>0)
292 cout << "mfacq[4] - starting three threads: PCIEMultiReader, MultiDataSaver, MonitorProc ... " << endl;
293 else
294 cout << "mfacq[4] - starting two threads: PCIEMultiReader, MultiDataSaver ... " << endl;
295
[3671]296 PcierThr.start();
297 DsThr.start();
[3681]298 if (acpar.fgdoProc>0) { // On ne demarre que si au moins NMaxProc>0
[3671]299 PrThr.start();
300 }
301
302 // On attend avant de declencher la terminaison des threads
[3681]303 usleep(200000);
[3671]304
305 cout << "mfacq[5] - Waiting for threads to finish ... " << endl;
306 PcierThr.join();
307 DsThr.join();
308 mmgr.Stop();
[3681]309 if (acpar.fgdoProc) { // On n'attend la fin que si le thread a ete demarre (NMaxProc>0)
[3671]310 PrThr.join();
311 }
312 pMmgr=NULL;
313 cout << "mfacq[6] ---------- threads finished ---------------- " << endl;
314 tm.Split("Threads Finished");
315
[3681]316 mmgr.Print(cout);
[3671]317#ifndef NOPCIECARD
[3909]318 for (size_t i=0; i<acpar.NbFibers(); i++) {
[3914]319 UINT32 card=(acpar.FiberNum(i)-1)/2+1;
320 UINT32 cardfiber=(acpar.FiberNum(i)-1)%2;
[3671]321 DeletePCIEWrapperV6(card,cardfiber);
322 }
323#endif
324return 0;
325
326}
[3757]327
328/* --Nouvelle-Fonction-- */
329int PCIEToEthernetTransfer()
330{
331 Timer tm("mfacq/PCIEToEthernetTransfer");
332 cout << " ---------- mfacq/ PCIEToEthernetTransfer() ------------- " << endl;
333 PCIEWrapperInterface* pciwp[16]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
334 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
335
336 pMmgr=NULL;
337 BRAcqConfig bpar;
338 BRParList& acpar=bpar.GetParams();
339
[3909]340 cout << " mfacq[1]/Info: PCIEToEthernet for" << acpar.NbFibers() << " fibers , nZones="
[3757]341 << acpar.nZones << " NbPaquet/Zone=" << acpar.nPaqZone
342 << " MmgrPaqSize=" << acpar.MMgrPaquetSize() << endl;
343#ifndef NOPCIECARD
[3909]344 for (size_t i=0 ;i <acpar.NFibers() ;i++) {
[3914]345 UINT32 card=(acpar.FiberNum(i)-1)/2+1;
346 UINT32 cardfiber=(acpar.FiberNum(i)-1)%2;
[3757]347 cout <<"mfacq[2] CreatePCIEWrapperV6- indice " << i << "INIT card " << card
348 << " fibre " << cardfiber << endl;
349 pciwp[i] = CreatePCIEWrapperV6(card,acpar.PatternSize(),acpar.DMASizeBytes(),acpar.activate_pattern,cardfiber);
350 }
351#else
352 TestPCIWrapperNODMA pciw1(bpar.RecvPaquetSize(), acpar.nopciLossRate);
353 TestPCIWrapperNODMA pciw2(bpar.RecvPaquetSize(), acpar.nopciLossRate);
354 TestPCIWrapperNODMA pciw3(bpar.RecvPaquetSize(), acpar.nopciLossRate);
355 TestPCIWrapperNODMA pciw4(bpar.RecvPaquetSize(), acpar.nopciLossRate);
356 TestPCIWrapperNODMA pciw5(bpar.RecvPaquetSize(), acpar.nopciLossRate);
357 TestPCIWrapperNODMA pciw6(bpar.RecvPaquetSize(), acpar.nopciLossRate);
358 TestPCIWrapperNODMA pciw7(bpar.RecvPaquetSize(), acpar.nopciLossRate);
359 TestPCIWrapperNODMA pciw8(bpar.RecvPaquetSize(), acpar.nopciLossRate);
360 pciwp[0] = &pciw1;
361 pciwp[1] = &pciw2;
362 pciwp[2] = &pciw3;
363 pciwp[3] = &pciw4;
364 pciwp[4] = &pciw5;
365 pciwp[5] = &pciw6;
366 pciwp[6] = &pciw7;
367 pciwp[7] = &pciw8;
368#endif
369
370 vector<PCIEWrapperInterface*> vec_pciw;
[3909]371 for (size_t i=0 ;i<bpar.NFibers();i++) {
[3913]372 pciwp[i]->SetFiberNumId(bpar.FiberNum(i), bpar.FiberId(i));
[3909]373 vec_pciw.push_back( pciwp[i]);
374 }
[3757]375 cout <<"mfacq[2] Creating PCIEToEthernet thread object " << endl;
[3761]376 PCIEToEthernet pci2eth(vec_pciw, bpar.GetParams().GetEthTargets(), bpar.GetParams(), bpar.GetParams().tcpportid);
[3897]377 pci2eth.SetPrintLevel(acpar.prtlevel_, acpar.prtmodulo_);
[3757]378 // usleep(200); attente au cas ou ...
379 pPcie2Eth=&pci2eth;
380 tm.Split("Threads created");
381 cout << "mfacq[3] - starting one threads: PCIEToEthernet... " << endl;
382 pci2eth.start();
383
384 // On attend avant de declencher la terminaison des threads
385 usleep(200000);
386
387 cout << "mfacq[5] - Waiting for threads to finish ... " << endl;
388 pci2eth.join();
389 cout << "mfacq[6] ---------- threads finished ---------------- " << endl;
390 tm.Split("Threads Finished");
391
392#ifndef NOPCIECARD
[3909]393 for (size_t i=0; i<acpar.NbFibers(); i++) {
[3914]394 UINT32 card=(acpar.FiberNum(i)-1)/2+1;
395 UINT32 cardfiber=(acpar.FiberNum(i)-1)%2;
[3757]396 DeletePCIEWrapperV6(card,cardfiber);
397 }
398#endif
399return 0;
400}
401
[3876]402
[3757]403/* --Nouvelle-Fonction-- */
[3876]404int EthernetToMemoryAcq(bool fgviscal)
[3757]405{
406 Timer tm("mfacq/EthernetToMemoryAcq");
407 cout << " ---------- mfacq/ EthernetToMemoryAcq() ------------- " << endl;
408
409 BRAcqConfig bpar;
410 BRParList& acpar=bpar.GetParams();
[3876]411
412 if (fgviscal) cout << "mfacq[0]/EthernetToMemoryAcq() : On the fly Visibility Calculation " << endl;
413 else cout << "mfacq[0]/EthernetToMemoryAcq() : data dumped to disk " << endl;
[3757]414 cout << " mfacq[1]/Info: Creating RAcqMemZoneMgr for" << acpar.NbEthLinks() << " Eth-links , nZones="
415 << acpar.nZones << " NbPaquet/Zone=" << acpar.nPaqZone
416 << " MmgrPaqSize=" << acpar.MMgrPaquetSize() << endl;
417 RAcqMemZoneMgr mmgr(acpar.nZones, acpar.NbEthLinks(), acpar.nPaqZone, acpar.MMgrPaquetSize());
418 pMmgr=&mmgr;
[3876]419
420
421 string strfmask;
422 uint_4 fmask=0;
423 MemZStatus mskmon=MemZS_Proc;
424 if (fgviscal) { // gestion de finalized_mask lors du calcul de visibilites
425 if (acpar.nbcalgrpVisiC<1) acpar.nbcalgrpVisiC=1;
426 if (acpar.nbcalgrpVisiC>4) acpar.nbcalgrpVisiC=4;
427 cout << " mfacq[1.b]/Info: NbCalGrpVisiC = " << acpar.nbcalgrpVisiC << " (1<=NbCalGrpVisiC<=4)" << endl;
428 fmask=(uint_4)MemZS_ProcA; strfmask="MemZS_ProcA"; mskmon=MemZS_ProcB;
429 if (acpar.nbcalgrpVisiC>1)
430 { fmask |= (uint_4)MemZS_ProcB; strfmask+=" | MemZS_ProcB"; mskmon=MemZS_ProcC; }
431 if (acpar.nbcalgrpVisiC>2)
432 { fmask |= (uint_4)MemZS_ProcC; strfmask+=" | MemZS_ProcC"; mskmon=MemZS_ProcD; }
433 if (acpar.nbcalgrpVisiC>3)
434 { fmask |= (uint_4)MemZS_ProcD; strfmask+=" | MemZS_ProcD"; mskmon=MemZS_ProcE; }
435 }
436 else {
437 fmask=(uint_4)MemZS_Saved; strfmask="MemZS_Saved"; mskmon=MemZS_Proc;
438 }
439 if (acpar.fgdoProc)
440 { fmask |= (uint_4)mskmon; strfmask+=" | MemZS_Proc[Monotoring]"; }
[3757]441 // Dans ce cas, toutes les zones doivent passer ds le thread de monitoring
442 // pour etre au moins marque comme traite - seul 1/acpar.stepProc sont effectivement traite
[3876]443
444 mmgr.SetFinalizedMask(fmask);
445 cout << " mfacq[1.b]/Info: Mmgr.SetFinalizedMask( " << strfmask << " )" << endl;
[3757]446
[3876]447 if (fgviscal)
448 cout <<"mfacq[2] Creating BRVisCalcGroup, NbVisibCalculator=" << acpar.nbcalgrpVisiC
449 << " and MonitorProc " << endl;
450 else
451 cout <<"mfacq[2] Creating MultiDataSaver and MonitorProc thread objects ... " << endl;
[3757]452 MultiDataSaver DsThr(mmgr); // Utilise les parametres globaux BRAcqConfig
453 string ppath=bpar.OutputDirectory();
454 MonitorProc PrThr(mmgr);
[3913]455 PrThr.SetMemZAction( RAcqMemZoneMgr::Convert_Status2Action( mskmon ) );
[3915]456 BRVisCalcGroup VCGThr(acpar.nbcalgrpVisiC, mmgr, bpar.OutputDirectory(), acpar.nmeanVisiC,
457 acpar.firstpairVisiC, acpar.nbpairsVisiC, acpar.fgpimpVisiC, acpar.nthrVisiC);
[3876]458 VCGThr.SelectFreqBinning(acpar.freqminVisiC, acpar.freqmaxVisiC, acpar.nbinfreqVisiC);
[3920]459 VCGThr.ActivateVisDTable(acpar.fgfdtVisiC);
[3923]460 VCGThr.SetPrintLevel(acpar.prtlevel_, acpar.prtmodulo2_);
[4010]461 if (acpar.fgfitsVisiC) VCGThr.SetFitsOutput();
[4012]462 if (acpar.fgtimeintervalVisiC) VCGThr.SetTimeIntervalMode(acpar.timeintervalVisiC);
[3876]463
[3757]464 cout << "mfacq[3] Creating EthernetReader thread object " << endl;
[3897]465 EthernetReader ethrdr(mmgr, bpar.GetParams(), bpar.GetParams().tcpportid);
466 ethrdr.SetReadMode(acpar.ethr_forcesamefc_, acpar.ethr_sfc_maxdpc_,acpar.ethr_sfc_maxresync_);
[3899]467 ethrdr.WaitENDMsg4Terminate(acpar.ethr_waitendmsg_);
[3884]468 ethrdr.SetPrintLevel(acpar.prtlevel_, acpar.prtmodulo_);
[3760]469
[3757]470 // usleep(200); attente au cas ou ...
471 pEthRdr=&ethrdr;
[3876]472 tm.Split("Threads created");
473 cout << "mfacq[4] - starting EthernetReader thread object ..." << endl;
[3757]474 ethrdr.start();
[3876]475 if (fgviscal) {
476 cout << "mfacq[4.b] - starting Visibility calculator threads " << endl;
477 VCGThr.start();
478 }
479 else {
480 cout << "mfacq[4.b] - starting MultiDataSaver " << endl;
481 DsThr.start();
482 }
483 if (acpar.fgdoProc) { // demarrage (optionnel) du thread de monitoring
484 cout << " mfacq[4.c] - starting MonitorProc thread object " << endl;
[3757]485 PrThr.start();
486 }
487
488 // On attend avant de declencher la terminaison des threads
489 usleep(200000);
490
491 cout << "mfacq[5] - Waiting for threads to finish ... " << endl;
492 ethrdr.join();
[3876]493 if (fgviscal) VCGThr.join();
494 else DsThr.join();
[3757]495 mmgr.Stop();
496 if (acpar.fgdoProc) { // On n'attend la fin que si le thread a ete demarre (NMaxProc>0)
497 PrThr.join();
498 }
499 pMmgr=NULL;
500 cout << "mfacq[6] ---------- threads finished ---------------- " << endl;
501 tm.Split("Threads Finished");
502
503 mmgr.Print(cout);
504
505return 0;
506
507}
[3876]508
509
Note: See TracBrowser for help on using the repository browser.