#ifndef ROOT_TMonaLisaWriter
#define ROOT_TMonaLisaWriter
#ifndef ROOT_TVirtualMonitoring
#include "TVirtualMonitoring.h"
#endif
#ifndef ROOT_TStopwatch
#include "TStopwatch.h"
#endif
#ifndef __CINT__
#include <ApMon.h>
#else
struct ApMon;
#endif
#include <time.h>
#include <map>
class MonitoredTFileInfo;
class TMonaLisaValue : public TNamed {
private:
Double_t fValue;
TMonaLisaValue(const TMonaLisaValue&);
TMonaLisaValue& operator=(const TMonaLisaValue&);
public:
TMonaLisaValue(const char *name, Double_t value)
: TNamed(name, ""), fValue(value) { }
virtual ~TMonaLisaValue() { }
Double_t GetValue() const { return fValue; }
Double_t *GetValuePtr() { return &fValue; }
ClassDef(TMonaLisaValue, 1)
};
class TMonaLisaText : public TNamed {
public:
TMonaLisaText(const char *name, const char *text) : TNamed(name, text) { }
virtual ~TMonaLisaText() { }
const char *GetText() const { return GetTitle(); }
ClassDef(TMonaLisaText, 1)
};
class TMonaLisaWriter : public TVirtualMonitoringWriter {
private:
ApMon *fApmon;
TString fJobId;
TString fSubJobId;
TString fHostname;
Int_t fPid;
Bool_t fInitialized;
Bool_t fVerbose;
Double_t fLastRWSendTime;
Double_t fLastFCloseSendTime;
time_t fLastProgressTime;
std::map<UInt_t, MonitoredTFileInfo *>
*fMonInfoRepo;
Int_t fReportInterval;
TStopwatch fStopwatch;
TStopwatch fFileStopwatch;
TMonaLisaWriter(const TMonaLisaWriter&);
TMonaLisaWriter& operator=(const TMonaLisaWriter&);
void Init(const char *monserver, const char *montag, const char *monid,
const char *monsubid, const char *option);
Bool_t SendFileCheckpoint(TFile *file);
public:
TMonaLisaWriter(const char *monserver, const char *montag, const char *monid = 0,
const char *monsubid = 0, const char *option = "");
virtual ~TMonaLisaWriter();
ApMon *GetApMon() const { return fApmon; }
virtual Bool_t SendParameters(TList *valuelist, const char *identifier = 0);
virtual Bool_t SendInfoTime();
virtual Bool_t SendInfoUser(const char *user = 0);
virtual Bool_t SendInfoDescription(const char *jobtag);
virtual Bool_t SendInfoStatus(const char *status);
virtual Bool_t SendFileCloseEvent(TFile *file);
virtual Bool_t SendFileOpenProgress(TFile *file, TList *openphases, const char *openphasename,
Bool_t forcesend = kFALSE);
virtual Bool_t SendFileReadProgress(TFile *file);
virtual Bool_t SendFileWriteProgress(TFile *file);
virtual Bool_t SendProcessingStatus(const char *status, Bool_t restarttimer=kFALSE);
virtual Bool_t SendProcessingProgress(Double_t nevent, Double_t nbytes, Bool_t force=kFALSE);
virtual void SetLogLevel(const char *loglevel = "WARNING");
virtual void Verbose(Bool_t onoff) { fVerbose = onoff; }
void Print(Option_t *option = "") const;
ClassDef(TMonaLisaWriter, 1)
};
#endif