Changeset 2386 in Sophya
- Timestamp:
- May 20, 2003, 12:10:09 PM (22 years ago)
- Location:
- trunk/ArchTOIPipe
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/piotoirdr.cc
r2382 r2386 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: piotoirdr.cc,v 1. 5 2003-05-16 13:40:09aubourg Exp $5 // $Id: piotoirdr.cc,v 1.6 2003-05-20 10:10:08 aubourg Exp $ 6 6 7 7 #include "piotoirdr.h" … … 110 110 } 111 111 flags = new uint_8[nf]; 112 for (int i=0; i<nf; i++) flags[i] = pioflags[i];112 for (int i=0; i<nf; i++) flags[i] = (uint_8)pioflags[i]; 113 113 PIODeleteFLG(pioflags, pioGroup); 114 114 } -
trunk/ArchTOIPipe/Kernel/ringpipe.cc
r2385 r2386 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: ringpipe.cc,v 1. 1 2003-05-19 23:31:29aubourg Exp $5 // $Id: ringpipe.cc,v 1.2 2003-05-20 10:10:08 aubourg Exp $ 6 6 7 7 #include "ringpipe.h" … … 15 15 #endif 16 16 17 RingPipe::RingPipe( ) {17 RingPipe::RingPipe(int ws) { 18 18 i0 = -1; 19 winSize = ws; 19 20 producer = NULL; 20 21 pthread_cond_init(&ringReady, NULL); … … 38 39 void RingPipe::putRing(int i, Ring const* ring) { 39 40 lock(); 41 waitForRoom(i); 40 42 if (i0 == -1) { 41 43 data.insert(data.begin(), 1, (Ring const*) NULL); … … 50 52 notify(); 51 53 unlock(); 54 } 55 56 void RingPipe::waitForRoom(int j) { 57 while (j-i0 >= winSize) { 58 wait(); 59 } 52 60 } 53 61 … … 91 99 data.erase(data.begin(), data.begin()+(i-i0)); 92 100 i0=i; 101 notify(); 93 102 } 94 103 unlock(); -
trunk/ArchTOIPipe/Kernel/ringpipe.h
r2385 r2386 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: ringpipe.h,v 1. 1 2003-05-19 23:31:29 aubourg Exp $7 // $Id: ringpipe.h,v 1.2 2003-05-20 10:10:09 aubourg Exp $ 8 8 9 9 #ifndef RINGPIPE_H … … 21 21 class RingPipe { 22 22 public: 23 RingPipe( );23 RingPipe(int winSize=100); 24 24 virtual ~RingPipe(); 25 25 … … 28 28 29 29 virtual void wontNeedRingBefore(int i); 30 virtual void setWinSize(int n) {winSize = n;} 30 31 31 32 protected: … … 47 48 void notify() {pthread_cond_broadcast(&ringReady);} 48 49 50 int winSize; 49 51 vector<Ring const*> data; 50 52 int i0; … … 53 55 54 56 virtual void waitForRing(int i); // should be locked before 57 virtual void waitForRoom(int i); // should be locked before 55 58 virtual DataStatus isRingAvail(int i); // should be locked before 56 59 -
trunk/ArchTOIPipe/Kernel/ringprocessor.cc
r2385 r2386 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: ringprocessor.cc,v 1. 1 2003-05-19 23:31:29 aubourg Exp $5 // $Id: ringprocessor.cc,v 1.2 2003-05-20 10:10:09 aubourg Exp $ 6 6 7 7 #include "ringprocessor.h" 8 8 #include "ringpipe.h" 9 #include "toimanager.h" 9 10 10 11 #include <iostream> … … 37 38 38 39 wontNeedRing = -1; 40 neededRingHistory = 3; 41 lastAWNR = -1; 42 43 TOIManager::getManager()->registerProcessor(this); 39 44 } 40 45 … … 57 62 } 58 63 59 64 void RingProcessor::setNeededRingHistory(int nr) { 65 neededRingHistory = nr; 66 } 60 67 61 68 int RingProcessor::declareRingInput(string ring) { … … 147 154 } 148 155 156 RingPipe* RingProcessor::getOutRing(string out) 157 { 158 // recherche du nom de la sortie et verification si le toi existe deja 159 map<string, int>::iterator i = outRingIx.find(out); 160 if (i == outRingIx.end()) { 161 return NULL; 162 } else { 163 return outRings[(*i).second]; 164 } 165 } 166 167 149 168 150 169 Ring const* RingProcessor::getRing(int index, int i) { … … 169 188 } 170 189 190 void RingProcessor::autoWontNeedRing(int iCur) { 191 if (neededRingHistory <=0) return; 192 if (iCur <= lastAWNR + neededRingHistory/10) return; 193 lastAWNR = iCur; 194 wontNeedRingBefore(iCur-neededRingHistory); 195 } 196 171 197 172 198 void RingProcessor::getRingRange(int& min, int&max) { -
trunk/ArchTOIPipe/Kernel/ringprocessor.h
r2385 r2386 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: ringprocessor.h,v 1. 1 2003-05-19 23:31:29 aubourg Exp $7 // $Id: ringprocessor.h,v 1.2 2003-05-20 10:10:09 aubourg Exp $ 8 8 9 9 … … 52 52 virtual int getWontNeedBefore() {return wontNeedRing;} 53 53 54 virtual void setNeededRingHistory(int nrings); // -1 : disable 54 55 55 56 protected: … … 60 61 RingPipe* getInputRing(int index); 61 62 RingPipe* getOutputRing(int index); 63 RingPipe* getOutRing(string out); 62 64 virtual void wontNeedRingBefore(int i); 63 65 friend class RingPipe; 66 friend class TOIManager; 64 67 virtual void getRingRange(int& min, int& max); 65 68 … … 68 71 int ringEnd; 69 72 int wontNeedRing; 73 int neededRingHistory; 74 75 void autoWontNeedRing(int iCur); 76 int lastAWNR; 70 77 71 78 map<string, int> inRingIx; -
trunk/ArchTOIPipe/Kernel/toimanager.cc
r2385 r2386 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toimanager.cc,v 1.2 1 2003-05-19 23:31:29 aubourg Exp $5 // $Id: toimanager.cc,v 1.22 2003-05-20 10:10:09 aubourg Exp $ 6 6 7 7 #include "toimanager.h" … … 42 42 cout << "Adding processor to TOIManager for group execution" << endl; 43 43 processors.push_back(proc); 44 45 } 46 47 void TOIManager::registerProcessor(RingProcessor* proc) { 48 49 cout << "Adding processor to TOIManager for group execution" << endl; 50 ringProcessors.push_back(proc); 44 51 45 52 } … … 80 87 cout << "processor started " << endl; 81 88 } 89 90 for (vector<RingProcessor*>::iterator i = ringProcessors.begin(); 91 i != ringProcessors.end(); i++) { 92 RingProcessor* proc = *i; 93 cout << "**********************" << endl; 94 cout << "starting processor " << endl; 95 proc->start(); 96 cout << "processor started " << endl; 97 } 82 98 cout << "**********************" << endl; 99 } 100 101 void TOIManager::checkRingLimits() 102 { 103 int min=0; 104 int max = MAXINT; 105 for (int pass=0; pass<2; pass++) { 106 for (vector<RingProcessor*>::iterator i = ringProcessors.begin(); 107 i != ringProcessors.end(); i++) { 108 RingProcessor* proc = *i; 109 proc->getRingRange(min, max); 110 } 111 } 83 112 } 84 113 … … 162 191 } 163 192 193 RingPipe& TOIManager::connect(RingProcessor& pout, string out, 194 RingProcessor& pin, string in) { 195 RingPipe* pipe; 196 char buff[128]; 197 sprintf(buff, "Ring_[%s-%s]", in.c_str(), out.c_str()); 198 if ((pipe = pout.getOutRing(out)) == NULL) { 199 pipe = new RingPipe(); 200 pout.addRingOutput(out, pipe); 201 } 202 203 pin.addRingInput(in, pipe); 204 return(*pipe); 205 } 206 164 207 // methode connect de cgt simplifiee et corrigee 165 208 TOI& TOIManager::connect(TOIProcessor& prout, string out, … … 169 212 if (nom.length() < 1) { 170 213 char buff[128]; 171 sprintf(buff, "TOI%s_[%s-%s]", nom , in, out);214 sprintf(buff, "TOI%s_[%s-%s]", nom.c_str(), in.c_str(), out.c_str()); 172 215 nom = buff; 173 216 } … … 230 273 int nbmax_dns_print = 2; 231 274 232 TOIManager* mgr = TOIManager::getManager();275 // TOIManager* mgr = TOIManager::getManager(); 233 276 234 277 // istart = mgr->getRequestedBegin(); … … 263 306 nb_dns_print++; 264 307 fracperc = (double)processed_samples*100./(double)total_sample_count; 265 fperc = fracperc*100;308 fperc = (int)(fracperc*100); 266 309 cout << ">>> " << _msg << ": ProcessedSampleCount()= " << last_sample_count 267 310 << " Frac done = " << (double)fperc/100. << " %" << endl; … … 271 314 else if ((nb_sleep+1)%5 == 0) { 272 315 fracperc = (double)processed_samples*100./(double)total_sample_count; 273 fperc = fracperc*100;316 fperc = (int)(fracperc*100); 274 317 cout << "> " << _msg << ": ProcSamples()= " << processed_samples 275 318 << " Done = " << " %" << (double)fperc/100. -
trunk/ArchTOIPipe/Kernel/toimanager.h
r2225 r2386 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: toimanager.h,v 1.1 7 2002-10-23 21:57:40aubourg Exp $7 // $Id: toimanager.h,v 1.18 2003-05-20 10:10:09 aubourg Exp $ 8 8 9 9 … … 16 16 17 17 #include "toiprocessor.h" 18 #include "ringprocessor.h" 18 19 19 20 20 // -----------ajout cgt vf 19/08/200221 22 21 #include "toi.h" 22 #include "ringpipe.h" 23 23 24 24 #include <typeinfo> … … 34 34 35 35 #include <pthread.h> 36 // ----------fin ajout cgt 36 37 37 38 38 … … 51 51 void startAll(); 52 52 bool checkSamplesLimits(int pass); 53 void checkRingLimits(); 53 54 54 55 void waitForAll(); … … 71 72 // fin ajout cgt 72 73 73 74 virtual RingPipe& connect(RingProcessor& pout, string out, 75 RingProcessor& pint, string in); 74 76 75 77 … … 87 89 vector<TOIProcessor*> processors; 88 90 void registerProcessor(TOIProcessor* proc); 91 vector<RingProcessor*> ringProcessors; 92 void registerProcessor(RingProcessor* proc); 89 93 90 94 friend class TOIProcessor; 95 friend class RingProcessor; 91 96 92 97 // ajout cgt vf 19/08/2002
Note:
See TracChangeset
for help on using the changeset viewer.