source: Sophya/trunk/AddOn/TAcq/vismfib.cc@ 3755

Last change on this file since 3755 was 3724, checked in by ansari, 16 years ago

Implementation possibilite calcul visibilites avec des threads en parallele, Reza 29/12/2009

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