source: Sophya/trunk/AddOn/TAcq/treadmfib.cc@ 3992

Last change on this file since 3992 was 3795, checked in by ansari, 15 years ago

Ajout programme simple de test/lecture multi fibres avec traitement par BRBaseProcessor, Reza 29/06/2010

File size: 2.4 KB
RevLine 
[3795]1// Utilisation de SOPHYA pour faciliter les tests ...
2#include "sopnamsp.h"
3#include "machdefs.h"
4
5/* ----------------------------------------------------------
6 Programme de test de lecture multi-fibes et thread de traitement
7 BRBaseProcessor
8 BAORadio - LAL/IRFU R. Ansari, C. Magneville
9 Juin 2010
10 ---------------------------------------------------------- */
11
12// include standard c/c++
13#include <iostream>
14#include <string>
15#include <exception>
16
17// include sophya mesure ressource CPU/memoire ...
18#include "resusage.h"
19#include "ctimer.h"
20#include "timing.h"
21#include "timestamp.h"
22#include "strutilxx.h"
23#include "tarrinit.h"
24#include "histinit.h"
25
26#include "brpaqu.h"
27#include "brfitsrd.h"
28#include "brbaseproc.h"
29#include "brdiskw.h"
30
31#include "branap.h"
32
33
34
35//----------------------------------------------------
36//----------------------------------------------------
37int main(int narg, char* arg[])
38{
39
40 TArrayInitiator _inia;
41
42 int rc = 0;
43 try {
44 cout << " ---------- treadmfib.cc Start ------------- " << endl;
45 // Decodage parametres
46 BRAnaParam par;
47 rc = par.DecodeArgs(narg, arg);
48 if (rc) return rc;
49 rc = par.PaqSizeFromFits();
50 if (rc) return rc;
51 par.Print(cout);
52
53
54 ResourceUsage resu;
55
56 cout << " treadmfib: Creating MemZoneMgr/threads - PaqSz= " << par.paqsize_ << endl;
57
58 RAcqMemZoneMgr mmgr(par.nzones_, par.dirlist_.size(), par.npaqinzone_, par.paqsize_);
59 mmgr.SetFinalizedMask((uint_4)MemZS_ProcA);
60 BRMultiFitsReader reader(mmgr, par.dirlist_, true, par.imin_, par.imax_, par.istep_);
61 reader.SetPrintLevel(par.prtlevel_);
62 BRBaseProcessor proc(mmgr);
63
64 cout << " treadmfib: Starting threads (reader proc) ... " << endl;
65 reader.start();
66 proc.start();
67 usleep(200000);
68 cout << " treadmfib: Waiting for reader thread to finish ... " << endl;
69 reader.join();
70 cout << " treadmfib: reader thread finished, waiting for processor thread to end ... " << endl;
71 proc.join();
72 mmgr.Print(cout);
73 cout << resu ;
74 }
75 catch (std::exception& sex) {
76 cerr << "\n treadmfib.cc std::exception :" << (string)typeid(sex).name()
77 << "\n msg= " << sex.what() << endl;
78 rc = 78;
79 }
80 catch (...) {
81 cerr << " treadmfib.cc catched unknown (...) exception " << endl;
82 rc = 79;
83 }
84
85 cout << ">>>> treadmfib.cc ------- END ----------- RC=" << rc << endl;
86 return rc;
87
88}
89
90
Note: See TracBrowser for help on using the repository browser.