Logo ROOT  
Reference Guide
TProofMonSender.cxx
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: G.Ganis July 2011
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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 
13 /** \class TProofMonSender
14 \ingroup proofkernel
15 
16 Provides the interface for PROOF monitoring to different writers.
17 Allows to decouple the information sent from the backend.
18 
19 */
20 
21 #include "TProofDebug.h"
22 #include "TProofMonSender.h"
23 
24 ////////////////////////////////////////////////////////////////////////////////
25 /// Parse send options from string 'sendopts'.
26 /// Format is:
27 /// "[-,+]S[n]|[-,+]D[m]|[-,+]F[j]"
28 /// where:
29 /// 1. The big letter refers to the 'table' following
30 ///
31 /// S table with summary log
32 /// D table with dataset info
33 /// F table files info
34 ///
35 /// 2. The '-,+' in front disables/enables the related table; if
36 /// absent '+' is assumed
37 ///
38 /// 3. The number after the letter is the version of the related
39 /// table
40 ///
41 /// Returns -1 if nothing is enabled; 0 otherwise
42 
44 {
45 
46  // Must have something to parse
47  if (sendopts && strlen(sendopts) > 0) {
48 
49  PDB(kMonitoring,1) Info("SetSendOptions", "sendopts: '%s'", sendopts);
50 
51  Bool_t doit = kTRUE;
52  Char_t t = 0;
53  Int_t v = -1;
54  TString oos(sendopts), oo;
55  Ssiz_t from = 0;
56  while (oos.Tokenize(oo, from, ":")) {
57  PDB(kMonitoring,2) Info("SetSendOptions", "oo: '%s'", oo.Data());
58  // Parse info
59  doit = kTRUE;
60  if (oo.BeginsWith("+")) oo.Remove(0,1);
61  if (oo.BeginsWith("-")) { doit = kFALSE; oo.Remove(0,1); }
62  PDB(kMonitoring,2) Info("SetSendOptions", "oo: '%s' doit:%d", oo.Data(), doit);
63  t = oo[0];
64  oo.Remove(0,1);
65  PDB(kMonitoring,2) Info("SetSendOptions", "oo: '%s' doit:%d t:'%c'", oo.Data(), doit, t);
66  v = -1;
67  if (!oo.IsNull() && oo.IsDigit()) v = oo.Atoi();
68  PDB(kMonitoring,2) Info("SetSendOptions", "oo: '%s' doit:%d t:'%c' v:%d", oo.Data(), doit, t, v);
69  // Fill relevant variables
71  if (t == 'D') cbit = kSendDataSetInfo;
72  if (t == 'F') cbit = kSendFileInfo;
73  if (doit)
74  SetBit(cbit);
75  else
76  ResetBit(cbit);
77  if (v > -1) {
78  if (t == 'S') fSummaryVrs = v;
79  if (t == 'D') fDataSetInfoVrs = v;
80  if (t == 'F') fFileInfoVrs = v;
81  }
82  }
83  }
84 
85  // Something must be enabled
87  Warning("SetSendOptions", "all tables are disabled!");
88  return -1;
89  }
90 
91  // Notify
92  TString snot = TString::Format("%s: sending:", GetTitle());
93  if (TestBit(kSendSummary)) snot += TString::Format(" 'summary' (v:%d)", fSummaryVrs);
94  if (TestBit(kSendDataSetInfo)) snot += TString::Format(" 'dataset info' (v:%d)", fDataSetInfoVrs);
95  if (TestBit(kSendFileInfo)) snot += TString::Format(" 'file info' (v:%d)", fFileInfoVrs);
96  Info("SetSendOptions", "%s", snot.Data());
97 
98  // Done
99  return 0;
100 }
101 
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
PDB
#define PDB(mask, level)
Definition: TProofDebug.h:56
TProofMonSender.h
TString::Atoi
Int_t Atoi() const
Return integer value of string.
Definition: TString.cxx:1921
TString::Data
const char * Data() const
Definition: TString.h:369
TProofDebug.h
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:54
TObject::Info
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:864
TProofMonSender::kSendSummary
@ kSendSummary
Definition: TProofMonSender.h:37
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2311
TString
Definition: TString.h:136
v
@ v
Definition: rootcling_impl.cxx:3635
bool
TProofMonSender::fDataSetInfoVrs
Int_t fDataSetInfoVrs
Definition: TProofMonSender.h:34
Outer::doit
void doit(Template< T, U > arg)
Simply templated function.
TProofMonSender::EConfigBits
EConfigBits
Definition: TProofMonSender.h:36
TObject::ResetBit
void ResetBit(UInt_t f)
Definition: TObject.h:171
TProofMonSender::kSendFileInfo
@ kSendFileInfo
Definition: TProofMonSender.h:39
TObject::SetBit
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
TString::Remove
TString & Remove(Ssiz_t pos)
Definition: TString.h:673
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TString::BeginsWith
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:615
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:876
TString::IsDigit
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Definition: TString.cxx:1763
TString::IsNull
Bool_t IsNull() const
Definition: TString.h:407
TProofMonSender::SetSendOptions
Int_t SetSendOptions(const char *)
Parse send options from string 'sendopts'.
Definition: TProofMonSender.cxx:43
TProofMonSender::fSummaryVrs
Int_t fSummaryVrs
Definition: TProofMonSender.h:33
TProofMonSender::kSendDataSetInfo
@ kSendDataSetInfo
Definition: TProofMonSender.h:38
Char_t
char Char_t
Definition: RtypesCore.h:33
TProofMonSender::fFileInfoVrs
Int_t fFileInfoVrs
Definition: TProofMonSender.h:35
int