Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 #include "TVirtualPacketizer.h"
30 
31 
32 class TMessage;
33 class TTimer;
34 class TTree;
35 class TMap;
36 class TProofProgressStatus;
37 class TProofStats;
38 
39 class TPacketizer : public TVirtualPacketizer {
40 
41 public: // public because of Sun CC bug
42  class TFileNode;
43  class TFileStat;
44  class TSlaveStat;
45 
46 private:
47  TList *fPackets; // all processed packets
48 
49  TList *fFileNodes; // nodes with files
50  TList *fUnAllocated; // nodes with unallocated files
51  TList *fActive; // nodes with unfinished files
52 
53  Long64_t fPacketSize; // global base packet size
54  // It can be set with PROOF_PacketSize
55  // parameter, in the input list.
56  Int_t fMaxPerfIdx; // maximum of our slaves' performance index
57 
58  Long_t fMaxSlaveCnt; // maximum number of workers per filenode (Long_t to avoid
59  // warnings from backward compatibility support)
60  Int_t fPacketAsAFraction; // used to calculate the packet size
61  // fPacketSize = fTotalEntries / (fPacketAsAFraction * nslaves)
62  // fPacketAsAFraction can be interpreted as follows:
63  // assuming all slaves have equal processing rate, packet size
64  // is (#events processed by 1 slave) / fPacketSizeAsAFraction.
65  // It can be set with PROOF_PacketAsAFraction in input list.
66 
67  // Add workers controls
68  Bool_t fHeuristicPSiz; // Whether the packet size is calculated heuristically
69  Bool_t fDefMaxWrkNode; // Whether the default is used for the max workers per node
70 
71  TPacketizer();
72  TPacketizer(const TPacketizer&); // no implementation, will generate
73  void operator=(const TPacketizer&); // error on accidental usage
74 
75  TFileNode *NextUnAllocNode();
76  void RemoveUnAllocNode(TFileNode *);
77 
78  TFileNode *NextActiveNode();
79  void RemoveActiveNode(TFileNode *);
80 
81  TFileStat *GetNextUnAlloc(TFileNode *node = 0);
82  TFileStat *GetNextActive();
83  void RemoveActive(TFileStat *file);
84 
85  void Reset();
86  void ValidateFiles(TDSet *dset, TList *slaves, Long64_t maxent = -1, Bool_t byfile = kFALSE);
87 
88 public:
89  TPacketizer(TDSet *dset, TList *slaves, Long64_t first, Long64_t num,
90  TList *input, TProofProgressStatus *st);
91  virtual ~TPacketizer();
92 
93  Int_t AddWorkers(TList *workers);
94  TDSetElement *GetNextPacket(TSlave *sl, TMessage *r);
95  Long64_t GetEntriesProcessed(TSlave *sl) const;
96 
97  Float_t GetCurrentRate(Bool_t &all);
98  Int_t GetActiveWorkers();
99 
100  ClassDef(TPacketizer,0) //Generate work packets for parallel processing
101 };
102 
103 #endif