/[PAMELA software]/YodaProfiler/src/R2-D2.cpp
ViewVC logotype

Diff of /YodaProfiler/src/R2-D2.cpp

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

revision 1.14 by mocchiut, Mon Mar 3 15:09:40 2008 UTC revision 1.15 by mocchiut, Tue Mar 4 15:21:56 2008 UTC
# Line 40  void r2d2usage(){ Line 40  void r2d2usage(){
40    printf(" -host            name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n");    printf(" -host            name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n");
41    printf(" -user            username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n");    printf(" -user            username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n");
42    printf(" -psw             password for the DB connection [default = $PAM_DBPSW or \"\"]\n");    printf(" -psw             password for the DB connection [default = $PAM_DBPSW or \"\"]\n");
43    printf(" -splitat file    shows relationship between files around the given file\n");    printf(" -deps file       shows dependencies of the given file\n");
44      printf(" -splitat file    shows dependenices of the given file and the following files (given by -nsplit)\n");
45      printf(" -nsplit number   number of files to be shown by -splitat [default 20]\n");
46    printf(" -tzone timezone  the time zone: UTC,GMT,MSK,MSD,CET,CEST are accepted \n");    printf(" -tzone timezone  the time zone: UTC,GMT,MSK,MSD,CET,CEST are accepted \n");
47    printf(" -convert dbtime  convert the dbtime given in seconds (from the DB) to a string\n");    printf(" -convert dbtime  convert the dbtime given in seconds (from the DB) to a string\n");
48    printf(" -runat date      returns run number which contains the given date,\n");    printf(" -runat date      returns run number which contains the given date,\n");
# Line 71  int main(int numinp, char *inps[]){ Line 73  int main(int numinp, char *inps[]){
73    TString filename = "";    TString filename = "";
74    TString l2filename = "";    TString l2filename = "";
75    TString splitat = "";    TString splitat = "";
76      UInt_t nsplit = 20;
77    //    //
78    TSQLServer *dbc = 0;    TSQLServer *dbc = 0;
79    TString host = "mysql://localhost/pamelaprod";    TString host = "mysql://localhost/pamelaprod";
# Line 152  int main(int numinp, char *inps[]){ Line 155  int main(int numinp, char *inps[]){
155          };          };
156          splitat = (TString)inps[i+1];            splitat = (TString)inps[i+1];  
157        };        };
158          //
159          if ( !strcmp(inps[i],"-nsplit") ) {
160            if ( numinp-1 < i+1 ){
161              r2d2usage();
162              exit(-3);
163            };
164            nsplit = (UInt_t)atoll(inps[i+1]);      
165          };
166          if ( !strcmp(inps[i],"-deps") ) {
167            if ( numinp-1 < i+1 ){
168              r2d2usage();
169              exit(-3);
170            };
171            nsplit = 1;
172            splitat = (TString)inps[i+1];  
173          };
174        if ( !strcmp(inps[i],"-l2filename") ) {        if ( !strcmp(inps[i],"-l2filename") ) {
175          if ( numinp-1 < i+1 ){          if ( numinp-1 < i+1 ){
176            r2d2usage();            r2d2usage();
# Line 684  int main(int numinp, char *inps[]){ Line 703  int main(int numinp, char *inps[]){
703      TString NAME;      TString NAME;
704      UInt_t atime1 = 0;      UInt_t atime1 = 0;
705      UInt_t atime2 = 0;      UInt_t atime2 = 0;
706        UInt_t minid = 0;
707        UInt_t maxid = 0;
708      //          //    
709      myquery.str("");      myquery.str("");
710      myquery << " select ID,PATH,NAME from GL_ROOT where NAME>=\"" << splitat.Data() << "\" order by NAME asc limit 20;";          myquery << " select ID,PATH,NAME from GL_ROOT where NAME>=\"" << splitat.Data() << "\" order by NAME asc limit " << nsplit << ";";    
711      //    printf(" myquery is %s \n",myquery.str().c_str());      //    printf(" myquery is %s \n",myquery.str().c_str());
712      pResult = dbc->Query(myquery.str().c_str());      pResult = dbc->Query(myquery.str().c_str());
713      GL_TIMESYNC *dbtime;      GL_TIMESYNC *dbtime;
# Line 695  int main(int numinp, char *inps[]){ Line 716  int main(int numinp, char *inps[]){
716      for( r=0; r < 1000; r++){      for( r=0; r < 1000; r++){
717        Row = pResult->Next();              Row = pResult->Next();      
718        if( Row == NULL ) break;        if( Row == NULL ) break;
719          printf("\n\n#################################################\n");
720        Int_t s=0;        Int_t s=0;
721        Int_t t=0;        Int_t t=0;
722        Int_t c=0;        Int_t c=0;
# Line 706  int main(int numinp, char *inps[]){ Line 728  int main(int numinp, char *inps[]){
728        NAME = Row->GetField(2);        NAME = Row->GetField(2);
729        printf("\n FILE: %s/%s \n",PATH.Data(),NAME.Data());        printf("\n FILE: %s/%s \n",PATH.Data(),NAME.Data());
730        myquery.str("");        myquery.str("");
731        myquery << " select ID,RUNHEADER_OBT,RUNTRAILER_OBT from GL_RUN where ID_ROOT_L0=" << ID << ";";            myquery << " select ID,RUNHEADER_OBT,RUNTRAILER_OBT from GL_RUN where ID_ROOT_L0=" << ID << " order by ID;";    
732        pResult2 = dbc->Query(myquery.str().c_str());        pResult2 = dbc->Query(myquery.str().c_str());
733        for( Int_t run=0; run < pResult2->GetRowCount(); run++){        for( Int_t run=0; run < pResult2->GetRowCount(); run++){  
734          Row2 = pResult2->Next();                Row2 = pResult2->Next();      
735          if( Row2 == NULL ) break;          if( Row2 == NULL ) break;
736          IDR = atoi(Row2->GetField(0));          IDR = atoi(Row2->GetField(0));
737            if ( run == 0 ) minid = IDR;
738            if ( run == pResult2->GetRowCount()-1 ) maxid = IDR;
739          //          //
740          // here we make queries to DB looking for needed files and print results          // here we make queries to DB looking for needed files and print results
741          //          //
# Line 928  int main(int numinp, char *inps[]){ Line 952  int main(int numinp, char *inps[]){
952          printf(" %s",cfiles[f]->Data());          printf(" %s",cfiles[f]->Data());
953          delete cfiles[f];          delete cfiles[f];
954        };              };      
955        printf("\n\n#################################################\n");        printf("\n\n");
956          printf(" Minimum ID number in the file: %u \n",minid);
957          printf(" Maximum ID number in the file: %u \n",maxid);
958          printf("\n#################################################\n");
959        //        //
960      };      };
961      delete pResult;        delete pResult;  

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.23