TPacketizer.h

Go to the documentation of this file.
00001 // @(#)root/proofplayer:$Id$
00002 // Author: Maarten Ballintijn    18/03/02
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_TPacketizer
00013 #define ROOT_TPacketizer
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TPacketizer                                                          //
00018 //                                                                      //
00019 // This class generates packets to be processed on PROOF slave servers. //
00020 // A packet is an event range (begin entry and number of entries) or    //
00021 // object range (first object and number of objects) in a TTree         //
00022 // (entries) or a directory (objects) in a file.                        //
00023 // Packets are generated taking into account the performance of the     //
00024 // remote machine, the time it took to process a previous packet on     //
00025 // the remote machine, the locality of the database files, etc.         //
00026 //                                                                      //
00027 //////////////////////////////////////////////////////////////////////////
00028 
00029 #ifndef ROOT_TVirtualPacketizer
00030 #include "TVirtualPacketizer.h"
00031 #endif
00032 
00033 
00034 class TMessage;
00035 class TTimer;
00036 class TTree;
00037 class TMap;
00038 class TProofStats;
00039 
00040 
00041 class TPacketizer : public TVirtualPacketizer {
00042 
00043 public:              // public because of Sun CC bug
00044    class TFileNode;
00045    class TFileStat;
00046    class TSlaveStat;
00047 
00048 private:
00049    TList    *fPackets;      // all processed packets
00050 
00051    TList    *fFileNodes;    // nodes with files
00052    TList    *fUnAllocated;  // nodes with unallocated files
00053    TList    *fActive;       // nodes with unfinished files
00054    TMap     *fSlaveStats;   // slave status, keyed by correspondig TSlave
00055 
00056    Long64_t  fPacketSize;   // global base packet size
00057                                  // It can be set with PROOF_PacketSize
00058                                  // parameter, in the input list.
00059    Int_t     fMaxPerfIdx;   // maximum of our slaves' performance index
00060 
00061    Long_t    fMaxSlaveCnt;  // maximum number of workers per filenode (Long_t to avoid
00062                             // warnings from backward compatibility support)
00063    Int_t     fPacketAsAFraction; // used to calculate the packet size
00064                                  // fPacketSize = fTotalEntries / (fPacketAsAFraction * nslaves)
00065                                  // fPacketAsAFraction can be interpreted as follows:
00066                                  // assuming all slaves have equal processing rate, packet size
00067                                  // is (#events processed by 1 slave) / fPacketSizeAsAFraction.
00068                                  // It can be set with PROOF_PacketAsAFraction in input list.
00069 
00070    TPacketizer();
00071    TPacketizer(const TPacketizer&);     // no implementation, will generate
00072    void operator=(const TPacketizer&);  // error on accidental usage
00073 
00074    TFileNode     *NextUnAllocNode();
00075    void           RemoveUnAllocNode(TFileNode *);
00076 
00077    TFileNode     *NextActiveNode();
00078    void           RemoveActiveNode(TFileNode *);
00079 
00080    TFileStat     *GetNextUnAlloc(TFileNode *node = 0);
00081    TFileStat     *GetNextActive();
00082    void           RemoveActive(TFileStat *file);
00083 
00084    void           Reset();
00085    void           ValidateFiles(TDSet *dset, TList *slaves, Long64_t maxent = -1, Bool_t byfile = kFALSE);
00086 
00087 public:
00088    TPacketizer(TDSet *dset, TList *slaves, Long64_t first, Long64_t num,
00089                 TList *input, TProofProgressStatus *st);
00090    virtual ~TPacketizer();
00091 
00092    TDSetElement *GetNextPacket(TSlave *sl, TMessage *r);
00093    Long64_t      GetEntriesProcessed(TSlave *sl) const;
00094 
00095    Float_t       GetCurrentRate(Bool_t &all);
00096    Int_t         GetActiveWorkers();
00097 
00098    ClassDef(TPacketizer,0)  //Generate work packets for parallel processing
00099 };
00100 
00101 #endif

Generated on Tue Jul 5 14:27:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1