Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include <ApMon.h>
19
20#include <time.h>
21#include <map>
22
24
25//////////////////////////////////////////////////////////////////////////
26// //
27// TMonaLisaWriter //
28// //
29// Class defining interface to MonaLisa Monitoring Services in ROOT. //
30// The TMonaLisaWriter object is used to send monitoring information to //
31// a MonaLisa server using the ML ApMon package (libapmoncpp.so/UDP //
32// packets). The MonaLisa ApMon library for C++ can be downloaded at //
33// http://monalisa.cacr.caltech.edu/monalisa__Download__ApMon.html, //
34// current version: //
35//http://monalisa.cacr.caltech.edu/download/apmon/ApMon_cpp-2.2.0.tar.gz//
36// //
37// The ROOT implementation is primary optimized for process/job //
38// monitoring, although all other generic MonaLisa ApMon functionality //
39// can be exploited through the ApMon class directly via //
40// dynamic_cast<TMonaLisaWriter*>(gMonitoringWriter)->GetApMon(). //
41// //
42//////////////////////////////////////////////////////////////////////////
43
44class TMonaLisaValue : public TNamed {
45
46private:
47 Double_t fValue; // double monitor value
48
49 TMonaLisaValue(const TMonaLisaValue&); // Not implented
50 TMonaLisaValue& operator=(const TMonaLisaValue&); // Not implented
51
52public:
54 : TNamed(name, ""), fValue(value) { }
55 virtual ~TMonaLisaValue() { }
56
57 Double_t GetValue() const { return fValue; }
58 Double_t *GetValuePtr() { return &fValue; }
59
60 ClassDef(TMonaLisaValue, 1) // Interface to MonaLisa Monitoring Values
61};
62
63
64class TMonaLisaText : public TNamed {
65
66public:
67 TMonaLisaText(const char *name, const char *text) : TNamed(name, text) { }
68 virtual ~TMonaLisaText() { }
69
70 const char *GetText() const { return GetTitle(); }
71
72 ClassDef(TMonaLisaText, 1) // Interface to MonaLisa Monitoring Text
73};
74
75
77
78private:
79 ApMon *fApmon; //! connection to MonaLisa
80 TString fJobId; //! job id
81 TString fSubJobId; //! sub job id
82 TString fHostname; //! hostname of MonaLisa server
83 Int_t fPid; //! process id
84 Bool_t fInitialized; // true if initialized
85 Bool_t fVerbose; // verbocity
86 Double_t fLastRWSendTime; // timestamp of the last send command for file reads/writes
87 Double_t fLastFCloseSendTime; // In order not to flood ML servers
88 time_t fLastProgressTime; // timestamp of the last send command for player process
89
90 std::map<UInt_t, MonitoredTFileInfo *> //!
91 *fMonInfoRepo; //! repo to gather per-file-instance mon info;
92 // ROOT should really have something like this
93
94 Int_t fReportInterval; // interval after which to send the latest value
95
96 TStopwatch fStopwatch; // cpu and time measurement for job and proc status
97 TStopwatch fFileStopwatch; // time measurements for data access throughputs
98
99 TMonaLisaWriter(const TMonaLisaWriter&); // Not implemented
100 TMonaLisaWriter& operator=(const TMonaLisaWriter&); // Not implemented
101
102 void Init(const char *monserver, const char *montag, const char *monid,
103 const char *monsubid, const char *option);
104
106public:
107 TMonaLisaWriter(const char *monserver, const char *montag, const char *monid = 0,
108 const char *monsubid = 0, const char *option = "");
109
110 virtual ~TMonaLisaWriter();
111
112 ApMon *GetApMon() const { return fApmon; }
113
114 virtual Bool_t SendParameters(TList *valuelist, const char *identifier = 0);
115 virtual Bool_t SendInfoTime();
116 virtual Bool_t SendInfoUser(const char *user = 0);
117 virtual Bool_t SendInfoDescription(const char *jobtag);
118 virtual Bool_t SendInfoStatus(const char *status);
119
120 virtual Bool_t SendFileCloseEvent(TFile *file);
121
122 // An Open might have several phases, and the timings might be interesting
123 // to report
124 // The info is only gathered, and sent when forcesend=kTRUE
125 virtual Bool_t SendFileOpenProgress(TFile *file, TList *openphases, const char *openphasename,
126 Bool_t forcesend = kFALSE);
127
128 virtual Bool_t SendFileReadProgress(TFile *file);
129 virtual Bool_t SendFileWriteProgress(TFile *file);
130
131 virtual Bool_t SendProcessingStatus(const char *status, Bool_t restarttimer=kFALSE);
132 virtual Bool_t SendProcessingProgress(Double_t nevent, Double_t nbytes, Bool_t force=kFALSE);
133 virtual void SetLogLevel(const char *loglevel = "WARNING");
134 virtual void Verbose(Bool_t onoff) { fVerbose = onoff; }
135
136 void Print(Option_t *option = "") const;
137
138 ClassDef(TMonaLisaWriter, 1) // Interface to MonaLisa Monitoring
139};
140
141#endif
bool Bool_t
Definition RtypesCore.h:63
constexpr 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:337
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 an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
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
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:139