Changeset 1629 in Sophya


Ignore:
Timestamp:
Aug 8, 2001, 12:01:41 PM (24 years ago)
Author:
ansari
Message:
  • Ajout pthread_exit apres l'execution de run() ds TOIProcessor::ThreadStart()
  • Ajout de la classe ProcSampleCounter<T> pour affichage continu de stats ds toimanager.h .cc
  • correction mineure de toi2map.cc
  • Utilisation de ProcSampleCounter<T> ds tsttoi2map.cc et simtst.cc

Reza 8/8/2001

Location:
trunk/ArchTOIPipe
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/Kernel/fitstoirdr.cc

    r1527 r1629  
    1111  name = "rdr";
    1212  fptr = NULL;
     13  totnscount = 0;
    1314}
    1415
     
    126127  cout << "reader reading... NRows=" << nrows << " firstSn= "
    127128       << firstSn << endl;
     129
    128130  for (int i=0; i<nrows; i++) {
    129131    int anyNul;
     
    149151      putData(k, sn, y, flg);
    150152    }
     153    totnscount++;
    151154  }
    152155  cout << "reader done reading... " << pthread_self() << endl;
  • trunk/ArchTOIPipe/Kernel/fitstoirdr.h

    r1527 r1629  
    1919
    2020  virtual void init(); 
    21   virtual void run(); 
     21  virtual void run();
     22 
     23  inline int_8  ProcessedSampleCount() const { return totnscount; }
    2224
    2325protected:
     
    4345  // le flag est alors en colonne+1
    4446
     47  int_8 totnscount;   // Nombre total d'echantillon processe
     48
    4549};
    4650
  • trunk/ArchTOIPipe/Kernel/fitstoiwtr.cc

    r1532 r1629  
    1818  fits_unlock();
    1919  name = "wtr";
     20
     21  totnscount = 0;
    2022}
    2123
     
    148150      //           if ((sn%2000 == 0) || (sn<snb+5))
    149151      //        cout << " DBG-C-FitsWriter::run()" << sn << " line=" << fitsLine << endl;
    150       fitsLine++;
     152      fitsLine++;  totnscount++;
    151153    } catch (PException e) {
    152154    cout << "fitstoiwtr exception " << e.Msg() << endl;
  • trunk/ArchTOIPipe/Kernel/fitstoiwtr.h

    r1532 r1629  
    2222  virtual void  addInput(string name, TOI* toi, bool withFlag);
    2323
    24   virtual void  run(); 
     24  virtual void  run();
     25 
     26  inline int_8  ProcessedSampleCount() const { return totnscount; }
    2527 
    2628private:
     
    3234  map<int,pair<int, bool> > colsinput; // iTOI -> (colonne, hasflag)
    3335  // le flag est alors en colonne+1
     36
     37  int_8 totnscount;   // Nombre total d'echantillon processe
    3438};
    3539
  • trunk/ArchTOIPipe/Kernel/toimanager.cc

    r1410 r1629  
    4343  }
    4444}
     45
     46
     47// -----------------------------------------------------------------
     48//    Classe pour affichage de l'avancement des TOIProcessors
     49//                         Reza 08/2001
     50// -----------------------------------------------------------------
     51
     52RzProcSampleCounter::RzProcSampleCounter()
     53{
     54  _msg = "SampleCounter/Info";
     55  _rate = 50;
     56}
     57
     58RzProcSampleCounter::~RzProcSampleCounter()
     59{
     60}
     61
     62long RzProcSampleCounter::PrintStats()
     63{
     64  int istart = 0;
     65  int iend = 0;
     66  long dns_print = 1000;
     67  int dns_print_fac = _rate;
     68  int nbmax_dns_print = 2;
     69
     70  TOIManager* mgr = TOIManager::getManager();
     71 
     72  istart = mgr->getRequestedBegin();
     73  iend = mgr->getRequestedEnd();
     74 
     75  dns_print = (iend-istart)/dns_print_fac;
     76  if (dns_print < 1000) dns_print = ((iend-istart) < 1000) ? (iend-istart) : 1000;
     77  if (dns_print < 1) dns_print = 1;
     78  nbmax_dns_print = (iend-istart)/dns_print;
     79
     80  cout << "RzProcSampleCounter::PrintStats() InfoMessage=" << _msg
     81       << "\n ... " << _msg << " istart="
     82       << istart << " iend= " << iend << " dns_print= " << dns_print
     83       << " nbmax_dns_print= " << nbmax_dns_print << endl;
     84  // ------------------- Impression continu de stat ------------------------
     85  long nb_dns_print = 0;
     86  int nb_sleep = 0;
     87  long last_sample_count = 0;
     88  long processed_samples = 0;
     89  long total_sample_count = dns_print*nbmax_dns_print;
     90  bool alldone = false;
     91  while (!alldone) {
     92    processed_samples = ProcessedSampleCount();
     93    if ( (processed_samples-last_sample_count > dns_print) ||
     94         (processed_samples > total_sample_count-10) ) {
     95      last_sample_count = processed_samples;
     96      if (nb_dns_print == 0) cout << "\n";
     97      nb_dns_print++;
     98      cout << ">>> " << _msg << ": ProcessedSampleCount()= " << last_sample_count
     99           << " Frac done = " << processed_samples*100/total_sample_count << " %" << endl;
     100      if (last_sample_count > total_sample_count-10)  alldone = true;
     101      nb_sleep = 0;
     102    }
     103    else if ((nb_sleep+1)%5 == 0)
     104      cout << "> " << _msg << ": ProcSamples()= " <<  processed_samples
     105           << " Done = " << " %" << processed_samples*100/total_sample_count
     106           << " NbSleep(1) = " << nb_sleep << endl;
     107   
     108    sleep(1);  nb_sleep++;
     109  }
     110 
     111  // -----------------------------------------------------------------------
     112 
     113  return last_sample_count;
     114
     115}
  • trunk/ArchTOIPipe/Kernel/toimanager.h

    r1410 r1629  
    2626};
    2727
     28
     29// -----------------------------------------------------------------
     30//    Classe pour affichage de l'avancement des TOIProcessors
     31//                         Reza 08/2001
     32// -----------------------------------------------------------------
     33
     34class RzProcSampleCounter {
     35public:
     36                RzProcSampleCounter();
     37  virtual       ~RzProcSampleCounter();
     38  virtual long  ProcessedSampleCount() = 0;
     39  virtual long  PrintStats();
     40  inline int &  PrintRate(int pr) { return _rate; }
     41  inline string& InfoMessage() { return _msg; }
     42protected:
     43  int _rate;
     44  string _msg;
     45};
     46
     47template <class T>
     48class ProcSampleCounter : public RzProcSampleCounter {
     49public:
     50                ProcSampleCounter(const T & t) { _t = &t; }
     51  virtual long  ProcessedSampleCount()
     52                      { return _t->ProcessedSampleCount(); }
     53protected:
     54  const T * _t;
     55};
     56
    2857#endif
  • trunk/ArchTOIPipe/Kernel/toiprocessor.cc

    r1532 r1629  
    235235  //  cout << p->name << " new thread running " << pthread_self() << endl;
    236236  p->run();
     237  pthread_exit(NULL);
    237238  //  cout << p->name << " thread done " << pthread_self() << endl;
    238239  return NULL;
  • trunk/ArchTOIPipe/ProcWSophya/toi2map.cc

    r1536 r1629  
    4242TOI2Map::~TOI2Map()
    4343{
    44  if(mWSph && !mWSphInternal) delete mWSph;
     44 if(mWSph && mWSphInternal) delete mWSph;
    4545}
    4646
  • trunk/ArchTOIPipe/TestPipes/simtst.cc

    r1541 r1629  
    8787  int istart = 0;
    8888  int iend = 0;
    89   int_8 dns_print = 1000;
    90   int dns_print_fac = 50;
    91   int nbmax_dns_print = 2;
    9289
    9390  double range_min = -16000;
     
    207204    //  mgr->setRequestedSample(11680920,11710584);
    208205    //  mgr->setRequestedSample(104121000, 104946120);
    209     if (fgsetstart) {
     206    if (fgsetstart)
    210207      mgr->setRequestedSample(istart, iend);
    211       dns_print = (iend-istart)/dns_print_fac;
    212       if (dns_print < 1000) dns_print = 1000;
    213       nbmax_dns_print = (iend-istart)/dns_print;
    214     }
     208
    215209    //    FITSTOIReader r("/data/Archeops/bolo11.fits);
    216210    FITSTOIReader r(infile);
     
    397391
    398392    // ------------------- Impression continu de stat ------------------------
    399     int_8 nb_dns_print = 0;
    400     int nb_sleep = 0;
    401     int_8 last_sample_count = 0;
    402     int_8 processed_samples = 0;
    403     int_8 total_sample_count = dns_print*nbmax_dns_print;
    404     bool alldone = false;
    405     while (!alldone) {
    406       processed_samples = filt.ProcessedSampleCount();
    407       if ( (processed_samples-last_sample_count > dns_print) ||
    408            (processed_samples > total_sample_count-10) ) {
    409         last_sample_count = processed_samples;
    410         if (nb_dns_print == 0) cout << "\n";
    411         nb_dns_print++;
    412         cout << ">>> simtst/Info: ProcessedSampleCount()= " << last_sample_count
    413              << " Frac done = " << processed_samples*100/total_sample_count << " %" << endl;
    414         if (last_sample_count > total_sample_count-10)  alldone = true;
    415         nb_sleep = 0;
    416       }
    417       else if ((nb_sleep+1)%5 == 0)
    418         cout << "> simtst/Info: ProcSamples()= " <<  processed_samples
    419              << " Done = " << " %" << processed_samples*100/total_sample_count
    420              << " NbSleep(1) = " << nb_sleep << endl;
    421        
    422       sleep(1);  nb_sleep++;
    423     }
    424 
     393    ProcSampleCounter<SimpleFilter> stats(filt);
     394    stats.InfoMessage() = "simtst/Info";
     395    stats.PrintStats();
    425396    // -----------------------------------------------------------------------
    426397
  • trunk/ArchTOIPipe/TestPipes/tsttoi2map.cc

    r1537 r1629  
    154154//--------------------------------------------------------------------
    155155
     156
    156157 // FITS reader
    157158 FITSTOIReader rfitsb(fitsin_bolo);
     
    222223   }
    223224
     225 //  Affichage de l'avancement des TOIProcessors
     226 ProcSampleCounter<FITSTOIReader>  stats(rfitsb);
     227 stats.InfoMessage() = "tsttoi2map/Info";
     228 stats.PrintStats();
     229
     230 // Fin des traitements des TOIProcessors 
    224231 mgr->joinAll();
    225232 PrtTim("End threads");
     233
    226234
    227235 // Ecriture de la sphere Healpix sur fits
     
    240248
    241249 // Nettoyage
     250 cout << "tsttoi2map: cleanup " << endl;
    242251 delete sph;
    243252 if(wsph) delete wsph;
     253 cout << "tsttoi2map: ----------- End of job -------------- " << endl;
    244254
    245255//--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.