Logo ROOT  
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
27class TMacro;
28class TProofLogElem;
29class TProofMgr;
30
31
32class TProofLog : public TNamed, public TQObject {
33
34friend class TProofLogElem;
35friend class TProofMgrLite;
36friend class TXProofMgr;
37
38private:
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
46public:
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
79class TProofLogElem : public TNamed {
80
81private:
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
94public:
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
112 static void SetMaxTransferSize(Long64_t maxsz);
113
114 ClassDef(TProofLogElem,0) // PROOF session log element
115};
116
117#endif
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
bool Bool_t
Definition: RtypesCore.h:61
long long Long64_t
Definition: RtypesCore.h:71
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:322
#define BIT(n)
Definition: Rtypes.h:83
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:37
A doubly linked list.
Definition: TList.h:44
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
static Long64_t fgMaxTransferSize
Definition: TProofLog.h:89
TMacro * GetMacro() const
Definition: TProofLog.h:100
static Long64_t GetMaxTransferSize()
Get max transfer size.
Definition: TProofLog.cxx:351
Long64_t fFrom
Definition: TProofLog.h:85
Int_t Grep(const char *txt, TString &res, Int_t from=0)
Search lines containing 'txt', starting from line 'from'.
Definition: TProofLog.cxx:559
Bool_t IsWorker() const
Definition: TProofLog.h:105
Long64_t fTo
Definition: TProofLog.h:86
void Print(Option_t *opt=0) const
Print a line with the relevant info.
Definition: TProofLog.cxx:536
TProofLogElem(const char *ord, const char *url, TProofLog *logger)
Constructor.
Definition: TProofLog.cxx:318
Long64_t fSize
Definition: TProofLog.h:84
TMacro * fMacro
Definition: TProofLog.h:83
Int_t Retrieve(TProofLog::ERetrieveOpt opt=TProofLog::kTrailing, const char *pattern=0)
Retrieve the content of the associated file.
Definition: TProofLog.cxx:374
TString fRole
Definition: TProofLog.h:87
const char * GetRole()
Definition: TProofLog.h:101
void Display(Int_t from=0, Int_t to=-1)
Display the current content starting from line 'from' to line 'to' inclusive.
Definition: TProofLog.cxx:467
virtual ~TProofLogElem()
Destructor.
Definition: TProofLog.cxx:343
static void SetMaxTransferSize(Long64_t maxsz)
Set max transfer size.
Definition: TProofLog.cxx:359
Bool_t IsMaster() const
Definition: TProofLog.h:103
TProofLog * fLogger
Definition: TProofLog.h:82
Bool_t IsSubMaster() const
Definition: TProofLog.h:104
void Prt(const char *what)
Special printing procedure.
Definition: TProofLog.cxx:548
Implementation of the PROOF session log handler.
Definition: TProofLog.h:32
TProofLogElem * Add(const char *ord, const char *url)
Add new entry to the list of elements.
Definition: TProofLog.cxx:67
TList * fElem
Definition: TProofLog.h:41
void Print(Option_t *opt=0) const
Print head info about the content.
Definition: TProofLog.cxx:158
static void SetMaxTransferSize(Long64_t maxsz)
Set max transfer size.
Definition: TProofLog.cxx:304
void Prt(const char *what, Bool_t newline=kTRUE)
Special printing procedure.
Definition: TProofLog.cxx:181
Int_t Grep(const char *txt, Int_t from=0)
Search lines containing 'txt', starting from line 'from'.
Definition: TProofLog.cxx:261
TProofMgr * fMgr
Definition: TProofLog.h:39
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
TProofLog(const char *stag, const char *url, TProofMgr *mgr)
Constructor.
Definition: TProofLog.cxx:31
TDatime StartTime()
Definition: TProofLog.h:67
TDatime fStartTime
Definition: TProofLog.h:42
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
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
virtual ~TProofLog()
Destructor.
Definition: TProofLog.cxx:59
Bool_t LogToBox()
Definition: TProofLog.h:71
@ kLeading
Definition: TProofLog.h:51
@ kTrailing
Definition: TProofLog.h:51
TList * GetListOfLogs() const
Definition: TProofLog.h:58
void SetLogToBox(Bool_t lgbox=kFALSE)
Definition: TProofLog.h:70
ELogLocationBit
Definition: TProofLog.h:48
@ kLogToBox
Definition: TProofLog.h:49
void * fFILE
Definition: TProofLog.h:40
Basic TProofMgr functionality implementation in the case of Lite session.
Definition: TProofMgrLite.h:27
The PROOF manager interacts with the PROOF server coordinator to create or destroy a PROOF session,...
Definition: TProofMgr.h:43
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition: TQObject.h:48
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
Implementation of the functionality provided by TProofMgr in the case of a xproofd-based session.
Definition: TXProofMgr.h:40
static const std::string pattern("pattern")
static const char * what
Definition: stlLoader.cc:6