Logo ROOT   6.07/09
Reference Guide
TQueryResultManager.h
Go to the documentation of this file.
1 // @(#)root/proof:$Id$
2 // Author: G. Ganis Mar 2008
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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 
13 #ifndef ROOT_TQueryResultManager
14 #define ROOT_TQueryResultManager
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TQueryResultManager //
19 // //
20 // This class manages the query-result area. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TObject
25 #include "TObject.h"
26 #endif
27 #ifndef ROOT_TStopwatch
28 #include "TStopwatch.h"
29 #endif
30 #ifndef ROOT_TString
31 #include "TString.h"
32 #endif
33 
34 class TList;
35 class TProof;
36 class TProofLockPath;
37 class TProofQueryResult;
38 class TQueryResult;
40 
41 class TQueryResultManager : public TObject {
42 
43 private:
44  TString fQueryDir; //directory containing query results and status
45  TString fSessionTag; //tag for the session
46  TString fSessionDir; //directory containing session dependent files
47  Int_t fSeqNum; //sequential number of last processed query
48  Int_t fDrawQueries; //number of draw queries processed
49  Int_t fKeptQueries; //number of queries fully in memory and in dir
50  TList *fQueries; //list of TProofQueryResult objects
51  TList *fPreviousQueries; //list of TProofQueryResult objects from previous sections
52  TProofLockPath *fLock; //dir locker
53  FILE *fLogFile; //log file
54  TStopwatch fCompute; //measures time spend processing a query on the master
55 
56  void AddLogFile(TProofQueryResult *pq);
57 
58 public:
59  TQueryResultManager(const char *qdir, const char *stag, const char *sdir,
60  TProofLockPath *lck, FILE *logfile = 0);
61  virtual ~TQueryResultManager();
62 
63  const char *QueryDir() const { return fQueryDir.Data(); }
64  Int_t SeqNum() const { return fSeqNum; }
65  Int_t DrawQueries() const { return fDrawQueries; }
66  Int_t KeptQueries() const { return fKeptQueries; }
67  TList *Queries() const { return fQueries; }
68  TList *PreviousQueries() const { return fPreviousQueries; }
69 
70  void IncrementSeqNum() { fSeqNum++; }
71  void IncrementDrawQueries() { fDrawQueries++; }
72 
76  TProof *proof, TVirtualProofPlayer *player);
77  Float_t GetCpuTime() { return fCompute.CpuTime(); }
78  Float_t GetRealTime() { return fCompute.RealTime(); }
79  TProofQueryResult *LocateQuery(TString queryref, Int_t &qry, TString &qdir);
80  void RemoveQuery(TQueryResult *qr, Bool_t soft = kFALSE);
81  void RemoveQuery(const char *queryref, TList *otherlist = 0);
82  void ResetTime() { fCompute.Start(); }
83  void SaveQuery(TProofQueryResult *qr, const char *fout = 0);
84  void SaveQuery(TProofQueryResult *qr, Int_t mxq);
85 
86  Int_t LockSession(const char *sessiontag, TProofLockPath **lck);
87  Int_t CleanupSession(const char *sessiontag);
88  void ScanPreviousQueries(const char *dir);
89 
90  ClassDef(TQueryResultManager,0) //PROOF query result manager
91 };
92 
93 #endif
94 
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
Definition: TStopwatch.cxx:110
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Definition: TStopwatch.cxx:58
float Float_t
Definition: RtypesCore.h:53
Int_t LockSession(const char *sessiontag, TProofLockPath **lck)
Try locking query area of session tagged sessiontag.
void AddLogFile(TProofQueryResult *pq)
Add part of log file concerning TQueryResult pq to its macro container.
Basic string class.
Definition: TString.h:137
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
Definition: TStopwatch.cxx:125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Int_t DrawQueries() const
TProofQueryResult * LocateQuery(TString queryref, Int_t &qry, TString &qdir)
Locate query referenced by queryref.
void ScanPreviousQueries(const char *dir)
Scan the queries directory for the results of previous queries.
const char * Data() const
Definition: TString.h:349
#define ClassDef(name, id)
Definition: Rtypes.h:254
Int_t CleanupSession(const char *sessiontag)
Cleanup query dir qdir.
Int_t ApplyMaxQueries(Int_t mxq)
Scan the queries directory and remove the oldest ones (and relative dirs, if empty) in such a way onl...
A container class for query results.
Definition: TQueryResult.h:44
Int_t KeptQueries() const
A doubly linked list.
Definition: TList.h:47
Class managing the query-result area.
TProofLockPath * fLock
const char * QueryDir() const
Bool_t FinalizeQuery(TProofQueryResult *pq, TProof *proof, TVirtualProofPlayer *player)
Final steps after Process() to complete the TQueryResult instance.
TQueryResultManager(const char *qdir, const char *stag, const char *sdir, TProofLockPath *lck, FILE *logfile=0)
Constructor.
This class controls a Parallel ROOT Facility, PROOF, cluster.
Definition: TProof.h:346
void RemoveQuery(TQueryResult *qr, Bool_t soft=kFALSE)
Remove everything about query qr.
TQueryResult version adapted to PROOF neeeds.
void SaveQuery(TProofQueryResult *qr, const char *fout=0)
Save current status of query 'qr' to file name fout.
Mother of all ROOT objects.
Definition: TObject.h:44
virtual ~TQueryResultManager()
Cleanup.
TList * Queries() const
Int_t CleanupQueriesDir()
Remove all queries results referring to previous sessions.
Abstract interface for the PROOF player.
TList * PreviousQueries() const
Stopwatch class.
Definition: TStopwatch.h:30