KaliVeda
Toolkit for HIC analysis
KVLogReader.h
1 /*******************************************************************************
2 $Id: KVLogReader.h,v 1.10 2008/04/07 15:34:27 franklan Exp $
3 *******************************************************************************/
4 #ifndef __KVLOGREADER_H
5 #define __KVLOGREADER_H
6 
7 #include "Rtypes.h"
8 #include "KVString.h"
9 
16 class KVLogReader {
17 protected:
18 
31 
32 protected:
33  virtual Int_t GetByteMultiplier(const KVString& unit) = 0;
34  virtual void ReadLine(const KVString& line, Bool_t&);
35  virtual void ReadCPU(const KVString& line) = 0;
36  void ReadStorageReq(const KVString& line);
37  virtual void ReadScratchUsed(const KVString& line) = 0;
38  virtual void ReadMemUsed(const KVString& line) = 0;
39  virtual void ReadStatus(const KVString& line) = 0;
40  void ReadJobname(const KVString& line);
41  virtual Double_t ReadStorage(const KVString& stor) = 0;
42 
43 public:
44 
45  KVLogReader();
46  virtual ~ KVLogReader()
47  {
48  };
49 
50  void ReadFile(const Char_t* fname);
51  virtual void Reset();
52 
53  void SetNameFormat(const Char_t* fmt)
54  {
55  fFMT = fmt;
56  };
57 
59  {
60  return fCPUused;
61  };
63  {
64  return fCPUreq;
65  };
67  {
68  return fSCRreq;
69  };
71  {
72  return fMEMreq;
73  };
74  Double_t GetCPUratio() const;
76  {
77  return fScratchKB;
78  };
80  {
81  return fMemKB;
82  };
83  const Char_t* GetStatus() const
84  {
85  return fStatus.Data();
86  };
87  const Char_t* GetJobname() const
88  {
89  return fJobname.Data();
90  };
91  Int_t GetRunNumber() const;
92 
93  Bool_t JobOK() const
94  {
95  return (fOK && fGotRequests);
96  };
97 
98  Bool_t Killed() const
99  {
100  return (fStatus == "KILLED");
101  };
102  Bool_t SegFault() const
103  {
104  return (fStatus.Contains("egmentation"));
105  };
106  virtual Bool_t Incomplete() const;
107 
108  ClassDef(KVLogReader, 0)//Tool for reading CCIN2P3 batch logs
109 };
110 
111 #endif
int Int_t
bool Bool_t
char Char_t
double Double_t
#define ClassDef(name, id)
Base class for reading batch log files at CC-IN2P3.
Definition: KVLogReader.h:16
KVString fStatus
status string
Definition: KVLogReader.h:27
KVString fFMT
format string used to extract run number from job name
Definition: KVLogReader.h:19
Double_t GetSCRATCHrequest() const
Definition: KVLogReader.h:66
Double_t GetCPUrequest() const
Definition: KVLogReader.h:62
Bool_t JobOK() const
Definition: KVLogReader.h:93
virtual void ReadLine(const KVString &line, Bool_t &)
Definition: KVLogReader.cpp:74
KVString fJobname
name of job
Definition: KVLogReader.h:20
void ReadStorageReq(const KVString &line)
void ReadJobname(const KVString &line)
Bool_t fOK
job OK or not ?
Definition: KVLogReader.h:28
Double_t GetCPUratio() const
calculate ratio of used CPU to requested CPU
Double_t GetMEMused() const
Definition: KVLogReader.h:79
Double_t fCPUused
normalized used CPU time in seconds
Definition: KVLogReader.h:21
Bool_t Killed() const
Definition: KVLogReader.h:98
Double_t GetSCRATCHused() const
Definition: KVLogReader.h:75
const Char_t * GetStatus() const
Definition: KVLogReader.h:83
void ReadFile(const Char_t *fname)
Open file 'fname' and read contents.
Definition: KVLogReader.cpp:43
Double_t fMEMreq
requested memory (VIRTUAL STORAGE) in KB
Definition: KVLogReader.h:23
virtual void Reset()
reset informations read from file
Definition: KVLogReader.cpp:28
Double_t GetMEMrequest() const
Definition: KVLogReader.h:70
virtual Int_t GetByteMultiplier(const KVString &unit)=0
Double_t GetCPUused() const
Definition: KVLogReader.h:58
virtual void ReadMemUsed(const KVString &line)=0
void SetNameFormat(const Char_t *fmt)
Definition: KVLogReader.h:53
virtual void ReadCPU(const KVString &line)=0
const Char_t * GetJobname() const
Definition: KVLogReader.h:87
virtual Double_t ReadStorage(const KVString &stor)=0
virtual ~ KVLogReader()
Definition: KVLogReader.h:46
virtual Bool_t Incomplete() const
virtual void ReadScratchUsed(const KVString &line)=0
Int_t GetRunNumber() const
try to get run number from jobname using format string fFMT
Bool_t fGotRequests
set true when disk & memory request has been read
Definition: KVLogReader.h:29
Bool_t fGotStatus
set true when end of job infos have been read
Definition: KVLogReader.h:30
Double_t fMemKB
used memory in KB
Definition: KVLogReader.h:26
Bool_t SegFault() const
Definition: KVLogReader.h:102
Double_t fSCRreq
requested scratch disk space in KB
Definition: KVLogReader.h:24
virtual void ReadStatus(const KVString &line)=0
Double_t fCPUreq
requested CPU time in seconds
Definition: KVLogReader.h:22
Double_t fScratchKB
used disk space in KB
Definition: KVLogReader.h:25
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const