ROOT logo
// @(#)root/proofx:$Id: TProofBench.h 41635 2011-10-28 15:02:31Z ganis $
// Author: G.Ganis, S.Ryu Feb 2011

/*************************************************************************
 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TProofBench
#define ROOT_TProofBench

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TProofBench                                                          //
//                                                                      //
// Steering class for PROOF benchmarks                                  //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TProofBenchTypes
#include "TProofBenchTypes.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif


class TFile;
class TProof;
class TProofBenchRunCPU;
class TProofBenchRunDataRead;
class TProofBenchDataSet;

class TProofBench : public TObject {

private:
   Bool_t  fUnlinkOutfile;       // Whether to remove empty output files

protected:

   TProof* fProof;               // Proof
   TProof* fProofDS;             // Proof to be used for dataset actions
   TFile  *fOutFile;             // Output file
   TString fOutFileName;         // Name of the output file
   Int_t   fNtries;              // Number of times a measurement is repeated
   TPBHistType *fHistType;       // Type of histograms for CPU runs
   Int_t   fNHist;               // Number of histograms to be created in default CPU runs
   TPBReadType *fReadType;       // Type of read (partial, full)
   TString fDataSet;             // Name of the dataset
   Int_t   fNFilesWrk;           // Number of files generated files per worker

   TString fCPUSel;              // Selector to be used for CPU benchmarks
   TString fCPUPar;              // List of par files to be loaded for CPU benchmarks
   TString fDataSel;             // Selector to be used for data benchmarks
   TString fDataPar;             // List of par files to be loaded for data benchmarks
   TString fDataGenSel;          // Selector to be used for generate data for benchmarks
   TString fDataGenPar;          // List of par files to be loaded to generate data for benchmarks

   TProofBenchRunCPU      *fRunCPU; // Instance to run CPU scans
   TProofBenchRunDataRead *fRunDS;  // Instance to run data-read scans
   TProofBenchDataSet     *fDS;     // Instance to handle datasets operations

   Bool_t fDebug;                // Debug switch

public:

   TProofBench(const char *url, const char *outfile = "<default>", const char *proofopt = 0);

   virtual ~TProofBench();

   Int_t RunCPU(Long64_t nevents=-1, Int_t start=-1, Int_t stop=-1, Int_t step=-1);
   Int_t RunCPUx(Long64_t nevents=-1, Int_t start=-1, Int_t stop=-1);
   Int_t RunDataSet(const char *dset = "BenchDataSet",
                    Int_t start = 1, Int_t stop = -1, Int_t step = 1);
   Int_t RunDataSetx(const char *dset = "BenchDataSet", Int_t start = 1, Int_t stop = -1);

   Int_t CopyDataSet(const char *dset, const char *dsetdst, const char *destdir);
   Int_t MakeDataSet(const char *dset = 0, Long64_t nevt = -1, const char *fnroot = "event",
                     Bool_t regenerate = kFALSE);
   Int_t ReleaseCache(const char *dset);
   Int_t RemoveDataSet(const char *dset);
                    
   void  CloseOutFile();
   Int_t OpenOutFile(Bool_t wrt = kFALSE, Bool_t verbose = kTRUE);
   Int_t SetOutFile(const char *outfile, Bool_t verbose = kTRUE);
   const char *GetOutFileName() const { return fOutFileName; }
   void  SetNFilesWrk(Int_t nf = 0) { fNFilesWrk = (nf > 0) ? nf : 4; }
   void  SetNTries(Int_t nt) { if (nt > 0) fNtries = nt; }
   void  SetHistType(TPBHistType *histtype) { fHistType = histtype; }
   void  SetNHist(Int_t nh) { fNHist = nh; }
   void  SetReadType(TPBReadType *readtype) { fReadType = readtype; }

   void  SetCPUSel(const char *sel) { fCPUSel = sel; }
   void  SetCPUPar(const char *par) { fCPUPar = par; }
   void  SetDataSel(const char *sel) { fDataSel = sel; }
   void  SetDataPar(const char *par) { fDataPar = par; }
   void  SetDataGenSel(const char *sel) { fDataGenSel = sel; }
   void  SetDataGenPar(const char *par) { fDataGenPar = par; }

   void  SetProofDS(TProof *p);

   void  SetDebug(Bool_t debug = kTRUE) { fDebug = debug; }

   Bool_t GetDebug() { return fDebug; }

   static void DrawCPU(const char *outfile, const char *opt = "std:");
   static void DrawDataSet(const char *outfile, const char *opt = "std:", const char *type = "mbs");

   ClassDef(TProofBench, 0)   // Steering class for PROOF benchmarks
};

#endif
 TProofBench.h:1
 TProofBench.h:2
 TProofBench.h:3
 TProofBench.h:4
 TProofBench.h:5
 TProofBench.h:6
 TProofBench.h:7
 TProofBench.h:8
 TProofBench.h:9
 TProofBench.h:10
 TProofBench.h:11
 TProofBench.h:12
 TProofBench.h:13
 TProofBench.h:14
 TProofBench.h:15
 TProofBench.h:16
 TProofBench.h:17
 TProofBench.h:18
 TProofBench.h:19
 TProofBench.h:20
 TProofBench.h:21
 TProofBench.h:22
 TProofBench.h:23
 TProofBench.h:24
 TProofBench.h:25
 TProofBench.h:26
 TProofBench.h:27
 TProofBench.h:28
 TProofBench.h:29
 TProofBench.h:30
 TProofBench.h:31
 TProofBench.h:32
 TProofBench.h:33
 TProofBench.h:34
 TProofBench.h:35
 TProofBench.h:36
 TProofBench.h:37
 TProofBench.h:38
 TProofBench.h:39
 TProofBench.h:40
 TProofBench.h:41
 TProofBench.h:42
 TProofBench.h:43
 TProofBench.h:44
 TProofBench.h:45
 TProofBench.h:46
 TProofBench.h:47
 TProofBench.h:48
 TProofBench.h:49
 TProofBench.h:50
 TProofBench.h:51
 TProofBench.h:52
 TProofBench.h:53
 TProofBench.h:54
 TProofBench.h:55
 TProofBench.h:56
 TProofBench.h:57
 TProofBench.h:58
 TProofBench.h:59
 TProofBench.h:60
 TProofBench.h:61
 TProofBench.h:62
 TProofBench.h:63
 TProofBench.h:64
 TProofBench.h:65
 TProofBench.h:66
 TProofBench.h:67
 TProofBench.h:68
 TProofBench.h:69
 TProofBench.h:70
 TProofBench.h:71
 TProofBench.h:72
 TProofBench.h:73
 TProofBench.h:74
 TProofBench.h:75
 TProofBench.h:76
 TProofBench.h:77
 TProofBench.h:78
 TProofBench.h:79
 TProofBench.h:80
 TProofBench.h:81
 TProofBench.h:82
 TProofBench.h:83
 TProofBench.h:84
 TProofBench.h:85
 TProofBench.h:86
 TProofBench.h:87
 TProofBench.h:88
 TProofBench.h:89
 TProofBench.h:90
 TProofBench.h:91
 TProofBench.h:92
 TProofBench.h:93
 TProofBench.h:94
 TProofBench.h:95
 TProofBench.h:96
 TProofBench.h:97
 TProofBench.h:98
 TProofBench.h:99
 TProofBench.h:100
 TProofBench.h:101
 TProofBench.h:102
 TProofBench.h:103
 TProofBench.h:104
 TProofBench.h:105
 TProofBench.h:106
 TProofBench.h:107
 TProofBench.h:108
 TProofBench.h:109
 TProofBench.h:110
 TProofBench.h:111
 TProofBench.h:112
 TProofBench.h:113
 TProofBench.h:114
 TProofBench.h:115
 TProofBench.h:116
 TProofBench.h:117
 TProofBench.h:118