Logo ROOT   6.10/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 #include "TObject.h"
25 #include "TStopwatch.h"
26 #include "TString.h"
27 
28 class TList;
29 class TProof;
30 class TProofLockPath;
31 class TProofQueryResult;
32 class TQueryResult;
34 
35 class TQueryResultManager : public TObject {
36 
37 private:
38  TString fQueryDir; //directory containing query results and status
39  TString fSessionTag; //tag for the session
40  TString fSessionDir; //directory containing session dependent files
41  Int_t fSeqNum; //sequential number of last processed query
42  Int_t fDrawQueries; //number of draw queries processed
43  Int_t fKeptQueries; //number of queries fully in memory and in dir
44  TList *fQueries; //list of TProofQueryResult objects
45  TList *fPreviousQueries; //list of TProofQueryResult objects from previous sections
46  TProofLockPath *fLock; //dir locker
47  FILE *fLogFile; //log file
48  TStopwatch fCompute; //measures time spend processing a query on the master
49 
50  void AddLogFile(TProofQueryResult *pq);
51 
52 public:
53  TQueryResultManager(const char *qdir, const char *stag, const char *sdir,
54  TProofLockPath *lck, FILE *logfile = 0);
55  virtual ~TQueryResultManager();
56 
57  const char *QueryDir() const { return fQueryDir.Data(); }
58  Int_t SeqNum() const { return fSeqNum; }
59  Int_t DrawQueries() const { return fDrawQueries; }
60  Int_t KeptQueries() const { return fKeptQueries; }
61  TList *Queries() const { return fQueries; }
62  TList *PreviousQueries() const { return fPreviousQueries; }
63 
64  void IncrementSeqNum() { fSeqNum++; }
65  void IncrementDrawQueries() { fDrawQueries++; }
66 
70  TProof *proof, TVirtualProofPlayer *player);
71  Float_t GetCpuTime() { return fCompute.CpuTime(); }
72  Float_t GetRealTime() { return fCompute.RealTime(); }
73  TProofQueryResult *LocateQuery(TString queryref, Int_t &qry, TString &qdir);
74  void RemoveQuery(TQueryResult *qr, Bool_t soft = kFALSE);
75  void RemoveQuery(const char *queryref, TList *otherlist = 0);
76  void ResetTime() { fCompute.Start(); }
77  void SaveQuery(TProofQueryResult *qr, const char *fout = 0);
78  void SaveQuery(TProofQueryResult *qr, Int_t mxq);
79 
80  Int_t LockSession(const char *sessiontag, TProofLockPath **lck);
81  Int_t CleanupSession(const char *sessiontag);
82  void ScanPreviousQueries(const char *dir);
83 
84  ClassDef(TQueryResultManager,0) //PROOF query result manager
85 };
86 
87 #endif
88 
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.
TList * Queries() const
Basic string class.
Definition: TString.h:129
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
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 * QueryDir() const
#define ClassDef(name, id)
Definition: Rtypes.h:297
TList * PreviousQueries() const
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:36
A doubly linked list.
Definition: TList.h:43
Class managing the query-result area.
TProofLockPath * fLock
Bool_t FinalizeQuery(TProofQueryResult *pq, TProof *proof, TVirtualProofPlayer *player)
Final steps after Process() to complete the TQueryResult instance.
const Bool_t kFALSE
Definition: RtypesCore.h:92
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:320
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:37
virtual ~TQueryResultManager()
Cleanup.
Int_t CleanupQueriesDir()
Remove all queries results referring to previous sessions.
Abstract interface for the PROOF player.
const char * Data() const
Definition: TString.h:347
Stopwatch class.
Definition: TStopwatch.h:28