/[PAMELA software]/chewbacca/YodaProfiler/src/YodaProfiler.cpp
ViewVC logotype

Diff of /chewbacca/YodaProfiler/src/YodaProfiler.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mocchiut, Tue Sep 23 07:20:33 2008 UTC revision 1.12 by pam-fi, Tue Nov 29 13:20:43 2011 UTC
# Line 24  void usage(){ Line 24  void usage(){
24    printf(" -v | --verbose  be verbose [default]\n");    printf(" -v | --verbose  be verbose [default]\n");
25    printf(" -s | --silent   print nothing on STDOUT\n");    printf(" -s | --silent   print nothing on STDOUT\n");
26    printf(" -g | --debug    be very verbose [default: no]\n");    printf(" -g | --debug    be very verbose [default: no]\n");
27    printf(" -p | --pedantic be strict in checks, exit with error if any problem is found [default: no]\n");    printf(" -p | --pedantic be strict in checks, exit with error if any problem is found [default: yes]\n");
28      printf(" -r | --relaxed  do not perfrom some important checks, use it only if you know what you are doing [default: NO]\n");
29      printf(" -np | --no-pedantic do NOT be strict in checks, try to continue if any problem is found [default: no]\n");
30      printf(" -tag char       set the run tagging in _RUNID_GEN to \"char\" (four letters)[default = 'NONE']\n");
31    printf(" -boot number    CPU boot number [default = taken from VarDump]\n");    printf(" -boot number    CPU boot number [default = taken from VarDump]\n");
32    printf(" -autoboot       if no VarDump found try to determine the BOOT number\n");    printf(" -autoboot       if no VarDump found try to determine the BOOT number\n");
33    printf("                 looking at timesync [default]\n");    printf("                 looking at timesync [default]\n");
# Line 33  void usage(){ Line 36  void usage(){
36    printf(" -obt0 number    obt at timesync (ms) [default = taken from data]\n");    printf(" -obt0 number    obt at timesync (ms) [default = taken from data]\n");
37    printf(" -dworbit number number is the downlink orbit number (to be used with non-standard names)\n");    printf(" -dworbit number number is the downlink orbit number (to be used with non-standard names)\n");
38    printf(" -static         use static path inside the DB instead of symbolic names\n");    printf(" -static         use static path inside the DB instead of symbolic names\n");
39      //  printf(" -keepenv        use environmental variables in the filenames\n");
40      printf(" -k | --keepenv  use environmental variables in the filenames [default]\n");
41      printf(" -nk | --no-keepenv  use PAM_L0 or standard filenames\n");
42    //  printf(" -gpamela        shortcut to \"-clean 0 -obt0 1 -tsync 1 -no-autoboot -boot 1 -dworbit 1 -static\"\n");    //  printf(" -gpamela        shortcut to \"-clean 0 -obt0 1 -tsync 1 -no-autoboot -boot 1 -dworbit 1 -static\"\n");
43    printf(" -gpamela        shortcut to \"-clean 0 -obt0 1 -no-autoboot -dworbit 1 -static\"\n");    printf(" -gpamela        shortcut to \"-clean 0 -obt0 1 -no-autoboot -dworbit 1 -static\"\n");
44    printf(" -clean number   number in seconds after which the fragment table\n");    printf(" -clean number   number in seconds after which the fragment table\n");
# Line 81  int main(int numinp, char *inps[]){ Line 87  int main(int numinp, char *inps[]){
87    Bool_t runpieces = false;    Bool_t runpieces = false;
88    //    //
89    //    //
90      TString tag = "NONE";
91    TString filerawname  = "";    TString filerawname  = "";
92    TString filerootname = "";    TString filerootname = "";
93    //    //
# Line 103  int main(int numinp, char *inps[]){ Line 110  int main(int numinp, char *inps[]){
110    //        //    
111    Bool_t chewbacca = false;    Bool_t chewbacca = false;
112    Bool_t staticp = false;    Bool_t staticp = false;
113      Bool_t keepenv = true;
114    Bool_t beverbose = true;    Bool_t beverbose = true;
115    Bool_t debug = false;    Bool_t debug = false;
116    Bool_t autoboot = true;    Bool_t autoboot = true;
# Line 123  int main(int numinp, char *inps[]){ Line 131  int main(int numinp, char *inps[]){
131    //    //
132    Bool_t check = false;    Bool_t check = false;
133    //    //
134    Bool_t pedantic = false;    Bool_t pedantic = true;
135      //
136      Bool_t relaxed = false;
137    //    //
138    Int_t i = 0;    Int_t i = 0;
139    //    //
# Line 145  int main(int numinp, char *inps[]){ Line 155  int main(int numinp, char *inps[]){
155          };          };
156          filerawname = (TString)inps[i+1];                        filerawname = (TString)inps[i+1];              
157        };        };
158        if ( !strcmp(inps[i],"-yodaFile") ) {        if ( !strcmp(inps[i],"-yodaFile") || !strcmp(inps[i],"-L0File") ) {
159          if ( numinp-1 < i+1 ){          if ( numinp-1 < i+1 ){
160            usage();            usage();
161            exit(1);            exit(1);
# Line 172  int main(int numinp, char *inps[]){ Line 182  int main(int numinp, char *inps[]){
182          fcleanfile = (TString)inps[i+1];                  fcleanfile = (TString)inps[i+1];        
183          forceclean = true;          forceclean = true;
184        };        };
185         if ( !strcmp(inps[i],"-tag") ) {
186            if ( numinp-1 < i+1 ){
187              usage();
188              exit(1);
189            };
190            tag = (TString)inps[i+1];      
191          };
192       if ( !strcmp(inps[i],"-validate") ) {       if ( !strcmp(inps[i],"-validate") ) {
193          if ( numinp-1 < i+1 ){          if ( numinp-1 < i+1 ){
194            usage();            usage();
# Line 189  int main(int numinp, char *inps[]){ Line 206  int main(int numinp, char *inps[]){
206        if ( !strcmp(inps[i],"-static") ) {        if ( !strcmp(inps[i],"-static") ) {
207          staticp = true;          staticp = true;
208        };        };
209          if ( !strcmp(inps[i],"-k") || !strcmp(inps[i],"--keepenv") ) {
210            keepenv = true;
211          };
212          if ( !strcmp(inps[i],"-nk") || !strcmp(inps[i],"--no-keepenv") ) {
213            keepenv = false;
214          };
215        if ( !strcmp(inps[i],"-autoboot") ) {        if ( !strcmp(inps[i],"-autoboot") ) {
216          autoboot = true;          autoboot = true;
217        };        };
# Line 285  int main(int numinp, char *inps[]){ Line 308  int main(int numinp, char *inps[]){
308        //        //
309        if ( !strcmp(inps[i],"-p") || !strcmp(inps[i],"--pedantic") ) pedantic = true;        if ( !strcmp(inps[i],"-p") || !strcmp(inps[i],"--pedantic") ) pedantic = true;
310        //        //
311          if ( !strcmp(inps[i],"-r") || !strcmp(inps[i],"--relaxed") ) relaxed = true;
312          //
313          if ( !strcmp(inps[i],"-np") || !strcmp(inps[i],"--no-pedantic") ) pedantic = false;
314          //
315        if ( !strcmp(inps[i],"-nofrag") ) nofrag = true;        if ( !strcmp(inps[i],"-nofrag") ) nofrag = true;
316        //        //
317        if ( !strcmp(inps[i],"-check") ) check = true;        if ( !strcmp(inps[i],"-check") ) check = true;
# Line 304  int main(int numinp, char *inps[]){ Line 331  int main(int numinp, char *inps[]){
331    // If not in verbose mode redirect to /dev/null the stdout and stderr    // If not in verbose mode redirect to /dev/null the stdout and stderr
332    //    //
333    if ( !beverbose ){    if ( !beverbose ){
334      nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);      nul = open("/dev/null", O_CREAT | O_RDWR,S_IRUSR | S_IWUSR);
335      dup2(nul,1);      dup2(nul,1);
336      dup2(nul,2);      dup2(nul,2);
337    };    };
# Line 364  int main(int numinp, char *inps[]){ Line 391  int main(int numinp, char *inps[]){
391      if ( !dwinput ) dwinput = 1;      if ( !dwinput ) dwinput = 1;
392      staticp = true;      staticp = true;
393      autoboot = false;      autoboot = false;
394        pedantic = false;
395    };    };
396    //    //
397    if ( filerawname == "" && filerootname != "" ){    if ( filerawname == "" && filerootname != "" ){
# Line 387  int main(int numinp, char *inps[]){ Line 415  int main(int numinp, char *inps[]){
415      // Create pamDB object and open SQL connection      // Create pamDB object and open SQL connection
416      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
417      if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n");      if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n");
418      pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,tlefilename,dwinput,staticp,gpamela);      pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,tlefilename,dwinput,staticp,gpamela,keepenv);
419      pamDB->CheckConnection();      pamDB->CheckConnection();
420      pamDB->LockTables();      pamDB->LockTables();
421      pamDB->OpenL0File(filerootname);      if ( !pamDB->IsChewbacca() ) pamDB->NotChewbacca(boot,tsync,obt0,gpamela);
422        if ( filerootname != "" ) pamDB->OpenL0File(filerootname);
423        pamDB->SetTag(tag);
424      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
425      //      //
426      //      //
427      pamDB->SetNoFrag(nofrag);      pamDB->SetNoFrag(nofrag);
428      pamDB->SetAutoBoot(autoboot);      pamDB->SetAutoBoot(autoboot);
429      pamDB->SetPedantic(pedantic);      pamDB->SetPedantic(pedantic);
430        pamDB->SetRelaxed(relaxed);
431      //      //
432      if ( remove ){      if ( remove ){
433        //-------------------------------------------------------------------------------------------        //-------------------------------------------------------------------------------------------
# Line 515  int main(int numinp, char *inps[]){ Line 546  int main(int numinp, char *inps[]){
546        //Validate runs        //Validate runs
547        //-------------------------------------------------------------------------------------------        //-------------------------------------------------------------------------------------------
548        if ( beverbose ) printf(" 11 => Validate runs (earlier than %s)\n",pamDB->GetCleanTime());        if ( beverbose ) printf(" 11 => Validate runs (earlier than %s)\n",pamDB->GetCleanTime());
549        WAR[9] = pamDB->ValidateRuns();        WAR[9] = pamDB->ValidateRuns();
550        //-------------------------------------------------------------------------------------------            //-------------------------------------------------------------------------------------------    
551      };      };
552    
# Line 541  int main(int numinp, char *inps[]){ Line 572  int main(int numinp, char *inps[]){
572      };      };
573                    
574    } catch (Int_t exc) {    } catch (Int_t exc) {
575      signal = exc;      //    signal = exc;
576        signal = 1;
577      switch(exc){      switch(exc){
578      case -1: message += " DB connection failure"; break;      case -1: message += " DB connection failure"; break;
579      case -2: message += " Connection failure"; break;      case -2: message += " Connection failure"; break;
# Line 599  int main(int numinp, char *inps[]){ Line 631  int main(int numinp, char *inps[]){
631      case -87: message += " PEDANTIC: THE RUN SHOULD HAVE ALREADY BEEN TREATED BY HANDLERUN()!"; break;      case -87: message += " PEDANTIC: THE RUN SHOULD HAVE ALREADY BEEN TREATED BY HANDLERUN()!"; break;
632      case -88: message += " PEDANTIC: INCONSISTENT PKT/OBT SEQUENCE"; break;      case -88: message += " PEDANTIC: INCONSISTENT PKT/OBT SEQUENCE"; break;
633      case -89: message += " PEDANTIC: CANNOT FIND PKT/OBT SEQUENCE IN THE POINTED FILE"; break;      case -89: message += " PEDANTIC: CANNOT FIND PKT/OBT SEQUENCE IN THE POINTED FILE"; break;
634        case -90: message += " No PhysEndRun tree in the file"; break;
635        case -91: message += " PEDANTIC: Repetition of PhysEndRun data"; break;
636        case -92: message += " CHEWBACCA: cannot find Resurs time zero used by chewbacca in the GL_RESURS_OFFSET table"; break;
637        case -100: message += " Cannot open calibration files to check repeated calibration"; break;
638      default: message += " Unidentified error"; break;      default: message += " Unidentified error"; break;
639      };      };
640      printf("\n");      printf("\n");
# Line 749  int main(int numinp, char *inps[]){ Line 785  int main(int numinp, char *inps[]){
785      printf("\n");      printf("\n");
786      printf(" WARNING(s):\n%s\n",message.Data());      printf(" WARNING(s):\n%s\n",message.Data());
787      printf("\n");      printf("\n");
788      if ( !signal ) signal = 1;      //    if ( !signal ) signal = 1;
789        if ( !signal ) signal = 255;
790    };    };
791    //    //
792    //---------------------------------------------------------------------------------------    //---------------------------------------------------------------------------------------

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.23