88 const char *fname,
const char *pattern)
92 Error(
"Retrieve",
"option 'Grep' requires a pattern");
100 Int_t nd = 0, nb = 0;
103 if (ord[0] ==
'*' || !strcmp(ord, ple->
GetName())) {
104 if (ple->
Retrieve(opt, pattern) != 0) {
110 msg.
Form(
"Retrieving logs: %d ok, %d not ok (%.0f%% processed)\r", nd, nb, frac);
137 msg.
Form(
"\n// --------- Displaying PROOF Session logs --------\n"
138 "// Server: %s \n// Session: %s \n// # of elements: %d \n"
139 "// ------------------------------------------------\n\n",
147 if (ord[0] ==
'*' || !strcmp(ord, ple->
GetName()))
152 Prt(
"// --------- End of PROOF Session logs ---------\n");
162 fprintf(stderr,
"// --------- PROOF Session logs object --------\n");
163 fprintf(stderr,
"// Server: %s \n",
GetTitle());
164 fprintf(stderr,
"// Session: %s \n",
GetName());
165 fprintf(stderr,
"// # of elements: %d \n", nel);
166 fprintf(stderr,
"// --------------------------------------------\n");
175 fprintf(stderr,
"// --------------------------------------------\n");
188 FILE *where = (
fFILE) ? (FILE *)
fFILE : stderr;
190 if (newline) fputc(
'\n', where);
205 Warning(
"Save",
"filename undefined - do nothing");
215 fout = fopen(fname,
"a");
217 fout = fopen(fname,
"w");
220 Warning(
"Save",
"file could not be opened - do nothing");
223 fFILE = (
void *) fout;
229 msg.
Form(
"\n// --------- Displaying PROOF Session logs --------\n"
230 "// Server: %s \n// Session: %s \n// # of elements: %d \n"
231 "// ------------------------------------------------\n\n",
240 if (ord[0] ==
'*' || !strcmp(ord, ple->
GetName()))
246 Prt(
"// --------- End of PROOF Session logs ---------\n");
263 if (!txt || strlen(txt) <= 0) {
264 Warning(
"Grep",
"text to be searched for is undefined - do nothing");
271 msg.
Form(
"\n// --------- Search in PROOF Session logs --------\n"
272 "// Server: %s \n// Session: %s \n// # of elements: %d \n"
276 msg.
Form(
"// starting from line %d \n", from);
281 Prt(
"// ------------------------------------------------\n");
295 Prt(
"// ------------------------------------------------\n");
329 if (strstr(
GetTitle(),
"worker-")) {
378 Warning(
"Retrieve",
"No reference manager: corruption?");
384 Info(
"Retrieve",
"Retrieving from ordinal %s file %s with pattern %s",
394 Info(
"Retrieve",
"Retrieving the whole file");
400 Info(
"Retrieve",
"Retrieving the leading %lld lines of file",
fTo);
403 if (!pattern || strlen(pattern) <= 0) {
404 Error(
"Retrieve",
"option 'Grep' requires a pattern");
408 Info(
"Retrieve",
"Retrieving only lines filtered with %s", pattern);
414 Info(
"Retrieve",
"Retrieving the last %lld lines of file", -
fFrom);
428 if (fileName.
Contains(
"__igprof.pp__")) {
431 Info(
"Retrieve",
"Retrieving analyzed IgProf performance profile");
433 "|( T=`mktemp` && cat > \"$T\" ; igprof-analyse -d -g \"$T\" ; rm -f \"$T\" )";
434 if (pattern && (*pattern ==
'|'))
435 analyzeAndFilter.
Append(pattern);
474 Int_t ie = (to > -1 && to < nls) ? to : nls;
478 }
else if (from < 0) {
486 Prt(
"// --------- Start of element log -----------------\n");
496 msg.
Form(
"// Submaster: %s \n", subm.
Data());
499 msg.
Form(
"// Path: %s \n// # of retrieved lines: %d ", path.
Data(), nls);
501 if (i > 0 || ie < nls) {
502 msg.
Form(
"(displaying lines: %d -> %d)\n", i+1, ie);
507 Prt(
"// ------------------------------------------------\n");
517 if (msg.
Length() < 100000) {
518 if (msg.
Length() > 0) msg +=
"\n";
530 Prt(
"// --------- End of element log -------------------\n\n");
540 const char *role = (strstr(
GetTitle(),
"worker-")) ?
"worker" :
"master";
542 fprintf(stderr,
"Ord: %s Host: Role: %s lines: %d\n",
GetName(), role, nls);
565 Int_t i = (from > 0) ? (from - 1) : 0;
566 for( ; i < nls; i++) {
569 if (strstr(os->
GetName(), txt)) {
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
void Set()
Set Date/Time to current time as reported by the system.
virtual void Add(TObject *obj)
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Class supporting a collection of lines with C++ code.
virtual TObjString * AddLine(const char *text)
Add line with text in the list of lines of this macro.
TList * GetListOfLines() const
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Collectable string class.
const char * GetName() const
Returns name of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
static Long64_t fgMaxTransferSize
static Long64_t GetMaxTransferSize()
Get max transfer size.
Int_t Grep(const char *txt, TString &res, Int_t from=0)
Search lines containing 'txt', starting from line 'from'.
void Print(Option_t *opt=0) const
Print a line with the relevant info.
TProofLogElem(const char *ord, const char *url, TProofLog *logger)
Constructor.
Int_t Retrieve(TProofLog::ERetrieveOpt opt=TProofLog::kTrailing, const char *pattern=0)
Retrieve the content of the associated file.
void Display(Int_t from=0, Int_t to=-1)
Display the current content starting from line 'from' to line 'to' inclusive.
virtual ~TProofLogElem()
Destructor.
static void SetMaxTransferSize(Long64_t maxsz)
Set max transfer size.
void Prt(const char *what)
Special printing procedure.
Implementation of the PROOF session log handler.
TProofLogElem * Add(const char *ord, const char *url)
Add new entry to the list of elements.
void Print(Option_t *opt=0) const
Print head info about the content.
static void SetMaxTransferSize(Long64_t maxsz)
Set max transfer size.
void Prt(const char *what, Bool_t newline=kTRUE)
Special printing procedure.
Int_t Grep(const char *txt, Int_t from=0)
Search lines containing 'txt', starting from line 'from'.
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.
TProofLog(const char *stag, const char *url, TProofMgr *mgr)
Constructor.
Int_t Save(const char *ord="*", const char *fname=0, Option_t *opt="w")
Save the content associated with worker 'ord' to finel 'fname'.
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'.
friend class TProofLogElem
virtual ~TProofLog()
Destructor.
void SetLogToBox(Bool_t lgbox=kFALSE)
The PROOF manager interacts with the PROOF server coordinator to create or destroy a PROOF session,...
virtual Bool_t IsValid() const
virtual TObjString * ReadBuffer(const char *, Long64_t, Int_t)
void EmitVA(const char *signal_name, Int_t, const T &... params)
Emit a signal with a varying number of arguments.
void ToLower()
Change string to lower-case.
Int_t Atoi() const
Return integer value of string.
const char * Data() const
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const