00001 // @(#)root/proofplayer:$Id: TPacketizerUnit.h 34748 2010-08-09 10:18:05Z ganis $ 00002 // Author: Long Tran-Thanh 22/07/07 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TPacketizerUnit 00013 #define ROOT_TPacketizerUnit 00014 00015 ////////////////////////////////////////////////////////////////////////// 00016 // // 00017 // TPacketizerUnit // 00018 // // 00019 // This packetizer generates packets of generic units, representing the // 00020 // number of times an operation cycle has to be repeated by the worker // 00021 // node, e.g. the number of Monte carlo events to be generated. // 00022 // Packets sizes are generated taking into account the performance of // 00023 // worker nodes, based on the time needed to process previous packets. // 00024 // // 00025 ////////////////////////////////////////////////////////////////////////// 00026 00027 #ifndef ROOT_TVirtualPacketizer 00028 #include "TVirtualPacketizer.h" 00029 #endif 00030 #ifndef ROOT_TMap 00031 #include "TMap.h" 00032 #endif 00033 00034 00035 class TMessage; 00036 class TTimer; 00037 class TTree; 00038 class TProofStats; 00039 class TStopwatch; 00040 00041 00042 class TPacketizerUnit : public TVirtualPacketizer { 00043 00044 public: // public because of Sun CC bug 00045 class TSlaveStat; 00046 00047 private: 00048 TList *fPackets; // All processed packets 00049 TMap *fSlaveStats; // Slave status, keyed by correspondig TSlave 00050 TStopwatch *fStopwatch; // For measuring the start time of each packet 00051 Long64_t fProcessing; // Event being processed 00052 Long64_t fAssigned; // Entries processed or being processed. 00053 Long64_t fCalibNum; // Size of the calibrating packet 00054 Long64_t fNumPerWorker; // Number of cycles per worker, if this option 00055 // is chosen 00056 00057 TPacketizerUnit(); 00058 TPacketizerUnit(const TPacketizerUnit&); // no implementation, will generate 00059 void operator=(const TPacketizerUnit&); // error on accidental usage 00060 00061 public: 00062 TPacketizerUnit(TList *slaves, Long64_t num, TList *input, TProofProgressStatus *st = 0); 00063 virtual ~TPacketizerUnit(); 00064 00065 TDSetElement *GetNextPacket(TSlave *sl, TMessage *r); 00066 00067 Double_t GetCurrentTime(); 00068 00069 Float_t GetCurrentRate(Bool_t &all); 00070 Int_t GetActiveWorkers() { return fSlaveStats->GetSize(); } 00071 00072 ClassDef(TPacketizerUnit,0) //Generate work packets for parallel processing 00073 }; 00074 00075 #endif