Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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;
33 class TVirtualProofPlayer;
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 
67  Int_t ApplyMaxQueries(Int_t mxq);
68  Int_t CleanupQueriesDir();
69  Bool_t FinalizeQuery(TProofQueryResult *pq,
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