ROOT logo
// @(#)root/proofplayer:$Id: TPacketizerUnit.h 39088 2011-05-04 11:10:47Z ganis $
// Author: Long Tran-Thanh    22/07/07
// Revised: G. Ganis, May 2011

/*************************************************************************
 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TPacketizerUnit
#define ROOT_TPacketizerUnit

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TPacketizerUnit                                                      //
//                                                                      //
// This packetizer generates packets of generic units, representing the //
// number of times an operation cycle has to be repeated by the worker  //
// node, e.g. the number of Monte carlo events to be generated.         //
// Packets sizes are generated taking into account the performance of   //
// worker nodes, based on the time needed to process previous packets,  //
// with the goal of having all workers ending at the same time.         // 
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TVirtualPacketizer
#include "TVirtualPacketizer.h"
#endif
#ifndef ROOT_TMap
#include "TMap.h"
#endif


class TMessage;
class TTimer;
class TTree;
class TProofStats;
class TStopwatch;


class TPacketizerUnit : public TVirtualPacketizer {

public:              // public because of Sun CC bug
   class TSlaveStat;

private:
   TList      *fPackets;         // All processed packets
   TMap       *fWrkStats;        // Worker status, keyed by correspondig TSlave
   TStopwatch *fStopwatch;       // For measuring the start time of each packet
   Long64_t    fProcessing;      // Event being processed
   Long64_t    fAssigned;        // Entries processed or being processed.
   Double_t    fCalibFrac;       // Size of the calibrating packet as fraction of Ntot/Nwrk
   Long64_t    fNumPerWorker;    // Number of cycles per worker, if this option
                                 // is chosen

   TPacketizerUnit();
   TPacketizerUnit(const TPacketizerUnit&);     // no implementation, will generate
   void operator=(const TPacketizerUnit&);  // error on accidental usage

public:
   TPacketizerUnit(TList *slaves, Long64_t num, TList *input, TProofProgressStatus *st = 0);
   virtual ~TPacketizerUnit();

   TDSetElement *GetNextPacket(TSlave *sl, TMessage *r);

   Double_t      GetCurrentTime();

   Float_t       GetCurrentRate(Bool_t &all);
   Int_t         GetActiveWorkers() { return fWrkStats->GetSize(); }

   ClassDef(TPacketizerUnit,0)  //Generate work packets for parallel processing
};

#endif
 TPacketizerUnit.h:1
 TPacketizerUnit.h:2
 TPacketizerUnit.h:3
 TPacketizerUnit.h:4
 TPacketizerUnit.h:5
 TPacketizerUnit.h:6
 TPacketizerUnit.h:7
 TPacketizerUnit.h:8
 TPacketizerUnit.h:9
 TPacketizerUnit.h:10
 TPacketizerUnit.h:11
 TPacketizerUnit.h:12
 TPacketizerUnit.h:13
 TPacketizerUnit.h:14
 TPacketizerUnit.h:15
 TPacketizerUnit.h:16
 TPacketizerUnit.h:17
 TPacketizerUnit.h:18
 TPacketizerUnit.h:19
 TPacketizerUnit.h:20
 TPacketizerUnit.h:21
 TPacketizerUnit.h:22
 TPacketizerUnit.h:23
 TPacketizerUnit.h:24
 TPacketizerUnit.h:25
 TPacketizerUnit.h:26
 TPacketizerUnit.h:27
 TPacketizerUnit.h:28
 TPacketizerUnit.h:29
 TPacketizerUnit.h:30
 TPacketizerUnit.h:31
 TPacketizerUnit.h:32
 TPacketizerUnit.h:33
 TPacketizerUnit.h:34
 TPacketizerUnit.h:35
 TPacketizerUnit.h:36
 TPacketizerUnit.h:37
 TPacketizerUnit.h:38
 TPacketizerUnit.h:39
 TPacketizerUnit.h:40
 TPacketizerUnit.h:41
 TPacketizerUnit.h:42
 TPacketizerUnit.h:43
 TPacketizerUnit.h:44
 TPacketizerUnit.h:45
 TPacketizerUnit.h:46
 TPacketizerUnit.h:47
 TPacketizerUnit.h:48
 TPacketizerUnit.h:49
 TPacketizerUnit.h:50
 TPacketizerUnit.h:51
 TPacketizerUnit.h:52
 TPacketizerUnit.h:53
 TPacketizerUnit.h:54
 TPacketizerUnit.h:55
 TPacketizerUnit.h:56
 TPacketizerUnit.h:57
 TPacketizerUnit.h:58
 TPacketizerUnit.h:59
 TPacketizerUnit.h:60
 TPacketizerUnit.h:61
 TPacketizerUnit.h:62
 TPacketizerUnit.h:63
 TPacketizerUnit.h:64
 TPacketizerUnit.h:65
 TPacketizerUnit.h:66
 TPacketizerUnit.h:67
 TPacketizerUnit.h:68
 TPacketizerUnit.h:69
 TPacketizerUnit.h:70
 TPacketizerUnit.h:71
 TPacketizerUnit.h:72
 TPacketizerUnit.h:73
 TPacketizerUnit.h:74
 TPacketizerUnit.h:75
 TPacketizerUnit.h:76
 TPacketizerUnit.h:77