Logo ROOT   6.07/09
Reference Guide
TProofLog.h
Go to the documentation of this file.
1 // @(#)root/proof:$Id: 5d579564fccbadad9cd6f81ccb7726dddea80e0d $
2 // Author: G. Ganis 31/08/06
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TProofLog
13 #define ROOT_TProofLog
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TProofLog //
18 // //
19 // Implementation of the PROOF session log handler //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #ifndef ROOT_TDatime
24 #include "TDatime.h"
25 #endif
26 #ifndef ROOT_TNamed
27 #include "TNamed.h"
28 #endif
29 #ifndef ROOT_TQObject
30 #include "TQObject.h"
31 #endif
32 
33 class TMacro;
34 class TProofLogElem;
35 class TProofMgr;
36 
37 
38 class TProofLog : public TNamed, public TQObject {
39 
40 friend class TProofLogElem;
41 friend class TProofMgrLite;
42 friend class TXProofMgr;
43 
44 private:
45  TProofMgr *fMgr; // parent TProofMgr
46  void *fFILE; // pointer logging file, if any
47  TList *fElem; // list of TProofLogElem objects
48  TDatime fStartTime; // Time at which this session started
49 
50  TProofLogElem *Add(const char *ord, const char *url);
51 
52 public:
53  // Screen or GUI box logging
55  kLogToBox = BIT(16)
56  };
57  enum ERetrieveOpt { kLeading = 0x1, kTrailing = 0x2,
58  kAll = 0x3, kGrep = 0x4 };
59 
60  TProofLog(const char *stag, const char *url, TProofMgr *mgr);
61  virtual ~TProofLog();
62 
63  void Display(const char *ord = "*", Int_t from = -10, Int_t to = -1);
64  TList *GetListOfLogs() const { return fElem; }
65  Int_t Grep(const char *txt, Int_t from = 0);
66  void Print(Option_t *opt = 0) const;
67  void Prt(const char *what, Bool_t newline = kTRUE);
68  Int_t Retrieve(const char *ord = "*",
70  const char *fname = 0, const char *pattern = 0);
71  Int_t Save(const char *ord = "*", const char *fname = 0, Option_t *opt="w");
72 
74 
75  // Where to log
76  void SetLogToBox(Bool_t lgbox = kFALSE) { SetBit(kLogToBox, lgbox); }
78 
79  static void SetMaxTransferSize(Long64_t maxsz);
80 
81  ClassDef(TProofLog,0) // PROOF session log handler
82 };
83 
84 
85 class TProofLogElem : public TNamed {
86 
87 private:
88  TProofLog *fLogger; // parent TProofLog
89  TMacro *fMacro; // container for the log lines
90  Long64_t fSize; // best knowledge of the log file size
91  Long64_t fFrom; // starting offset of the current content
92  Long64_t fTo; // end offset of the current content
93  TString fRole; // role (master-submaster-worker)
94 
96 
97  //the name of TProofLogElem is the ordinal number of the corresp. worker
98  //the title is the url
99 
100 public:
101  TProofLogElem(const char *ord, const char *url,
102  TProofLog *logger);
103  virtual ~TProofLogElem();
104 
105  void Display(Int_t from = 0, Int_t to = -1);
106  TMacro *GetMacro() const { return fMacro; }
107  const char * GetRole() { return fRole.Data(); }
108  Int_t Grep(const char *txt, TString &res, Int_t from = 0);
109  Bool_t IsMaster() const { return (fRole == "master") ? kTRUE : kFALSE; }
110  Bool_t IsSubMaster() const { return (fRole == "submaster") ? kTRUE : kFALSE; }
111  Bool_t IsWorker() const { return (fRole == "worker") ? kTRUE : kFALSE; }
112  void Print(Option_t *opt = 0) const;
113  void Prt(const char *what);
115  const char *pattern = 0);
116 
117  static Long64_t GetMaxTransferSize();
118  static void SetMaxTransferSize(Long64_t maxsz);
119 
120  ClassDef(TProofLogElem,0) // PROOF session log element
121 };
122 
123 #endif
void Prt(const char *what, Bool_t newline=kTRUE)
Special printing procedure.
Definition: TProofLog.cxx:181
long long Long64_t
Definition: RtypesCore.h:69
static void SetMaxTransferSize(Long64_t maxsz)
Set max transfer size.
Definition: TProofLog.cxx:304
const char Option_t
Definition: RtypesCore.h:62
static Long64_t fgMaxTransferSize
Definition: TProofLog.h:95
The PROOF manager interacts with the PROOF server coordinator to create or destroy a PROOF session...
Definition: TProofMgr.h:53
Bool_t LogToBox()
Definition: TProofLog.h:77
virtual ~TProofLog()
Destructor.
Definition: TProofLog.cxx:59
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:53
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:33
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
void Print(Option_t *opt=0) const
Print head info about the content.
Definition: TProofLog.cxx:158
TString fRole
Definition: TProofLog.h:93
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:739
void Display(const char *ord="*", Int_t from=-10, Int_t to=-1)
Display the content associated with worker 'ord' from line 'from' to line 'to' inclusive.
Definition: TProofLog.cxx:131
const char * Data() const
Definition: TString.h:349
TList * GetListOfLogs() const
Definition: TProofLog.h:64
TMacro * GetMacro() const
Definition: TProofLog.h:106
void SetLogToBox(Bool_t lgbox=kFALSE)
Definition: TProofLog.h:76
TProofLog * fLogger
Definition: TProofLog.h:88
#define ClassDef(name, id)
Definition: Rtypes.h:254
void * fFILE
Definition: TProofLog.h:46
Basic TProofMgr functionality implementation in the case of Lite session.
Definition: TProofMgrLite.h:31
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
Bool_t IsWorker() const
Definition: TProofLog.h:111
static const std::string pattern("pattern")
A doubly linked list.
Definition: TList.h:47
static const char * what
Definition: stlLoader.cc:6
TMacro * fMacro
Definition: TProofLog.h:89
Long64_t fFrom
Definition: TProofLog.h:91
Bool_t IsSubMaster() const
Definition: TProofLog.h:110
const char * GetRole()
Definition: TProofLog.h:107
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:159
Long64_t fTo
Definition: TProofLog.h:92
Implementation of the functionality provided by TProofMgr in the case of a xproofd-based session...
Definition: TXProofMgr.h:46
Long64_t fSize
Definition: TProofLog.h:90
Int_t Grep(const char *txt, Int_t from=0)
Search lines containing 'txt', starting from line 'from'.
Definition: TProofLog.cxx:261
TDatime fStartTime
Definition: TProofLog.h:48
friend class TProofLogElem
Definition: TProofLog.h:40
#define BIT(n)
Definition: Rtypes.h:120
TProofMgr * fMgr
Definition: TProofLog.h:45
TProofLogElem * Add(const char *ord, const char *url)
Add new entry to the list of elements.
Definition: TProofLog.cxx:67
TDatime StartTime()
Definition: TProofLog.h:73
ELogLocationBit
Definition: TProofLog.h:54
Int_t Save(const char *ord="*", const char *fname=0, Option_t *opt="w")
Save the content associated with worker 'ord' to finel 'fname'.
Definition: TProofLog.cxx:201
TProofLog(const char *stag, const char *url, TProofMgr *mgr)
Constructor.
Definition: TProofLog.cxx:31
const Bool_t kTRUE
Definition: Rtypes.h:91
Bool_t IsMaster() const
Definition: TProofLog.h:109
TList * fElem
Definition: TProofLog.h:47
Implementation of the PROOF session log handler.
Definition: TProofLog.h:38
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:39
Int_t Retrieve(const char *ord="*", TProofLog::ERetrieveOpt opt=TProofLog::kTrailing, const char *fname=0, const char *pattern=0)
Retrieve the content of the log file associated with worker 'ord'.
Definition: TProofLog.cxx:87