Logo ROOT   6.14/05
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 #include "TDatime.h"
24 #include "TNamed.h"
25 #include "TQObject.h"
26 
27 class TMacro;
28 class TProofLogElem;
29 class TProofMgr;
30 
31 
32 class TProofLog : public TNamed, public TQObject {
33 
34 friend class TProofLogElem;
35 friend class TProofMgrLite;
36 friend class TXProofMgr;
37 
38 private:
39  TProofMgr *fMgr; // parent TProofMgr
40  void *fFILE; // pointer logging file, if any
41  TList *fElem; // list of TProofLogElem objects
42  TDatime fStartTime; // Time at which this session started
43 
44  TProofLogElem *Add(const char *ord, const char *url);
45 
46 public:
47  // Screen or GUI box logging
49  kLogToBox = BIT(16)
50  };
51  enum ERetrieveOpt { kLeading = 0x1, kTrailing = 0x2,
52  kAll = 0x3, kGrep = 0x4 };
53 
54  TProofLog(const char *stag, const char *url, TProofMgr *mgr);
55  virtual ~TProofLog();
56 
57  void Display(const char *ord = "*", Int_t from = -10, Int_t to = -1);
58  TList *GetListOfLogs() const { return fElem; }
59  Int_t Grep(const char *txt, Int_t from = 0);
60  void Print(Option_t *opt = 0) const;
61  void Prt(const char *what, Bool_t newline = kTRUE);
62  Int_t Retrieve(const char *ord = "*",
64  const char *fname = 0, const char *pattern = 0);
65  Int_t Save(const char *ord = "*", const char *fname = 0, Option_t *opt="w");
66 
68 
69  // Where to log
70  void SetLogToBox(Bool_t lgbox = kFALSE) { SetBit(kLogToBox, lgbox); }
72 
73  static void SetMaxTransferSize(Long64_t maxsz);
74 
75  ClassDef(TProofLog,0) // PROOF session log handler
76 };
77 
78 
79 class TProofLogElem : public TNamed {
80 
81 private:
82  TProofLog *fLogger; // parent TProofLog
83  TMacro *fMacro; // container for the log lines
84  Long64_t fSize; // best knowledge of the log file size
85  Long64_t fFrom; // starting offset of the current content
86  Long64_t fTo; // end offset of the current content
87  TString fRole; // role (master-submaster-worker)
88 
90 
91  //the name of TProofLogElem is the ordinal number of the corresp. worker
92  //the title is the url
93 
94 public:
95  TProofLogElem(const char *ord, const char *url,
96  TProofLog *logger);
97  virtual ~TProofLogElem();
98 
99  void Display(Int_t from = 0, Int_t to = -1);
100  TMacro *GetMacro() const { return fMacro; }
101  const char * GetRole() { return fRole.Data(); }
102  Int_t Grep(const char *txt, TString &res, Int_t from = 0);
103  Bool_t IsMaster() const { return (fRole == "master") ? kTRUE : kFALSE; }
104  Bool_t IsSubMaster() const { return (fRole == "submaster") ? kTRUE : kFALSE; }
105  Bool_t IsWorker() const { return (fRole == "worker") ? kTRUE : kFALSE; }
106  void Print(Option_t *opt = 0) const;
107  void Prt(const char *what);
109  const char *pattern = 0);
110 
111  static Long64_t GetMaxTransferSize();
112  static void SetMaxTransferSize(Long64_t maxsz);
113 
114  ClassDef(TProofLogElem,0) // PROOF session log element
115 };
116 
117 #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
Bool_t IsSubMaster() const
Definition: TProofLog.h:104
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:89
#define BIT(n)
Definition: Rtypes.h:78
The PROOF manager interacts with the PROOF server coordinator to create or destroy a PROOF session...
Definition: TProofMgr.h:43
Bool_t LogToBox()
Definition: TProofLog.h:71
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:49
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TString fRole
Definition: TProofLog.h:87
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
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
void SetLogToBox(Bool_t lgbox=kFALSE)
Definition: TProofLog.h:70
TProofLog * fLogger
Definition: TProofLog.h:82
#define ClassDef(name, id)
Definition: Rtypes.h:320
void * fFILE
Definition: TProofLog.h:40
Basic TProofMgr functionality implementation in the case of Lite session.
Definition: TProofMgrLite.h:27
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Bool_t IsMaster() const
Definition: TProofLog.h:103
TMacro * GetMacro() const
Definition: TProofLog.h:100
A doubly linked list.
Definition: TList.h:44
TMacro * fMacro
Definition: TProofLog.h:83
Long64_t fFrom
Definition: TProofLog.h:85
Bool_t IsWorker() const
Definition: TProofLog.h:105
const char * GetRole()
Definition: TProofLog.h:101
Long64_t fTo
Definition: TProofLog.h:86
Implementation of the functionality provided by TProofMgr in the case of a xproofd-based session...
Definition: TXProofMgr.h:40
const Bool_t kFALSE
Definition: RtypesCore.h:88
TList * GetListOfLogs() const
Definition: TProofLog.h:58
Long64_t fSize
Definition: TProofLog.h:84
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:42
friend class TProofLogElem
Definition: TProofLog.h:34
void Print(Option_t *opt=0) const
Print head info about the content.
Definition: TProofLog.cxx:158
TProofMgr * fMgr
Definition: TProofLog.h:39
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:67
ELogLocationBit
Definition: TProofLog.h:48
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: RtypesCore.h:87
TList * fElem
Definition: TProofLog.h:41
Implementation of the PROOF session log handler.
Definition: TProofLog.h:32
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:37
const char * Data() const
Definition: TString.h:364
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