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
21struct ApMon;
22#endif
23
24#include <time.h>
25#include <map>
26
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
48class TMonaLisaValue : public TNamed {
49
50private:
51 Double_t fValue; // double monitor value
52
53 TMonaLisaValue(const TMonaLisaValue&); // Not implented
54 TMonaLisaValue& operator=(const TMonaLisaValue&); // Not implented
55
56public:
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
68class TMonaLisaText : public TNamed {
69
70public:
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
82private:
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
110public:
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
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kFALSE
Definition: RtypesCore.h:101
double Double_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:335
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char text
char name[80]
Definition: TGX11.cxx:110
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
A doubly linked list.
Definition: TList.h:38
const char * GetText() const
virtual ~TMonaLisaText()
TMonaLisaText(const char *name, const char *text)
Double_t GetValue() const
TMonaLisaValue & operator=(const TMonaLisaValue &)
Double_t * GetValuePtr()
TMonaLisaValue(const TMonaLisaValue &)
virtual ~TMonaLisaValue()
TMonaLisaValue(const char *name, Double_t value)
virtual Bool_t SendInfoTime()
Sends the current time to MonaLisa following the processing scheme <site> --> <jobid> --> 'time' = >u...
TStopwatch fFileStopwatch
TString fHostname
sub job id
TString fJobId
connection to MonaLisa
ApMon * GetApMon() const
virtual Bool_t SendFileWriteProgress(TFile *file)
Int_t fPid
hostname of MonaLisa server
virtual void Verbose(Bool_t onoff)
void Print(Option_t *option="") const
Print info about MonaLisa object.
Double_t fLastRWSendTime
virtual Bool_t SendFileReadProgress(TFile *file)
virtual Bool_t SendParameters(TList *valuelist, const char *identifier=0)
Send the parameters to MonaLisa.
std::map< UInt_t, MonitoredTFileInfo * > * fMonInfoRepo
time_t fLastProgressTime
virtual void SetLogLevel(const char *loglevel="WARNING")
Set MonaLisa log level.
virtual Bool_t SendProcessingProgress(Double_t nevent, Double_t nbytes, Bool_t force=kFALSE)
Send the procesing progress to MonaLisa.
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...
Int_t fReportInterval
repo to gather per-file-instance mon info;
TMonaLisaWriter & operator=(const TMonaLisaWriter &)
virtual Bool_t SendProcessingStatus(const char *status, Bool_t restarttimer=kFALSE)
Send the procesing status 'status' to MonaLisa following the processing scheme: <site> --> <jobid> --...
TMonaLisaWriter(const TMonaLisaWriter &)
Bool_t SendFileCheckpoint(TFile *file)
Bool_t fInitialized
process id
virtual Bool_t SendFileCloseEvent(TFile *file)
TString fSubJobId
job id
Double_t fLastFCloseSendTime
virtual Bool_t SendInfoUser(const char *user=0)
Sends the <user> text to MonaLisa following the process scheme: <site> --> <jobid> --> 'user' = <user...
virtual ~TMonaLisaWriter()
Cleanup.
TStopwatch fStopwatch
virtual Bool_t SendInfoStatus(const char *status)
Sends a <status> text to MonaLisa following the process scheme: <site> --> <jobid> --> 'status' = <st...
virtual Bool_t SendFileOpenProgress(TFile *file, TList *openphases, const char *openphasename, Bool_t forcesend=kFALSE)
Send the fileopen progress to MonaLisa.
virtual Bool_t SendInfoDescription(const char *jobtag)
Sends the description <jobtag> following the processing scheme: <site> --> <jobid> --> 'jobname' = <j...
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
const char * GetTitle() const override
Returns title of object.
Definition: TNamed.h:48
Stopwatch class.
Definition: TStopwatch.h:28
Basic string class.
Definition: TString.h:136
Definition: file.py:1