ROOT  6.06/09
Reference Guide
TPacketizerUnit.h
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: Long Tran-Thanh 22/07/07
3 // Revised: G. Ganis, May 2011
4 
5 /*************************************************************************
6  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
7  * All rights reserved. *
8  * *
9  * For the licensing terms see $ROOTSYS/LICENSE. *
10  * For the list of contributors see $ROOTSYS/README/CREDITS. *
11  *************************************************************************/
12 
13 #ifndef ROOT_TPacketizerUnit
14 #define ROOT_TPacketizerUnit
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TPacketizerUnit //
19 // //
20 // This packetizer generates packets of generic units, representing the //
21 // number of times an operation cycle has to be repeated by the worker //
22 // node, e.g. the number of Monte carlo events to be generated. //
23 // Packets sizes are generated taking into account the performance of //
24 // worker nodes, based on the time needed to process previous packets, //
25 // with the goal of having all workers ending at the same time. //
26 // //
27 //////////////////////////////////////////////////////////////////////////
28 
29 #ifndef ROOT_TVirtualPacketizer
30 #include "TVirtualPacketizer.h"
31 #endif
32 #ifndef ROOT_TMap
33 #include "TMap.h"
34 #endif
35 
36 
37 class TMessage;
38 class TTimer;
39 class TTree;
40 class TProofStats;
41 class TStopwatch;
42 
43 
45 
46 public: // public because of Sun CC bug
47  class TSlaveStat;
48 
49 private:
50  TList *fPackets; // All processed packets
51  TMap *fWrkStats; // Worker status, keyed by correspondig TSlave
52  TList *fWrkExcluded; // List of nodes excluded from distribution
53  // (submasters with no active workers)
54  TStopwatch *fStopwatch; // For measuring the start time of each packet
55  Long64_t fProcessing; // Event being processed
56  Long64_t fAssigned; // Entries processed or being processed.
57  Double_t fCalibFrac; // Size of the calibrating packet as fraction of Ntot/Nwrk
58  Long64_t fNumPerWorker; // Number of cycles per worker, if this option
59  // is chosen
60  Bool_t fFixedNum; // Whether we must assign a fixed number of cycles per worker
61 
62  Long64_t fPacketSeq; // Sequential number of the last packet assigned
63 
65  TPacketizerUnit(const TPacketizerUnit&); // no implementation, will generate
66  void operator=(const TPacketizerUnit&); // error on accidental usage
67 
68 public:
69  TPacketizerUnit(TList *slaves, Long64_t num, TList *input, TProofProgressStatus *st = 0);
70  virtual ~TPacketizerUnit();
71 
72  Int_t AssignWork(TDSet* /*dset*/, Long64_t /*first*/, Long64_t num);
74 
76 
78  Int_t GetActiveWorkers() { return fWrkStats->GetSize(); }
79 
80  Int_t AddWorkers(TList *workers);
81 
82  ClassDef(TPacketizerUnit,0) //Generate work packets for parallel processing
83 };
84 
85 #endif
long long Long64_t
Definition: RtypesCore.h:69
float Float_t
Definition: RtypesCore.h:53
Definition: TDSet.h:153
Int_t AddWorkers(TList *workers)
Adds new workers. Returns the number of workers added, or -1 on failure.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TDSetElement * GetNextPacket(TSlave *sl, TMessage *r)
Get next packet.
Float_t GetCurrentRate(Bool_t &all)
Get Estimation of the current rate; just summing the current rates of the active workers.
Int_t GetActiveWorkers()
#define ClassDef(name, id)
Definition: Rtypes.h:254
Long64_t fProcessing
Int_t AssignWork(TDSet *, Long64_t, Long64_t num)
Assign work to be done to this packetizer.
A doubly linked list.
Definition: TList.h:47
Long64_t fNumPerWorker
void operator=(const TPacketizerUnit &)
ROOT::R::TRInterface & r
Definition: Object.C:4
virtual ~TPacketizerUnit()
Destructor.
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:57
TStopwatch * fStopwatch
virtual Int_t GetSize() const
Definition: TCollection.h:95
double Double_t
Definition: RtypesCore.h:55
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
A TTree object has a header with a name and a title.
Definition: TTree.h:94
Definition: TSlave.h:50
Double_t GetCurrentTime()
Get current time.
Stopwatch class.
Definition: TStopwatch.h:30