ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #ifndef ROOT_TVirtualMonitoring
16 #include "TVirtualMonitoring.h"
17 #endif
18 #ifndef ROOT_TStopwatch
19 #include "TStopwatch.h"
20 #endif
21 
22 #ifndef __CINT__
23 #include <ApMon.h>
24 #else
25 struct ApMon;
26 #endif
27 
28 #include <time.h>
29 #include <map>
30 
31 class MonitoredTFileInfo;
32 
33 //////////////////////////////////////////////////////////////////////////
34 // //
35 // TMonaLisaWriter //
36 // //
37 // Class defining interface to MonaLisa Monitoring Services in ROOT. //
38 // The TMonaLisaWriter object is used to send monitoring information to //
39 // a MonaLisa server using the ML ApMon package (libapmoncpp.so/UDP //
40 // packets). The MonaLisa ApMon library for C++ can be downloaded at //
41 // http://monalisa.cacr.caltech.edu/monalisa__Download__ApMon.html, //
42 // current version: //
43 //http://monalisa.cacr.caltech.edu/download/apmon/ApMon_cpp-2.2.0.tar.gz//
44 // //
45 // The ROOT implementation is primary optimized for process/job //
46 // monitoring, although all other generic MonaLisa ApMon functionality //
47 // can be exploited through the ApMon class directly via //
48 // dynamic_cast<TMonaLisaWriter*>(gMonitoringWriter)->GetApMon(). //
49 // //
50 //////////////////////////////////////////////////////////////////////////
51 
52 class TMonaLisaValue : public TNamed {
53 
54 private:
55  Double_t fValue; // double monitor value
56 
57  TMonaLisaValue(const TMonaLisaValue&); // Not implented
58  TMonaLisaValue& operator=(const TMonaLisaValue&); // Not implented
59 
60 public:
62  : TNamed(name, ""), fValue(value) { }
63  virtual ~TMonaLisaValue() { }
64 
65  Double_t GetValue() const { return fValue; }
66  Double_t *GetValuePtr() { return &fValue; }
67 
68  ClassDef(TMonaLisaValue, 1) // Interface to MonaLisa Monitoring Values
69 };
70 
71 
72 class TMonaLisaText : public TNamed {
73 
74 public:
75  TMonaLisaText(const char *name, const char *text) : TNamed(name, text) { }
76  virtual ~TMonaLisaText() { }
77 
78  const char *GetText() const { return GetTitle(); }
79 
80  ClassDef(TMonaLisaText, 1) // Interface to MonaLisa Monitoring Text
81 };
82 
83 
85 
86 private:
87  ApMon *fApmon; //! connection to MonaLisa
88  TString fJobId; //! job id
89  TString fSubJobId; //! sub job id
90  TString fHostname; //! hostname of MonaLisa server
91  Int_t fPid; //! process id
92  Bool_t fInitialized; // true if initialized
93  Bool_t fVerbose; // verbocity
94  Double_t fLastRWSendTime; // timestamp of the last send command for file reads/writes
95  Double_t fLastFCloseSendTime; // In order not to flood ML servers
96  time_t fLastProgressTime; // timestamp of the last send command for player process
97 
98  std::map<UInt_t, MonitoredTFileInfo *> //!
99  *fMonInfoRepo; //! repo to gather per-file-instance mon info;
100  // ROOT should really have something like this
101 
102  Int_t fReportInterval; // interval after which to send the latest value
103 
104  TStopwatch fStopwatch; // cpu and time measurement for job and proc status
105  TStopwatch fFileStopwatch; // time measurements for data access throughputs
106 
107  TMonaLisaWriter(const TMonaLisaWriter&); // Not implemented
108  TMonaLisaWriter& operator=(const TMonaLisaWriter&); // Not implemented
109 
110  void Init(const char *monserver, const char *montag, const char *monid,
111  const char *monsubid, const char *option);
112 
114 public:
115  TMonaLisaWriter(const char *monserver, const char *montag, const char *monid = 0,
116  const char *monsubid = 0, const char *option = "");
117 
118  virtual ~TMonaLisaWriter();
119 
120  ApMon *GetApMon() const { return fApmon; }
121 
122  virtual Bool_t SendParameters(TList *valuelist, const char *identifier = 0);
123  virtual Bool_t SendInfoTime();
124  virtual Bool_t SendInfoUser(const char *user = 0);
125  virtual Bool_t SendInfoDescription(const char *jobtag);
126  virtual Bool_t SendInfoStatus(const char *status);
127 
129 
130  // An Open might have several phases, and the timings might be interesting
131  // to report
132  // The info is only gathered, and sent when forcesend=kTRUE
133  virtual Bool_t SendFileOpenProgress(TFile *file, TList *openphases, const char *openphasename,
134  Bool_t forcesend = kFALSE);
135 
138 
139  virtual Bool_t SendProcessingStatus(const char *status, Bool_t restarttimer=kFALSE);
140  virtual Bool_t SendProcessingProgress(Double_t nevent, Double_t nbytes, Bool_t force=kFALSE);
141  virtual void SetLogLevel(const char *loglevel = "WARNING");
142  virtual void Verbose(Bool_t onoff) { fVerbose = onoff; }
143 
144  void Print(Option_t *option = "") const;
145 
146  ClassDef(TMonaLisaWriter, 1) // Interface to MonaLisa Monitoring
147 };
148 
149 #endif
virtual Bool_t SendInfoStatus(const char *status)
Sends a <status> text to MonaLisa following the process scheme: <site> –> <jobid> –> 'status' = <status> Used...
TStopwatch fFileStopwatch
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
virtual Bool_t SendFileWriteProgress(TFile *file)
virtual Bool_t SendFileCloseEvent(TFile *file)
TMonaLisaValue(const char *name, Double_t value)
TString fHostname
sub job id
TMonaLisaValue(const TMonaLisaValue &)
virtual void Verbose(Bool_t onoff)
const char Option_t
Definition: RtypesCore.h:62
Double_t * GetValuePtr()
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...
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
Double_t GetValue() const
Basic string class.
Definition: TString.h:137
ApMon * GetApMon() const
TAlienJobStatus * status
Definition: TAlienJob.cxx:51
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual Bool_t SendProcessingProgress(Double_t nevent, Double_t nbytes, Bool_t force=kFALSE)
Send the procesing progress to MonaLisa.
TStopwatch fStopwatch
TMonaLisaValue & operator=(const TMonaLisaValue &)
TMonaLisaWriter(const TMonaLisaWriter &)
Double_t fLastFCloseSendTime
virtual void SetLogLevel(const char *loglevel="WARNING")
Set MonaLisa log level.
virtual Bool_t SendFileOpenProgress(TFile *file, TList *openphases, const char *openphasename, Bool_t forcesend=kFALSE)
Send the fileopen progress to MonaLisa.
virtual ~TMonaLisaText()
TString fJobId
connection to MonaLisa
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual Bool_t SendInfoTime()
Sends the current time to MonaLisa following the processing scheme <site> –> <jobid> –> 'time' = >unixtimes...
virtual ~TMonaLisaWriter()
Cleanup.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual Bool_t SendInfoUser(const char *user=0)
Sends the <user> text to MonaLisa following the process scheme: <site> –> <jobid> –> 'user' = <user> ...
TMonaLisaText(const char *name, const char *text)
Bool_t fInitialized
process id
virtual Bool_t SendParameters(TList *valuelist, const char *identifier=0)
Send the parameters to MonaLisa.
Int_t fReportInterval
repo to gather per-file-instance mon info;
A doubly linked list.
Definition: TList.h:47
TMonaLisaWriter & operator=(const TMonaLisaWriter &)
time_t fLastProgressTime
TString fSubJobId
job id
virtual ~TMonaLisaValue()
void Print(Option_t *option="") const
Print info about MonaLisa object.
MonitoredTFileInfo(TFile *file, Double_t timenow)
tuple file
Definition: fildir.py:20
double Double_t
Definition: RtypesCore.h:55
TText * text
virtual Bool_t SendProcessingStatus(const char *status, Bool_t restarttimer=kFALSE)
Send the procesing status 'status' to MonaLisa following the processing scheme: <site> –> <jobid> –> 'statu...
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual Bool_t SendInfoDescription(const char *jobtag)
Sends the description <jobtag> following the processing scheme: <site> –> <jobid> –> 'jobname' = <jobtag> ...
const char * GetText() const
std::map< UInt_t, MonitoredTFileInfo * > * fMonInfoRepo
Double_t fLastRWSendTime
Bool_t SendFileCheckpoint(TFile *file)
float value
Definition: math.cpp:443
virtual Bool_t SendFileReadProgress(TFile *file)
Int_t fPid
hostname of MonaLisa server
Stopwatch class.
Definition: TStopwatch.h:30