Changeset 3883 in Sophya for trunk/AddOn


Ignore:
Timestamp:
Sep 23, 2010, 7:59:29 PM (15 years ago)
Author:
ansari
Message:

1/ Correction bug de lecture ds BRMultiFitsReader et EthernetReader lorsque lecture avec SameFrameCounter etait demande
2/ Amelioration des impressions ds ces deux classes et ajout possibilite de controle du flag "SameFC" avec les classes de parametres BRParList et BRAnaParam
3/ Nouveaux datacard @ethrforcesamefc et @prtlev pour acquisition

Reza, 23/09/2010

Location:
trunk/AddOn/TAcq
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/acqparam_exemple.d

    r3877 r3883  
    3737#  Par defaut NoMonitoring   @monitor 512 10 0
    3838@monitor 0  384 4
     39########################
    3940#  Reduction des tailles de paquets si cle present
    4041#  @reducpaqsz ReducedSize Offset
    4142reducpaqsz 1024 0
     43########################
    4244#### cartes de controle pour le mode transfert sur Ethernet
    4345#  Liste des machines cibles pour les envois de paquets
     
    4951#  @ethrnlink 4
    5052ethrnlink 4
     53#  En mode reception de paquets sur ethernet,  On peut forcer la lecture
     54#   de paquets avec meme compteur de paquet (Force SameFrameCounter )
     55#  @ethrforcesamefc
     56ethrforcesamefc
    5157## No de port TCP/IP   
    5258#  @tcpportid 6912
     
    6874#  Defaut: visicfreq 0 0 0   (aucun binning, toutes les frequences)
    6975visicfreq 0 0 0
     76########################
    7077#  Taux de perte de paquets en simulation (Sans carte PCIExpress)
    7178#  @nopcilossrate Perte     (0<=Perte<1)
    7279#  Defaut @nopcilossrate 0.
     80########################
     81#   Niveau d'impression
     82#  @prtlev Level CounterModulo
     83prtlev 0 50000
     84prtlev 1 50000
  • trunk/AddOn/TAcq/branap.cc

    r3872 r3883  
    2020  imin_=imax_=0;
    2121  istep_=1;
     22  rdsamefc_=true;   // read paquets with same frame counter
    2223  freqmin_=freqmax_=0;
    2324  nbinfreq_=1; 
     
    2728  fgdatafft_=false;  fgsinglechannel_=false;
    2829  prtlevel_=0;
     30  prtmodulo_=50000;
    2931  nbcalgrp_=1;
    3032  nthreads_=1;
     
    6971      ka+=2;
    7072    }
    71     else if (strcmp(arg[ka],"-prtlev")==0) {
    72       prtlevel_=atoi(arg[ka+1]);
     73    else if (strcmp(arg[ka],"-prt")==0) {
     74      sscanf(arg[ka+1],"%d,%ld",&prtlevel_,&prtmodulo_);
    7375      ka+=2;
    7476    }
     
    8082      nbcalgrp_=atoi(arg[ka+1]);
    8183      ka+=2;
     84    }
     85    else if (strcmp(arg[ka],"-nosfc")==0) {
     86      rdsamefc_=false;
     87      ka++;
    8288    }
    8389    else if (strcmp(arg[ka],"-in")==0) {
     
    120126  cout << " Usage:  prgname [-act ACT] [-out OutPath] [-nmean NMean] [-zones NZones,nPaqinZone] \n"
    121127       << "                 [-nbloc NBloc] [-freq NumFreqMin,NumFreqMax,NBinFreq] \n"
    122        << "                 [-prtlev lev] [-nvcal n] [-nthr n] \n"
     128       << "                 [-prt lev,modulo] [-nvcal n] [-nthr n] [-nosfc] \n"
    123129       << "         -in Imin,Imax,Istep InPath FiberList [InPath2 FiberList2 InPath3 FiberList3 ...] \n" << endl;
    124130  if (fgshort) {
     
    135141       << " -zones NZones,NbPaqinZone : Number of Zones and number of paquets in one zone \n"
    136142       << " -freq NumFreqMin,NumFreqMax,NBinFreq : Frequency zone and number of bins \n"
    137        << " -prtlev lev : Print level (0,1,2...) \n"
     143       << " -prt lev,modulo : Print level (0,1,2...) and print counter modulo (10000, 50000 ...) \n"
    138144       << " -nvcal n : number of BRVisibilityCalculator objects running in parallel in BRVisCalcGroup  (default=1) \n"
    139145       << " -nthr n : number of threads for parallel execution in BRVisibilityCalculator (default=1) \n"
     146       << " -nosfc : Don't force reading with SAME FrameCounter \n"
    140147       << " -in : input files/directory definition : \n"
    141148       << "       Imin,Imax,Istep: fits files signalII.fits Imin<=II<=Imax Istep=increment \n"
     
    160167  for(size_t k=0; k< dirlist_.size(); k++)
    161168    cout << k+1 << " :  " << dirlist_[k] << endl;
    162   cout << " IMin= " << imin_ << " IMax= " << imax_ << " IStep= " << istep_ << endl;
     169  cout << " IMin= " << imin_ << " IMax= " << imax_ << " IStep= " << istep_
     170       << ((rdsamefc_)?" SameFrameCounter read mode":" AllOKPaquets read mode ") << endl;
    163171  cout << " OutPath= " << outpath_ << endl;
    164172  cout << " Action=" << action_ << "  NMean=" << nmean_ << " NBloc=" << nbloc_ << endl;
    165173  cout << " FreqMin= " << freqmin_ << " FreqMax= " << freqmax_ << " NBinFreq= " << nbinfreq_ << endl;
    166174  cout << " PaqSize=" << paqsize_ << "  -  NZones=" << nzones_ << " NPaqZone=" << npaqinzone_
    167        << " PrtLevel=" << prtlevel_ << endl;
     175       << " PrtLevel=" << prtlevel_ << " PrtCntModulo=" <<  prtmodulo_ << endl;
    168176  cout << " AcqMode: " << ((fgdatafft_)?" Data_FFT " : " Data_Raw " )
    169177       << ((fgsinglechannel_)?" SingleChannel " : " TwoChannels " ) << endl;
  • trunk/AddOn/TAcq/branap.h

    r3872 r3883  
    3434  uint_4 nbloc_;
    3535  uint_4 imin_, imax_, istep_;
     36  bool rdsamefc_;    // read paquets with same frame counter
    3637  uint_4 freqmin_, freqmax_, nbinfreq_;
    3738  uint_4 paqsize_;
     
    4142  bool fgsinglechannel_; // true -> un seul canal par fibre (par defaut=2 canaux/fibres)
    4243  int prtlevel_;
     44  long int prtmodulo_;
    4345  uint_4 nbcalgrp_;    // Nb d'objets/threads dans BRVisCalcGroup
    4446  uint_4 nthreads_;  // Nb de threads pour l'execution parallele ds BRVisibilityCalculator
  • trunk/AddOn/TAcq/brfitsrd.cc

    r3700 r3883  
    7878         << " signalII.fits IMin=" << imin_ << " IMax=" << imax_ << " IStep=" << istep_ << endl;
    7979
     80    uint_8  prtcnt=0;
    8081    Byte* nextpaq=NULL;
    8182    bool fgok=true;
     
    9596      }
    9697      if (ReadNextAllFibers()) { fgok=false;  break; }
     98      prtcnt++;
     99      if ((prtlev_>0)&&(prtcnt%prtmodulo_==0))  {
     100          cout << "BRMultiFitsReader: NbPaqMFRead=" << prtcnt << " NSameFC="
     101               << totsamefc_ << " / NPaqFib0Read=" << totnpqrd_[0]
     102               << " FracSameFC=" << 100*totsamefc_/totnpqrd_[0] << " %" <<  endl;
     103      }
    97104    }
    98105
    99106    MoveToNextTarget();  // Pour faire traiter le dernier paquet si plein
    100107    MZoneManage(true);   // Nettoyage final
    101     usleep(50000);       // Attente de traitement du dernier paquet
    102     memgr_.Stop();        // Arret
    103108
    104109    cout << " ------------------  BRMultiFitsReader::run() END ----------------- " << endl;
    105110    ts.SetNow();
    106111    tm.SplitQ();
    107     cout << "  END reading : " << ts ;
    108     if (rdsamefc_) cout << " NSameFC=" << totsamefc_ << endl;
    109     else cout << endl;
     112    cout << "BRMultiFitsReader::run():  END reading : " << ts << endl;
     113    cout << "... NbPaqMFRead=" << prtcnt << " NSameFC="
     114         << totsamefc_ << " / NPaqFib0Read=" << totnpqrd_[0]
     115         << " FracSameFC=" << 100*totsamefc_/totnpqrd_[0] << " %" << endl;
     116
    110117    for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++)  {
    111118      int perc=0;
     
    121128    cout << " ---------------------------------------------------------- " << endl;
    122129
     130    usleep(50000);       // Attente de traitement du dernier paquet
     131    memgr_.Stop();        // Arret
     132
    123133  }  // Fin du bloc try
    124134  catch (std::exception& exc) {
     
    142152    if (ReadNext(fib)) return true;  // probleme
    143153  }
    144   if (!rdsamefc_ || (memgr_.NbFibres()<2))  {
    145     totsamefc_++;  return false;  // c'est OK
    146   }
    147   uint_8 cfc=curfc_[0];
    148   bool fgsamefc=true;
    149   for(size_t fib=1; fib<memgr_.NbFibres(); fib++) {
    150     if (curfc_[fib]!=cfc) {
    151       fgsamefc=false;
    152       if (curfc_[fib] > cfc)  cfc=curfc_[fib];
    153     }
    154   }
    155   if (fgsamefc) {
    156     totsamefc_++;  return false;  // c'est OK  , same framecounter
    157   }
    158   else {  // else !fgsame
    159     for(uint_4 fib=0; fib<memgr_.NbFibres(); fib++) {
    160       while (curfc_[fib]<cfc) {
    161         if (ReadNext(fib)) return true;  // probleme
    162       }
    163     }
    164   }   // fin de  else !fgsame
    165   totsamefc_++;
    166   return false; // c'est OK
     154  if (!rdsamefc_ || (memgr_.NbFibres()<2))  {
     155    uint_8 cfc=curfc_[0];
     156    bool fgsamefc=true;
     157    for(size_t fib=1; fib<memgr_.NbFibres(); fib++) {
     158      if (curfc_[fib]!=cfc)   fgsamefc=false;
     159    }
     160    if (fgsamefc)  totsamefc_++; 
     161    return false;  // c'est OK
     162  }
     163  //  On va essayer de lire jusqu'a avoir same_frame_counter
     164  bool echec=true;
     165  while (echec) {
     166    uint_8 cfc=curfc_[0];
     167    bool fgsamefc=true;
     168    for(size_t fib=1; fib<memgr_.NbFibres(); fib++) {
     169      if (curfc_[fib]!=cfc) {
     170        fgsamefc=false;
     171        if (curfc_[fib] > cfc)  cfc=curfc_[fib];
     172      }
     173    }
     174    if (fgsamefc) {
     175      totsamefc_++;  echec=false; return false;  // c'est OK  , same framecounter
     176    }
     177    else {  // else !fgsame
     178      for(uint_4 fib=0; fib<memgr_.NbFibres(); fib++) {
     179        while (curfc_[fib]<cfc) {
     180          if (ReadNext(fib)) return true;  // probleme
     181        }
     182      }
     183    }   // fin de  else !fgsame
     184  }  // fin de while(echec): lecture jusqu'a same_frame_counter
     185
     186  return true; // probleme
    167187}
    168188
  • trunk/AddOn/TAcq/brfitsrd.h

    r3731 r3883  
    3636  inline void STOP() { stop_ = true; } 
    3737
    38   inline int SetPrintLevel(int lev=0) { prtlev_=lev; return 0;}
     38  inline int SetPrintLevel(int lev=0, uint_8 prtmodulo=50000)
     39    { prtlev_=lev;   prtmodulo_=prtmodulo;  return 0; }
     40
    3941protected:
    4042  bool ReadNextAllFibers();      // Renvoie true si probleme
     
    7779  Byte* mmbufib_[MAXANAFIB];  // Pointeurs zone memoire de chaque fibre rendu par RAcqMemZoneMgr
    7880
    79   int prtlev_;
     81  int prtlev_;         // print level
     82  uint_8 prtmodulo_;   // print periodicity (modulo)
    8083};
    8184
  • trunk/AddOn/TAcq/brparam.cc

    r3876 r3883  
    136136  pci2eth_fgdirect=false;
    137137  ethr_nlink = 0;
     138  ethr_forcesamefc_ = false;
    138139
    139140  skysource="";
     
    157158  nopciLossRate=0.;
    158159
     160// niveau d'impression,debug ...
     161  prtlevel_=0;
     162  prtmodulo_=50000;
    159163  Decode();    // On decode et on complete les parametres
    160164}
     
    203207  eths_targets=p.eths_targets;
    204208  ethr_nlink=p.ethr_nlink;
     209  ethr_forcesamefc_=p.ethr_forcesamefc_;
    205210
    206211  skysource=p.skysource;
     
    215220
    216221  nopciLossRate=p.nopciLossRate;
     222
     223  prtlevel_=p.prtlevel_;
     224  prtmodulo_=p.prtlevel_;
     225
    217226  return;
    218227}
     
    245254  }
    246255  ethr_nlink=conf.IParam("ethrnlink",0,0);   // Nombre de sources de paquets en reception ethernet
     256  if (conf.HasKey("ethrforcesamefc"))   ethr_forcesamefc_=true;   // force SAME FrameCounter   on all links
    247257
    248258  //  Parametre de controle du monitoring
     
    269279  fg_hard_ctrlc=conf.HasKey("hard_ctrlc");
    270280  if (conf.HasKey("nosavesigfits"))  savesigfits=false;
     281  if (conf.HasKey("prtlev"))  {
     282    prtlevel_=conf.IParam("prtlev",0,0);
     283    prtmodulo_=conf.IParam("prtlev",1,50000);
     284  }
     285 
    271286  Decode();
    272287}
     
    372387    cout << endl;
    373388  }
    374   cout << " TCP-PortId=" << tcpportid << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink << endl;
     389  cout << " TCP-PortId=" << tcpportid << " EthernetRead NbSources (=NbLinks)= " << ethr_nlink
     390       << ((ethr_forcesamefc_)?" ForceSameFrameCounter read mode":" AllOKPaquets read mode ") << endl;
     391
    375392  if (fgdoProc>0)
    376393    os << " Monitoring  NMeanProc=" << nmeanProc << " StepProc=" << stepProc << " NMaxProc=" << nmaxProc << endl;
     
    385402  os << " monothr y(1)/n(0) " << ((monothr)?"true":"false");
    386403  os << " ActivatePattern " << ((activate_pattern)?"true":"false") <<  endl;
    387  
     404  os << " PrtLevel=" << prtlevel_ << " PrtCntModulo=" <<  prtmodulo_ << endl;
     405
    388406  return os;
    389407}
  • trunk/AddOn/TAcq/brparam.h

    r3876 r3883  
    165165  // Cote reception
    166166  int ethr_nlink;    // Nombre total de source d'envoi (= nb total de fibre de fibre)
     167  bool ethr_forcesamefc_;   // true -> on force receptions de paquets avec SAME FrameCounter sur tous les liens
    167168
    168169  // Identification source observee dans le ciel
     
    188189
    189190  double nopciLossRate;   // Utilise avec pour les tests sans carte pciexpress TestPCIWrapperNODMA
     191
     192  // Niveau d'impression/debug ...
     193  int prtlevel_;
     194  long int prtmodulo_;
    190195};
    191196
  • trunk/AddOn/TAcq/mfacq.cc

    r3876 r3883  
    387387
    388388  cout << "mfacq[3] Creating   EthernetReader thread object     " << endl;
    389   EthernetReader ethrdr(mmgr, bpar.GetParams(), bpar.GetParams().tcpportid, false);
     389  EthernetReader ethrdr(mmgr, bpar.GetParams(), bpar.GetParams().tcpportid, acpar.ethr_forcesamefc_);
    390390
    391391  //  usleep(200);  attente au cas ou ...
  • trunk/AddOn/TAcq/racqueth.cc

    r3764 r3883  
    433433      if (ReadNextAllFibers()) { fgok=false;  break; }
    434434      totnpaqrd_++;
     435      if ((prtlev_>0)&&(totnpaqrd_%prtmodulo_==0))  {
     436          cout << "EthernetReader: NbPaq/Link=" << totnpaqrd_ << " NSameFC="
     437               << totsamefc_ << " / NPaqFib0Read=" << totnpqrd_[0]
     438               << " FracSameFC=" << 100*totsamefc_/totnpqrd_[0] << " %" <<  endl;
     439      }
    435440    }
    436441
    437442    MoveToNextTarget();  // Pour faire traiter le dernier paquet si plein
    438443    MZoneManage(true);   // Nettoyage final
    439     usleep(50000);       // Attente de traitement du dernier paquet
    440     memgr_.Stop();        // Arret
    441444
    442445    cout << " ------------------  EthernetReader::run() END ----------------- " << endl;
    443446    ts.SetNow();
    444447    tm.SplitQ();
    445     cout << "  END reading TotNPaq/Link=" << totnpaqrd_ << " :"  << ts ;
    446     if (rdsamefc_) cout << " NSameFC=" << totsamefc_ << endl;
    447     else cout << endl;
     448    cout << "  END reading TotNPaq/Link=" << totnpaqrd_ << " :"  << ts << endl;
     449    cout << "... NbPaq/Link=" << totnpaqrd_ << " NSameFC="
     450         << totsamefc_ << " / NPaqLink[0]_Read=" << totnpqrd_[0]
     451         << " FracSameFC=" << 100*totsamefc_/totnpqrd_[0] << " %" << endl;
     452
    448453    for(size_t fib=0; fib<(size_t)memgr_.NbFibres(); fib++)  {
    449454      int perc=0;
     
    459464    cout << " ---------------------------------------------------------- " << endl;
    460465
     466    usleep(50000);       // Attente de traitement du dernier paquet
     467    memgr_.Stop();        // Arret
     468
    461469  }  // Fin du bloc try
    462470  catch (std::exception& exc) {
     
    480488    if (ReadNext(fib)) return true;  // probleme
    481489  }
    482   if (!rdsamefc_ || (memgr_.NbFibres()<2))  {
    483     totsamefc_++;  return false;  // c'est OK
    484   }
    485   uint_8 cfc=curfc_[0];
    486   bool fgsamefc=true;
    487   for(size_t fib=1; fib<memgr_.NbFibres(); fib++) {
    488     if (curfc_[fib]!=cfc) {
    489       fgsamefc=false;
    490       if (curfc_[fib] > cfc)  cfc=curfc_[fib];
    491     }
    492   }
    493   if (fgsamefc) {
    494     totsamefc_++;  return false;  // c'est OK  , same framecounter
    495   }
    496   else {  // else !fgsame
    497     for(uint_4 fib=0; fib<memgr_.NbFibres(); fib++) {
    498       while (curfc_[fib]<cfc) {
    499         if (ReadNext(fib)) return true;  // probleme
    500       }
    501     }
    502   }   // fin de  else !fgsame
    503   totsamefc_++;
    504   return false; // c'est OK
     490  if (!rdsamefc_ || (memgr_.NbFibres()<2))  {
     491    uint_8 cfc=curfc_[0];
     492    bool fgsamefc=true;
     493    for(size_t fib=1; fib<memgr_.NbFibres(); fib++) {
     494      if (curfc_[fib]!=cfc)   fgsamefc=false;
     495    }
     496    if (fgsamefc)  totsamefc_++; 
     497    return false;  // c'est OK
     498  }
     499  //  On va essayer de lire jusqu'a avoir same_frame_counter
     500  bool echec=true;
     501  while (echec) {
     502    uint_8 cfc=curfc_[0];
     503    bool fgsamefc=true;
     504    for(size_t fib=1; fib<memgr_.NbFibres(); fib++) {
     505      if (curfc_[fib]!=cfc) {
     506        fgsamefc=false;
     507        if (curfc_[fib] > cfc)  cfc=curfc_[fib];
     508      }
     509    }
     510    if (fgsamefc) {
     511      totsamefc_++;  echec=false; return false;  // c'est OK  , same framecounter
     512    }
     513    else {  // else !fgsame
     514      for(uint_4 fib=0; fib<memgr_.NbFibres(); fib++) {
     515        while (curfc_[fib]<cfc) {
     516          if (ReadNext(fib)) return true;  // probleme
     517        }
     518      }
     519    }   // fin de  else !fgsame
     520  }  // fin de while(echec): lecture jusqu'a same_frame_counter
     521
     522  return true; // probleme
    505523}
    506524
  • trunk/AddOn/TAcq/racqueth.h

    r3775 r3883  
    5757  inline void STOP() { stop_ = true; } 
    5858
    59   inline int SetPrintLevel(int lev=0) { prtlev_=lev; return 0;}
     59  inline int SetPrintLevel(int lev=0, uint_8 prtmodulo=50000)
     60    { prtlev_=lev;   prtmodulo_=prtmodulo;  return 0; }
    6061
    6162protected:
     
    7980  bool fgdirectsend_;  //  true -> direct transfer of DMA data to ethernet
    8081
    81   int prtlev_;
     82  int prtlev_;    // print level
     83  uint_8 prtmodulo_;   // print periodicity (modulo)
    8284};
    8385
     
    9294  inline void STOP() { stop_ = true; } 
    9395
    94   inline int SetPrintLevel(int lev=0) { prtlev_=lev; return 0;}
     96  inline int SetPrintLevel(int lev=0, uint_8 prtmodulo=50000)
     97    { prtlev_=lev;   prtmodulo_=prtmodulo;  return 0; }
    9598
    9699protected:
     
    137140  Byte* mmbufib_[MAXANAFIB];  // Pointeurs zone memoire de chaque fibre rendu par RAcqMemZoneMgr
    138141
    139   int prtlev_;
     142  int prtlev_;   // print level
     143  uint_8 prtmodulo_;   // print periodicity (modulo)
    140144};
    141145
  • trunk/AddOn/TAcq/specmfib.cc

    r3872 r3883  
    6868      else mmgr.SetFinalizedMask((uint_4)MemZS_ProcB);
    6969    }
    70     BRMultiFitsReader reader(mmgr, par.dirlist_, false, par.imin_, par.imax_, par.istep_);
    71     reader.SetPrintLevel(par.prtlevel_);
     70    BRMultiFitsReader reader(mmgr, par.dirlist_, par.rdsamefc_, par.imin_, par.imax_, par.istep_);
     71    reader.SetPrintLevel(par.prtlevel_,par.prtmodulo_);
    7272
    7373    BRMeanSpecCalculator procms(mmgr, par.outpath_, par.nmean_, par.fgdatafft_, par.fgsinglechannel_);
Note: See TracChangeset for help on using the changeset viewer.