ROOT  6.06/09
Reference Guide
TPacketizer.h
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: Maarten Ballintijn 18/03/02
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2002, 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 #ifndef ROOT_TPacketizer
13 #define ROOT_TPacketizer
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TPacketizer //
18 // //
19 // This class generates packets to be processed on PROOF slave servers. //
20 // A packet is an event range (begin entry and number of entries) or //
21 // object range (first object and number of objects) in a TTree //
22 // (entries) or a directory (objects) in a file. //
23 // Packets are generated taking into account the performance of the //
24 // remote machine, the time it took to process a previous packet on //
25 // the remote machine, the locality of the database files, etc. //
26 // //
27 //////////////////////////////////////////////////////////////////////////
28 
29 #ifndef ROOT_TVirtualPacketizer
30 #include "TVirtualPacketizer.h"
31 #endif
32 
33 
34 class TMessage;
35 class TTimer;
36 class TTree;
37 class TMap;
38 class TProofStats;
39 
40 
42 
43 public: // public because of Sun CC bug
44  class TFileNode;
45  class TFileStat;
46  class TSlaveStat;
47 
48 private:
49  TList *fPackets; // all processed packets
50 
51  TList *fFileNodes; // nodes with files
52  TList *fUnAllocated; // nodes with unallocated files
53  TList *fActive; // nodes with unfinished files
54 
55  Long64_t fPacketSize; // global base packet size
56  // It can be set with PROOF_PacketSize
57  // parameter, in the input list.
58  Int_t fMaxPerfIdx; // maximum of our slaves' performance index
59 
60  Long_t fMaxSlaveCnt; // maximum number of workers per filenode (Long_t to avoid
61  // warnings from backward compatibility support)
62  Int_t fPacketAsAFraction; // used to calculate the packet size
63  // fPacketSize = fTotalEntries / (fPacketAsAFraction * nslaves)
64  // fPacketAsAFraction can be interpreted as follows:
65  // assuming all slaves have equal processing rate, packet size
66  // is (#events processed by 1 slave) / fPacketSizeAsAFraction.
67  // It can be set with PROOF_PacketAsAFraction in input list.
68 
69  // Add workers controls
70  Bool_t fHeuristicPSiz; // Whether the packet size is calculated heuristically
71  Bool_t fDefMaxWrkNode; // Whether the default is used for the max workers per node
72 
73  TPacketizer();
74  TPacketizer(const TPacketizer&); // no implementation, will generate
75  void operator=(const TPacketizer&); // error on accidental usage
76 
77  TFileNode *NextUnAllocNode();
78  void RemoveUnAllocNode(TFileNode *);
79 
80  TFileNode *NextActiveNode();
81  void RemoveActiveNode(TFileNode *);
82 
83  TFileStat *GetNextUnAlloc(TFileNode *node = 0);
84  TFileStat *GetNextActive();
85  void RemoveActive(TFileStat *file);
86 
87  void Reset();
88  void ValidateFiles(TDSet *dset, TList *slaves, Long64_t maxent = -1, Bool_t byfile = kFALSE);
89 
90 public:
91  TPacketizer(TDSet *dset, TList *slaves, Long64_t first, Long64_t num,
92  TList *input, TProofProgressStatus *st);
93  virtual ~TPacketizer();
94 
95  Int_t AddWorkers(TList *workers);
98 
101 
102  ClassDef(TPacketizer,0) //Generate work packets for parallel processing
103 };
104 
105 #endif
long long Long64_t
Definition: RtypesCore.h:69
Int_t fPacketAsAFraction
Definition: TPacketizer.h:62
float Float_t
Definition: RtypesCore.h:53
Int_t GetActiveWorkers()
Return the number of workers still processing.
void operator=(const TPacketizer &)
Definition: TDSet.h:153
TList * fPackets
Definition: TPacketizer.h:46
Float_t GetCurrentRate(Bool_t &all)
Get Estimation of the current rate; just summing the current rates of the active workers.
void RemoveActiveNode(TFileNode *)
Remove node from the list of actives.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual ~TPacketizer()
Destructor.
Long64_t GetEntriesProcessed() const
TDSetElement * GetNextPacket(TSlave *sl, TMessage *r)
Get next packet.
#define ClassDef(name, id)
Definition: Rtypes.h:254
Long64_t fPacketSize
Definition: TPacketizer.h:55
TList * fFileNodes
Definition: TPacketizer.h:51
void Reset()
Reset the internal datastructure for packet distribution.
A doubly linked list.
Definition: TList.h:47
TList * fUnAllocated
Definition: TPacketizer.h:52
void RemoveUnAllocNode(TFileNode *)
Remove unallocated node.
void RemoveActive(TFileStat *file)
Remove file from the list of actives.
ROOT::R::TRInterface & r
Definition: Object.C:4
Int_t fMaxPerfIdx
Definition: TPacketizer.h:58
TFileNode * NextUnAllocNode()
Get next unallocated node.
TFileStat * GetNextUnAlloc(TFileNode *node=0)
Get next unallocated file.
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:57
Long_t fMaxSlaveCnt
Definition: TPacketizer.h:60
long Long_t
Definition: RtypesCore.h:50
Int_t AddWorkers(TList *workers)
Adds new workers. Returns the number of workers added, or -1 on failure.
Bool_t fHeuristicPSiz
Definition: TPacketizer.h:70
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
void ValidateFiles(TDSet *dset, TList *slaves, Long64_t maxent=-1, Bool_t byfile=kFALSE)
Check existence of file/dir/tree an get number of entries.
TList * fActive
Definition: TPacketizer.h:53
A TTree object has a header with a name and a title.
Definition: TTree.h:94
Definition: TSlave.h:50
TFileStat * GetNextActive()
Get next active file.
Bool_t fDefMaxWrkNode
Definition: TPacketizer.h:71
TFileNode * NextActiveNode()
Get next active node.