Logo ROOT  
Reference Guide
TMonaLisaWriter.h
Go to the documentation of this file.
1 // @(#)root/monalisa:$Id$
2 // Author: Andreas Peters 5/10/2005
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_TMonaLisaWriter
13 #define ROOT_TMonaLisaWriter
14 
15 #include "TVirtualMonitoring.h"
16 #include "TStopwatch.h"
17 
18 #ifndef __CINT__
19 #include <ApMon.h>
20 #else
21 struct ApMon;
22 #endif
23 
24 #include <time.h>
25 #include <map>
26 
27 class MonitoredTFileInfo;
28 
29 //////////////////////////////////////////////////////////////////////////
30 // //
31 // TMonaLisaWriter //
32 // //
33 // Class defining interface to MonaLisa Monitoring Services in ROOT. //
34 // The TMonaLisaWriter object is used to send monitoring information to //
35 // a MonaLisa server using the ML ApMon package (libapmoncpp.so/UDP //
36 // packets). The MonaLisa ApMon library for C++ can be downloaded at //
37 // http://monalisa.cacr.caltech.edu/monalisa__Download__ApMon.html, //
38 // current version: //
39 //http://monalisa.cacr.caltech.edu/download/apmon/ApMon_cpp-2.2.0.tar.gz//
40 // //
41 // The ROOT implementation is primary optimized for process/job //
42 // monitoring, although all other generic MonaLisa ApMon functionality //
43 // can be exploited through the ApMon class directly via //
44 // dynamic_cast<TMonaLisaWriter*>(gMonitoringWriter)->GetApMon(). //
45 // //
46 //////////////////////////////////////////////////////////////////////////
47 
48 class TMonaLisaValue : public TNamed {
49 
50 private:
51  Double_t fValue; // double monitor value
52 
53  TMonaLisaValue(const TMonaLisaValue&); // Not implented
54  TMonaLisaValue& operator=(const TMonaLisaValue&); // Not implented
55 
56 public:
57  TMonaLisaValue(const char *name, Double_t value)
58  : TNamed(name, ""), fValue(value) { }
59  virtual ~TMonaLisaValue() { }
60 
61  Double_t GetValue() const { return fValue; }
62  Double_t *GetValuePtr() { return &fValue; }
63 
64  ClassDef(TMonaLisaValue, 1) // Interface to MonaLisa Monitoring Values
65 };
66 
67 
68 class TMonaLisaText : public TNamed {
69 
70 public:
71  TMonaLisaText(const char *name, const char *text) : TNamed(name, text) { }
72  virtual ~TMonaLisaText() { }
73 
74  const char *GetText() const { return GetTitle(); }
75 
76  ClassDef(TMonaLisaText, 1) // Interface to MonaLisa Monitoring Text
77 };
78 
79 
81 
82 private:
83  ApMon *fApmon; //! connection to MonaLisa
84  TString fJobId; //! job id
85  TString fSubJobId; //! sub job id
86  TString fHostname; //! hostname of MonaLisa server
87  Int_t fPid; //! process id
88  Bool_t fInitialized; // true if initialized
89  Bool_t fVerbose; // verbocity
90  Double_t fLastRWSendTime; // timestamp of the last send command for file reads/writes
91  Double_t fLastFCloseSendTime; // In order not to flood ML servers
92  time_t fLastProgressTime; // timestamp of the last send command for player process
93 
94  std::map<UInt_t, MonitoredTFileInfo *> //!
95  *fMonInfoRepo; //! repo to gather per-file-instance mon info;
96  // ROOT should really have something like this
97 
98  Int_t fReportInterval; // interval after which to send the latest value
99 
100  TStopwatch fStopwatch; // cpu and time measurement for job and proc status
101  TStopwatch fFileStopwatch; // time measurements for data access throughputs
102 
103  TMonaLisaWriter(const TMonaLisaWriter&); // Not implemented
104  TMonaLisaWriter& operator=(const TMonaLisaWriter&); // Not implemented
105 
106  void Init(const char *monserver, const char *montag, const char *monid,
107  const char *monsubid, const char *option);
108 
110 public:
111  TMonaLisaWriter(const char *monserver, const char *montag, const char *monid = 0,
112  const char *monsubid = 0, const char *option = "");
113 
114  virtual ~TMonaLisaWriter();
115 
116  ApMon *GetApMon() const { return fApmon; }
117 
118  virtual Bool_t SendParameters(TList *valuelist, const char *identifier = 0);
119  virtual Bool_t SendInfoTime();
120  virtual Bool_t SendInfoUser(const char *user = 0);
121  virtual Bool_t SendInfoDescription(const char *jobtag);
122  virtual Bool_t SendInfoStatus(const char *status);
123 
125 
126  // An Open might have several phases, and the timings might be interesting
127  // to report
128  // The info is only gathered, and sent when forcesend=kTRUE
129  virtual Bool_t SendFileOpenProgress(TFile *file, TList *openphases, const char *openphasename,
130  Bool_t forcesend = kFALSE);
131 
134 
135  virtual Bool_t SendProcessingStatus(const char *status, Bool_t restarttimer=kFALSE);
136  virtual Bool_t SendProcessingProgress(Double_t nevent, Double_t nbytes, Bool_t force=kFALSE);
137  virtual void SetLogLevel(const char *loglevel = "WARNING");
138  virtual void Verbose(Bool_t onoff) { fVerbose = onoff; }
139 
140  void Print(Option_t *option = "") const;
141 
142  ClassDef(TMonaLisaWriter, 1) // Interface to MonaLisa Monitoring
143 };
144 
145 #endif
TMonaLisaWriter::~TMonaLisaWriter
virtual ~TMonaLisaWriter()
Cleanup.
Definition: TMonaLisaWriter.cxx:382
TMonaLisaValue::GetValue
Double_t GetValue() const
Definition: TMonaLisaWriter.h:61
TMonaLisaWriter::SendInfoStatus
virtual Bool_t SendInfoStatus(const char *status)
Sends a <status> text to MonaLisa following the process scheme: <site> --> <jobid> --> 'status' = <st...
Definition: TMonaLisaWriter.cxx:407
TMonaLisaWriter::SendInfoTime
virtual Bool_t SendInfoTime()
Sends the current time to MonaLisa following the processing scheme <site> --> <jobid> --> 'time' = >u...
Definition: TMonaLisaWriter.cxx:501
TMonaLisaWriter::TMonaLisaWriter
TMonaLisaWriter(const TMonaLisaWriter &)
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:54
TMonaLisaText::TMonaLisaText
TMonaLisaText(const char *name, const char *text)
Definition: TMonaLisaWriter.h:71
TStopwatch.h
TMonaLisaWriter::SendInfoDescription
virtual Bool_t SendInfoDescription(const char *jobtag)
Sends the description <jobtag> following the processing scheme: <site> --> <jobid> --> 'jobname' = <j...
Definition: TMonaLisaWriter.cxx:473
TVirtualMonitoringWriter
Definition: TVirtualMonitoring.h:35
TMonaLisaWriter::SendProcessingProgress
virtual Bool_t SendProcessingProgress(Double_t nevent, Double_t nbytes, Bool_t force=kFALSE)
Send the procesing progress to MonaLisa.
Definition: TMonaLisaWriter.cxx:571
TMonaLisaValue::TMonaLisaValue
TMonaLisaValue(const TMonaLisaValue &)
TMonaLisaWriter::SendParameters
virtual Bool_t SendParameters(TList *valuelist, const char *identifier=0)
Send the parameters to MonaLisa.
Definition: TMonaLisaWriter.cxx:1000
TMonaLisaWriter::fReportInterval
Int_t fReportInterval
repo to gather per-file-instance mon info;
Definition: TMonaLisaWriter.h:98
TMonaLisaWriter::fLastFCloseSendTime
Double_t fLastFCloseSendTime
Definition: TMonaLisaWriter.h:91
TMonaLisaValue::fValue
Double_t fValue
Definition: TMonaLisaWriter.h:51
TMonaLisaWriter::SendFileCloseEvent
virtual Bool_t SendFileCloseEvent(TFile *file)
Definition: TMonaLisaWriter.cxx:765
TMonaLisaWriter::fStopwatch
TStopwatch fStopwatch
Definition: TMonaLisaWriter.h:100
TString
Definition: TString.h:136
TMonaLisaValue::TMonaLisaValue
TMonaLisaValue(const char *name, Double_t value)
Definition: TMonaLisaWriter.h:57
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TMonaLisaWriter::fInitialized
Bool_t fInitialized
process id
Definition: TMonaLisaWriter.h:88
TMonaLisaWriter::SendInfoUser
virtual Bool_t SendInfoUser(const char *user=0)
Sends the <user> text to MonaLisa following the process scheme: <site> --> <jobid> --> 'user' = <user...
Definition: TMonaLisaWriter.cxx:434
text
TText * text
Definition: entrylist_figure1.C:10
TMonaLisaWriter::fLastProgressTime
time_t fLastProgressTime
Definition: TMonaLisaWriter.h:92
TMonaLisaWriter::Verbose
virtual void Verbose(Bool_t onoff)
Definition: TMonaLisaWriter.h:138
bool
TMonaLisaWriter::SendFileOpenProgress
virtual Bool_t SendFileOpenProgress(TFile *file, TList *openphases, const char *openphasename, Bool_t forcesend=kFALSE)
Send the fileopen progress to MonaLisa.
Definition: TMonaLisaWriter.cxx:667
TMonaLisaWriter::fJobId
TString fJobId
connection to MonaLisa
Definition: TMonaLisaWriter.h:84
TMonaLisaText::~TMonaLisaText
virtual ~TMonaLisaText()
Definition: TMonaLisaWriter.h:72
TMonaLisaWriter::fLastRWSendTime
Double_t fLastRWSendTime
Definition: TMonaLisaWriter.h:90
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TMonaLisaText
Definition: TMonaLisaWriter.h:68
TMonaLisaWriter::SendFileWriteProgress
virtual Bool_t SendFileWriteProgress(TFile *file)
Definition: TMonaLisaWriter.cxx:861
TMonaLisaWriter::fSubJobId
TString fSubJobId
job id
Definition: TMonaLisaWriter.h:85
TMonaLisaWriter::GetApMon
ApMon * GetApMon() const
Definition: TMonaLisaWriter.h:116
TNamed
Definition: TNamed.h:29
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TMonaLisaWriter::fMonInfoRepo
std::map< UInt_t, MonitoredTFileInfo * > * fMonInfoRepo
Definition: TMonaLisaWriter.h:95
TMonaLisaWriter::SendProcessingStatus
virtual Bool_t SendProcessingStatus(const char *status, Bool_t restarttimer=kFALSE)
Send the procesing status 'status' to MonaLisa following the processing scheme: <site> --> <jobid> --...
Definition: TMonaLisaWriter.cxx:534
TMonaLisaText::GetText
const char * GetText() const
Definition: TMonaLisaWriter.h:74
TMonaLisaWriter::fPid
Int_t fPid
hostname of MonaLisa server
Definition: TMonaLisaWriter.h:87
TMonaLisaWriter::Init
void Init(const char *monserver, const char *montag, const char *monid, const char *monsubid, const char *option)
Creates a TMonaLisaWriter object to send monitoring information to a MonaLisa server using the MonaLi...
Definition: TMonaLisaWriter.cxx:270
TMonaLisaWriter::fVerbose
Bool_t fVerbose
Definition: TMonaLisaWriter.h:89
TFile
Definition: TFile.h:54
TMonaLisaWriter::SendFileCheckpoint
Bool_t SendFileCheckpoint(TFile *file)
Definition: TMonaLisaWriter.cxx:866
Double_t
double Double_t
Definition: RtypesCore.h:59
TMonaLisaValue
Definition: TMonaLisaWriter.h:48
TMonaLisaWriter::SendFileReadProgress
virtual Bool_t SendFileReadProgress(TFile *file)
Definition: TMonaLisaWriter.cxx:856
TMonaLisaValue::operator=
TMonaLisaValue & operator=(const TMonaLisaValue &)
file
Definition: file.py:1
TStopwatch
Definition: TStopwatch.h:28
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TVirtualMonitoring.h
TMonaLisaWriter::SetLogLevel
virtual void SetLogLevel(const char *loglevel="WARNING")
Set MonaLisa log level.
Definition: TMonaLisaWriter.cxx:1161
name
char name[80]
Definition: TGX11.cxx:110
TMonaLisaWriter::Print
void Print(Option_t *option="") const
Print info about MonaLisa object.
Definition: TMonaLisaWriter.cxx:1169
TMonaLisaValue::GetValuePtr
Double_t * GetValuePtr()
Definition: TMonaLisaWriter.h:62
TMonaLisaWriter::fHostname
TString fHostname
sub job id
Definition: TMonaLisaWriter.h:86
TMonaLisaWriter::fFileStopwatch
TStopwatch fFileStopwatch
Definition: TMonaLisaWriter.h:101
TMonaLisaWriter::fApmon
ApMon * fApmon
Definition: TMonaLisaWriter.h:83
TMonaLisaValue::~TMonaLisaValue
virtual ~TMonaLisaValue()
Definition: TMonaLisaWriter.h:59
TMonaLisaWriter::operator=
TMonaLisaWriter & operator=(const TMonaLisaWriter &)
TMonaLisaWriter
Definition: TMonaLisaWriter.h:80
TList
Definition: TList.h:44
int