Last change
on this file since 1647 was 1629, checked in by ansari, 24 years ago |
- 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
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1365] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 |
|
---|
| 3 | #ifndef TOIMANAGER_H
|
---|
| 4 | #define TOIMANAGER_H
|
---|
| 5 |
|
---|
| 6 | #include <vector>
|
---|
| 7 |
|
---|
[1410] | 8 | using namespace std;
|
---|
| 9 |
|
---|
[1365] | 10 | class TOIManager {
|
---|
| 11 | public:
|
---|
| 12 | static TOIManager* getManager();
|
---|
| 13 | void setRequestedSample(long begin, long end);
|
---|
| 14 | long getRequestedBegin();
|
---|
| 15 | long getRequestedEnd();
|
---|
| 16 | void addThread(pthread_t*);
|
---|
| 17 | void joinAll();
|
---|
| 18 |
|
---|
| 19 | protected:
|
---|
| 20 | TOIManager();
|
---|
| 21 | static TOIManager* instance;
|
---|
| 22 | long reqBegin;
|
---|
| 23 | long reqEnd;
|
---|
| 24 |
|
---|
| 25 | vector<pthread_t*> threads;
|
---|
| 26 | };
|
---|
| 27 |
|
---|
[1629] | 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 |
|
---|
[1365] | 57 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.