Changeset 1687 in Sophya for trunk/ArchTOIPipe/Kernel
- Timestamp:
- Oct 12, 2001, 1:20:03 PM (24 years ago)
- Location:
- trunk/ArchTOIPipe/Kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/toimanager.cc
r1684 r1687 47 47 } 48 48 } 49 50 51 // ----------------------------------------------------------------- 52 // Classe pour affichage de l'avancement des TOIProcessors 53 // Reza 08/2001 54 // ----------------------------------------------------------------- 55 56 RzProcSampleCounter::RzProcSampleCounter() 57 { 58 _msg = "SampleCounter/Info"; 59 _rate = 50; 60 } 61 62 RzProcSampleCounter::~RzProcSampleCounter() 63 { 64 } 65 66 long RzProcSampleCounter::PrintStats() 67 { 68 int istart = 0; 69 int iend = 0; 70 long dns_print = 1000; 71 int dns_print_fac = _rate; 72 int nbmax_dns_print = 2; 73 74 TOIManager* mgr = TOIManager::getManager(); 75 76 istart = mgr->getRequestedBegin(); 77 iend = mgr->getRequestedEnd(); 78 79 dns_print = (iend-istart)/dns_print_fac; 80 if (dns_print < 1000) dns_print = ((iend-istart) < 1000) ? (iend-istart) : 1000; 81 if (dns_print < 1) dns_print = 1; 82 nbmax_dns_print = (iend-istart)/dns_print; 83 84 cout << "RzProcSampleCounter::PrintStats() InfoMessage=" << _msg 85 << "\n ... " << _msg << " istart=" 86 << istart << " iend= " << iend << " dns_print= " << dns_print 87 << " nbmax_dns_print= " << nbmax_dns_print << endl; 88 // ------------------- Impression continu de stat ------------------------ 89 long nb_dns_print = 0; 90 int nb_sleep = 0; 91 long last_sample_count = 0; 92 long processed_samples = 0; 93 long total_sample_count = dns_print*nbmax_dns_print; 94 bool alldone = false; 95 while (!alldone) { 96 processed_samples = ProcessedSampleCount(); 97 if ( (processed_samples-last_sample_count > dns_print) || 98 (processed_samples > total_sample_count-10) ) { 99 last_sample_count = processed_samples; 100 if (nb_dns_print == 0) cout << "\n"; 101 nb_dns_print++; 102 cout << ">>> " << _msg << ": ProcessedSampleCount()= " << last_sample_count 103 << " Frac done = " << processed_samples*100/total_sample_count << " %" << endl; 104 if (last_sample_count > total_sample_count-10) alldone = true; 105 nb_sleep = 0; 106 } 107 else if ((nb_sleep+1)%5 == 0) 108 cout << "> " << _msg << ": ProcSamples()= " << processed_samples 109 << " Done = " << " %" << processed_samples*100/total_sample_count 110 << " NbSleep(1) = " << nb_sleep << endl; 111 112 sleep(1); nb_sleep++; 113 } 114 115 // ----------------------------------------------------------------------- 116 117 return last_sample_count; 118 119 } -
trunk/ArchTOIPipe/Kernel/toimanager.h
r1684 r1687 4 4 #define TOIMANAGER_H 5 5 6 #include <string> 6 7 #include <vector> 7 8 … … 26 27 }; 27 28 29 // ----------------------------------------------------------------- 30 // Classe pour affichage de l'avancement des TOIProcessors 31 // Reza 08/2001 32 // ----------------------------------------------------------------- 33 34 class RzProcSampleCounter { 35 public: 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; } 42 protected: 43 int _rate; 44 string _msg; 45 }; 46 47 template <class T> 48 class ProcSampleCounter : public RzProcSampleCounter { 49 public: 50 ProcSampleCounter(const T & t) { _t = &t; } 51 virtual long ProcessedSampleCount() 52 { return _t->ProcessedSampleCount(); } 53 protected: 54 const T * _t; 55 }; 56 28 57 #endif 58
Note:
See TracChangeset
for help on using the changeset viewer.