1 | #include <iostream>
|
---|
2 |
|
---|
3 | #include "racqumem.h"
|
---|
4 | #include "racqurw.h"
|
---|
5 | #include "racquproc.h"
|
---|
6 |
|
---|
7 | #include "pciewrap.h"
|
---|
8 | #include "brpaqu.h"
|
---|
9 | #include "minifits.h"
|
---|
10 |
|
---|
11 | #include "resusage.h"
|
---|
12 | #include "ctimer.h"
|
---|
13 | #include "timing.h"
|
---|
14 |
|
---|
15 | #include "tarrinit.h"
|
---|
16 | #include "fiosinit.h"
|
---|
17 |
|
---|
18 | using namespace std;
|
---|
19 | using namespace SOPHYA;
|
---|
20 |
|
---|
21 | //--------------------------------------------------------
|
---|
22 | // Programme test acquisition BAORadio multi-thread
|
---|
23 | // LAL - R. Ansari Juillet - 2008
|
---|
24 | //--------------------------------------------------------
|
---|
25 |
|
---|
26 | int main(int narg, char* arg[])
|
---|
27 | {
|
---|
28 |
|
---|
29 | int rc = 0;
|
---|
30 | InitTim();
|
---|
31 |
|
---|
32 | // Initialisation
|
---|
33 | TArrayInitiator _arri;
|
---|
34 | FitsIOServerInitiator _fiosi;
|
---|
35 |
|
---|
36 | Timer tm("tmtacq");
|
---|
37 | string dir = "ExA";
|
---|
38 | cout << "tmtacq[1] - starting acq program " << endl;
|
---|
39 |
|
---|
40 | try {
|
---|
41 | RAcqMemZoneMgr mmgr(3,100,4096);
|
---|
42 | PCIEReader pcir(mmgr, 10);
|
---|
43 | DataSaver ds(mmgr, dir, 10);
|
---|
44 | DataProc pr(mmgr, dir, 1, 10);
|
---|
45 | tm.Split("Threads created");
|
---|
46 | cout << "tmtacq[2] - starting 3 threads pcir, ds, pr ... " << endl;
|
---|
47 | pcir.start();
|
---|
48 | ds.start();
|
---|
49 | pr.start();
|
---|
50 | cout << "tmtacq[3] - waiting for threads to finish ... " << endl;
|
---|
51 | sleep(1);
|
---|
52 | pcir.join();
|
---|
53 | ds.join();
|
---|
54 | sleep(1);
|
---|
55 | mmgr.Stop();
|
---|
56 | pr.join();
|
---|
57 | cout << "tmtacq[4] - threads finished " << endl;
|
---|
58 | tm.Split("Threads Finished");
|
---|
59 | mmgr.Print(cout);
|
---|
60 | rc = 0;
|
---|
61 | }
|
---|
62 | catch (MiniFITSException& exc) {
|
---|
63 | cerr << " tmtacq.cc catched MiniFITSException " << exc.Msg() << endl;
|
---|
64 | rc = 77;
|
---|
65 | }
|
---|
66 | catch (PThrowable& exc) {
|
---|
67 | cerr << " tmtacq.cc catched Exception " << exc.Msg() << endl;
|
---|
68 | rc = 76;
|
---|
69 | }
|
---|
70 | catch (std::exception& sex) {
|
---|
71 | cerr << "\n tmtacq.cc std::exception :"
|
---|
72 | << (string)typeid(sex).name() << "\n msg= "
|
---|
73 | << sex.what() << endl;
|
---|
74 | rc = 78;
|
---|
75 | }
|
---|
76 | catch (...) {
|
---|
77 | cerr << " tmtacq.cc : Catched ... exception " << endl;
|
---|
78 | rc = 79;
|
---|
79 | }
|
---|
80 | cout << "tmtacq[9] - stopping acq program " << endl;
|
---|
81 | return rc;
|
---|
82 | }
|
---|