ROOT
6.06/09
Reference Guide
|
Specialization of TTreeCache for parallel Unzipping.
Fabrizio Furano (CERN) Aug 2009 Core TTree-related code borrowed from the previous version by Leandro Franco and Rene Brun
TTreeCache has been specialised in order to let additional threads free to unzip in advance its content. In this implementation we support up to 10 threads, but right now it makes more sense to limit their number to 1-2
The application reading data is carefully synchronized, in order to:
This is supposed to cancel a part of the unzipping latency, at the expenses of cpu time.
The default parameters are the same of the prev version, i.e. 20% of the TTreeCache cache size. To change it use TTreeCache::SetUnzipBufferSize(Long64_t bufferSize) where bufferSize must be passed in bytes.
Definition at line 41 of file TTreeCacheUnzip.h.
Public Types | |
enum | EParUnzipMode { kEnable, kDisable, kForce } |
Public Types inherited from TTreeCache | |
enum | EPrefillType { kNoPrefill, kAllBranches } |
Public Types inherited from TObject | |
enum | EStatusBits { kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13) } |
enum | { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) } |
Public Member Functions | |
TTreeCacheUnzip () | |
TTreeCacheUnzip (TTree *tree, Int_t buffersize=0) | |
Constructor. More... | |
virtual | ~TTreeCacheUnzip () |
Destructor. (in general called by the TFile destructor) More... | |
virtual Int_t | AddBranch (TBranch *b, Bool_t subbranches=kFALSE) |
Add a branch to the list of branches to be stored in the cache this function is called by TBranch::GetBasket Returns: More... | |
virtual Int_t | AddBranch (const char *branch, Bool_t subbranches=kFALSE) |
Add a branch to the list of branches to be stored in the cache this function is called by TBranch::GetBasket Returns: More... | |
Bool_t | FillBuffer () |
Fill the cache buffer with the branches in the cache. More... | |
virtual Int_t | ReadBufferExt (char *buf, Long64_t pos, Int_t len, Int_t &loc) |
void | SetEntryRange (Long64_t emin, Long64_t emax) |
Set the minimum and maximum entry number to be processed this information helps to optimize the number of baskets to read when prefetching the branch buffers. More... | |
virtual void | StopLearningPhase () |
It's the same as TTreeCache::StopLearningPhase but we guarantee that we start the unzipping just after getting the buffers. More... | |
void | UpdateBranches (TTree *tree) |
update pointer to current Tree and recompute pointers to the branches in the cache More... | |
Bool_t | IsActiveThread () |
This indicates if the thread is active in this moment... More... | |
Bool_t | IsQueueEmpty () |
It says if the queue is empty... useful to see if we have to process it. More... | |
void | WaitUnzipStartSignal () |
void | SendUnzipStartSignal (Bool_t broadcast) |
This will send the signal corresponfing to the queue... More... | |
Int_t | GetRecordHeader (char *buf, Int_t maxbytes, Int_t &nbytes, Int_t &objlen, Int_t &keylen) |
Read the logical record header from the buffer buf. More... | |
virtual void | ResetCache () |
This will delete the list of buffers that are in the unzipping cache and will reset certain values in the cache. More... | |
virtual Int_t | GetUnzipBuffer (char **buf, Long64_t pos, Int_t len, Bool_t *free) |
We try to read a buffer that has already been unzipped Returns -1 in case of read failure, 0 in case it's not in the cache and n>0 in case read from cache (number of bytes copied). More... | |
virtual Int_t | SetBufferSize (Int_t buffersize) |
Change the underlying buffer size of the cache. More... | |
void | SetUnzipBufferSize (Long64_t bufferSize) |
Sets the size for the unzipping cache... More... | |
Int_t | UnzipBuffer (char **dest, char *src) |
Unzips a ROOT specific buffer... More... | |
Int_t | UnzipCache (Int_t &startindex, Int_t &locbuffsz, char *&locbuff) |
This inflates all the buffers in the cache. More... | |
Int_t | GetNUnzip () |
Int_t | GetNFound () |
Int_t | GetNMissed () |
void | Print (Option_t *option="") const |
Print cache statistics. More... | |
Public Member Functions inherited from TTreeCache | |
TTreeCache () | |
TTreeCache (TTree *tree, Int_t buffersize=0) | |
Constructor. More... | |
virtual | ~TTreeCache () |
Destructor. (in general called by the TFile destructor) More... | |
virtual Int_t | DropBranch (TBranch *b, Bool_t subbranches=kFALSE) |
Remove a branch to the list of branches to be stored in the cache this function is called by TBranch::GetBasket. More... | |
virtual Int_t | DropBranch (const char *branch, Bool_t subbranches=kFALSE) |
Remove a branch to the list of branches to be stored in the cache this is to be used by user (thats why we pass the name of the branch). More... | |
virtual void | Disable () |
virtual void | Enable () |
const TObjArray * | GetCachedBranches () const |
EPrefillType | GetConfiguredPrefillType () const |
Return the desired prefill type from the environment or resource variable. More... | |
Double_t | GetEfficiency () const |
Give the total efficiency of the cache... More... | |
Double_t | GetEfficiencyRel () const |
This will indicate a sort of relative efficiency... More... | |
virtual Int_t | GetEntryMin () const |
virtual Int_t | GetEntryMax () const |
virtual EPrefillType | GetLearnPrefill () const |
TTree * | GetTree () const |
Bool_t | IsAutoCreated () const |
virtual Bool_t | IsEnabled () const |
virtual Bool_t | IsLearning () const |
virtual void | LearnPrefill () |
Perform an initial prefetch, attempting to read as much of the learning phase baskets for all branches at once. More... | |
virtual Int_t | ReadBuffer (char *buf, Long64_t pos, Int_t len) |
Read buffer at position pos if the request is in the list of prefetched blocks read from fBuffer. More... | |
virtual Int_t | ReadBufferNormal (char *buf, Long64_t pos, Int_t len) |
Old method ReadBuffer before the addition of the prefetch mechanism. More... | |
virtual Int_t | ReadBufferPrefetch (char *buf, Long64_t pos, Int_t len) |
Used to read a chunk from a block previously fetched. More... | |
void | SetAutoCreated (Bool_t val) |
virtual void | SetFile (TFile *file, TFile::ECacheAction action=TFile::kDisconnect) |
Overload to make sure that the object specific. More... | |
virtual void | SetLearnPrefill (EPrefillType type=kNoPrefill) |
Set whether the learning period is started with a prefilling of the cache and which type of prefilling is used. More... | |
void | StartLearningPhase () |
The name should be enough to explain the method. More... | |
Public Member Functions inherited from TFileCacheRead | |
TFileCacheRead () | |
TFileCacheRead (TFile *file, Int_t buffersize, TObject *tree=0) | |
Creates a TFileCacheRead data structure. More... | |
virtual | ~TFileCacheRead () |
Destructor. More... | |
virtual void | AddNoCacheBytesRead (Long64_t len) |
virtual void | AddNoCacheReadCalls (Int_t reads) |
virtual void | Close (Option_t *option="") |
Close out any threads or asynchronous fetches used by the underlying implementation. More... | |
virtual Int_t | GetBufferSize () const |
virtual Long64_t | GetBytesRead () const |
virtual Long64_t | GetNoCacheBytesRead () const |
virtual Long64_t | GetBytesReadExtra () const |
TFile * | GetFile () const |
Int_t | GetNseek () const |
Int_t | GetNtot () const |
virtual Int_t | GetReadCalls () const |
virtual Int_t | GetNoCacheReadCalls () const |
Long64_t | GetPrefetchedBlocks () const |
virtual Bool_t | IsAsyncReading () const |
virtual void | SetEnablePrefetching (Bool_t setPrefetching=kFALSE) |
Set the prefetching mode of this file. More... | |
virtual Bool_t | IsEnablePrefetching () const |
virtual void | Prefetch (Long64_t pos, Int_t len) |
Add block of length len at position pos in the list of blocks to be prefetched. More... | |
virtual Int_t | ReadBufferExtNormal (char *buf, Long64_t pos, Int_t len, Int_t &loc) |
Base function for ReadBuffer. More... | |
virtual Int_t | ReadBufferExtPrefetch (char *buf, Long64_t pos, Int_t len, Int_t &loc) |
prefetch the first block More... | |
virtual void | SetSkipZip (Bool_t=kTRUE) |
virtual void | Sort () |
Sort buffers to be prefetched in increasing order of positions. More... | |
virtual void | SecondSort () |
Sort buffers to be prefetched in increasing order of positions. More... | |
virtual void | SecondPrefetch (Long64_t, Int_t) |
virtual TFilePrefetch * | GetPrefetchObj () |
virtual void | WaitFinishPrefetch () |
Public Member Functions inherited from TObject | |
TObject () | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual | ~TObject () |
TObject destructor. More... | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. More... | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. More... | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. More... | |
virtual void | Clear (Option_t *="") |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. More... | |
virtual void | Copy (TObject &object) const |
Copy this to obj. More... | |
virtual void | Delete (Option_t *option="") |
Delete this object. More... | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. More... | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. More... | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. More... | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current pad. More... | |
virtual void | Dump () const |
Dump contents of object on stdout. More... | |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
Execute method on this object with the given parameter string, e.g. More... | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. More... | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). More... | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. More... | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. More... | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. More... | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual Option_t * | GetOption () const |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). More... | |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". More... | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. More... | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. More... | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). More... | |
virtual Bool_t | IsSortable () const |
Bool_t | IsOnHeap () const |
Bool_t | IsZombie () const |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. More... | |
virtual void | ls (Option_t *option="") const |
The ls function lists the contents of a class on stdout. More... | |
virtual void | Paint (Option_t *option="") |
This method must be overridden if a class wants to paint itself. More... | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. More... | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. More... | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. More... | |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. More... | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". More... | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. More... | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. More... | |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. More... | |
void * | operator new (size_t sz) |
void * | operator new[] (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz, void *vp) |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. More... | |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. More... | |
void | SetBit (UInt_t f) |
void | ResetBit (UInt_t f) |
Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
void | InvertBit (UInt_t f) |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. More... | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More... | |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
Static Public Member Functions | |
static EParUnzipMode | GetParallelUnzip () |
Static function that returns the parallel option (to indicate an additional thread) More... | |
static Bool_t | IsParallelUnzip () |
Static function that tells wether the multithreading unzipping is activated. More... | |
static Int_t | SetParallelUnzip (TTreeCacheUnzip::EParUnzipMode option=TTreeCacheUnzip::kEnable) |
Static function that (de)activates multithreading unzipping. More... | |
static void | SetUnzipRelBufferSize (Float_t relbufferSize) |
static function: Sets the unzip relatibe buffer size More... | |
static void * | UnzipLoop (void *arg) |
This is a static function. More... | |
Static Public Member Functions inherited from TTreeCache | |
static Int_t | GetLearnEntries () |
Static function returning the number of entries used to train the cache see SetLearnEntries. More... | |
static void | SetLearnEntries (Int_t n=10) |
Static function to set the number of entries to be used in learning mode The default value for n is 10. More... | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
Protected Attributes | |
TThread * | fUnzipThread [10] |
Bool_t | fActiveThread |
TCondition * | fUnzipStartCondition |
TCondition * | fUnzipDoneCondition |
Bool_t | fParallel |
Bool_t | fAsyncReading |
TMutex * | fMutexList |
TMutex * | fIOMutex |
Int_t | fCycle |
Int_t | fLastReadPos |
Int_t | fBlocksToGo |
Int_t * | fUnzipLen |
char ** | fUnzipChunks |
[fNseek] Length of the unzipped buffers More... | |
Byte_t * | fUnzipStatus |
[fNseek] Individual unzipped chunks. Their summed size is kept under control. More... | |
Long64_t | fTotalUnzipBytes |
[fNSeek] For each blk, tells us if it's unzipped or pending More... | |
Int_t | fNseekMax |
The total sum of the currently unzipped blks. More... | |
Long64_t | fUnzipBufferSize |
fNseek can change so we need to know its max size More... | |
Int_t | fNUnzip |
Int_t | fNFound |
number of blocks that were unzipped More... | |
Int_t | fNStalls |
number of blocks that were found in the cache More... | |
Int_t | fNMissed |
number of hits which caused a stall More... | |
std::queue< Int_t > | fActiveBlks |
number of blocks that were not found in the cache and were unzipped More... | |
Protected Attributes inherited from TTreeCache | |
Long64_t | fEntryMin |
Long64_t | fEntryMax |
first entry in the cache More... | |
Long64_t | fEntryCurrent |
last entry in the cache More... | |
Long64_t | fEntryNext |
current lowest entry number in the cache More... | |
Int_t | fNbranches |
next entry number where cache must be filled More... | |
Int_t | fNReadOk |
Number of branches in the cache. More... | |
Int_t | fNReadMiss |
Int_t | fNReadPref |
TObjArray * | fBranches |
TList * | fBrNames |
List of branches to be stored in the cache. More... | |
TTree * | fTree |
list of branch names in the cache More... | |
Bool_t | fIsLearning |
pointer to the current Tree More... | |
Bool_t | fIsManual |
true if cache is in learning mode More... | |
Bool_t | fFirstBuffer |
true if cache is StopLearningPhase was used More... | |
Bool_t | fOneTime |
true if first buffer is used for prefetching More... | |
Bool_t | fReverseRead |
used in the learning phase More... | |
Int_t | fFillTimes |
reading in reverse mode More... | |
Bool_t | fFirstTime |
how many times we can fill the current buffer More... | |
Long64_t | fFirstEntry |
save the fact that we processes the first entry More... | |
Bool_t | fReadDirectionSet |
save the value of the first entry More... | |
Bool_t | fEnabled |
read direction established More... | |
EPrefillType | fPrefillType |
cache enabled for cached reading More... | |
Bool_t | fAutoCreated |
Protected Attributes inherited from TFileCacheRead | |
TFilePrefetch * | fPrefetch |
! Object that does the asynchronous reading in another thread More... | |
Int_t | fBufferSizeMin |
Original size of fBuffer. More... | |
Int_t | fBufferSize |
Allocated size of fBuffer (at a given time) More... | |
Int_t | fBufferLen |
Current buffer length (<= fBufferSize) More... | |
Long64_t | fBytesRead |
Number of bytes read for this cache. More... | |
Long64_t | fBytesReadExtra |
Number of extra bytes (overhead) read by the readahead buffer. More... | |
Int_t | fReadCalls |
Number of read calls for this cache. More... | |
Long64_t | fNoCacheBytesRead |
Number of bytes read by basket to fill cached tree. More... | |
Int_t | fNoCacheReadCalls |
Number of read calls by basket to fill cached tree. More... | |
Bool_t | fAsyncReading |
Bool_t | fEnablePrefetching |
reading by prefetching asynchronously More... | |
Int_t | fNseek |
Number of blocks to be prefetched. More... | |
Int_t | fNtot |
Total size of prefetched blocks. More... | |
Int_t | fNb |
Number of long buffers. More... | |
Int_t | fSeekSize |
Allocated size of fSeek. More... | |
Long64_t * | fSeek |
[fNseek] Position on file of buffers to be prefetched More... | |
Long64_t * | fSeekSort |
[fNseek] Position on file of buffers to be prefetched (sorted) More... | |
Int_t * | fSeekIndex |
[fNseek] sorted index table of fSeek More... | |
Long64_t * | fPos |
[fNb] start of long buffers More... | |
Int_t * | fSeekLen |
[fNseek] Length of buffers to be prefetched More... | |
Int_t * | fSeekSortLen |
[fNseek] Length of buffers to be prefetched (sorted) More... | |
Int_t * | fSeekPos |
[fNseek] Position of sorted blocks in fBuffer More... | |
Int_t * | fLen |
[fNb] Length of long buffers More... | |
TFile * | fFile |
Pointer to file. More... | |
char * | fBuffer |
[fBufferSize] buffer of contiguous prefetched blocks More... | |
Bool_t | fIsSorted |
True if fSeek array is sorted. More... | |
Bool_t | fIsTransferred |
True when fBuffer contains something valid. More... | |
Long64_t | fPrefetchedBlocks |
Number of blocks prefetched. More... | |
Int_t | fBNseek |
Int_t | fBNtot |
Int_t | fBNb |
Int_t | fBSeekSize |
Long64_t * | fBSeek |
[fBNseek] More... | |
Long64_t * | fBSeekSort |
[fBNseek] More... | |
Int_t * | fBSeekIndex |
[fBNseek] More... | |
Long64_t * | fBPos |
[fBNb] More... | |
Int_t * | fBSeekLen |
[fBNseek] More... | |
Int_t * | fBSeekSortLen |
[fBNseek] More... | |
Int_t * | fBSeekPos |
[fBNseek] More... | |
Int_t * | fBLen |
[fBNb] More... | |
Bool_t | fBIsSorted |
Bool_t | fBIsTransferred |
Static Protected Attributes | |
static TTreeCacheUnzip::EParUnzipMode | fgParallel = TTreeCacheUnzip::kDisable |
static Double_t | fgRelBuffSize = .5 |
Max Size for the ready unzipped blocks (default is 2*fBufferSize) More... | |
Static Protected Attributes inherited from TTreeCache | |
static Int_t | fgLearnEntries = 100 |
Private Member Functions | |
TTreeCacheUnzip (const TTreeCacheUnzip &) | |
TTreeCacheUnzip & | operator= (const TTreeCacheUnzip &) |
void | Init () |
Initialization procedure common to all the constructors. More... | |
Int_t | StartThreadUnzip (Int_t nthreads) |
The Thread is only a part of the TTreeCache but it is the part that waits for info in the queue and process it... More... | |
Int_t | StopThreadUnzip () |
To stop the thread we only need to change the value of the variable fActiveThread to false and the loop will stop (of course, we will have) to do the cleaning after that. More... | |
Private Attributes | |
char * | fCompBuffer |
Int_t | fCompBufferSize |
Additional Inherited Members | |
Protected Member Functions inherited from TFileCacheRead | |
void | SetEnablePrefetchingImpl (Bool_t setPrefetching=kFALSE) |
TFileCacheRead implementation of SetEnablePrefetching. More... | |
Protected Member Functions inherited from TObject | |
void | MakeZombie () |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
#include <TTreeCacheUnzip.h>
Enumerator | |
---|---|
kEnable | |
kDisable | |
kForce |
Definition at line 45 of file TTreeCacheUnzip.h.
|
private |
TTreeCacheUnzip::TTreeCacheUnzip | ( | ) |
Constructor.
Definition at line 98 of file TTreeCacheUnzip.cxx.
|
virtual |
Destructor. (in general called by the TFile destructor)
Definition at line 168 of file TTreeCacheUnzip.cxx.
Add a branch to the list of branches to be stored in the cache this function is called by TBranch::GetBasket Returns:
Reimplemented from TTreeCache.
Definition at line 194 of file TTreeCacheUnzip.cxx.
Add a branch to the list of branches to be stored in the cache this function is called by TBranch::GetBasket Returns:
Reimplemented from TTreeCache.
Definition at line 208 of file TTreeCacheUnzip.cxx.
|
virtual |
Fill the cache buffer with the branches in the cache.
Reimplemented from TTreeCache.
Definition at line 217 of file TTreeCacheUnzip.cxx.
|
inline |
Definition at line 131 of file TTreeCacheUnzip.h.
|
inline |
Definition at line 132 of file TTreeCacheUnzip.h.
|
inline |
Definition at line 130 of file TTreeCacheUnzip.h.
|
static |
Static function that returns the parallel option (to indicate an additional thread)
Definition at line 369 of file TTreeCacheUnzip.cxx.
Int_t TTreeCacheUnzip::GetRecordHeader | ( | char * | buf, |
Int_t | maxbytes, | ||
Int_t & | nbytes, | ||
Int_t & | objlen, | ||
Int_t & | keylen | ||
) |
Read the logical record header from the buffer buf.
That must be the pointer tho the header part not the object by itself and must contain data of at least maxbytes Returns nread;
In output arguments:
Note that the arguments objlen and keylen are returned only if maxbytes >=16 Note: This was adapted from TFile... so some things dont apply
Definition at line 609 of file TTreeCacheUnzip.cxx.
Referenced by UnzipBuffer(), and UnzipCache().
|
virtual |
We try to read a buffer that has already been unzipped Returns -1 in case of read failure, 0 in case it's not in the cache and n>0 in case read from cache (number of bytes copied).
pos and len are the original values as were passed to ReadBuffer but instead we will return the inflated buffer. Note!! : If *buf == 0 we will allocate the buffer and it will be the responsability of the caller to free it... it is useful for example to pass it to the creator of TBuffer
Reimplemented from TFileCacheRead.
Definition at line 706 of file TTreeCacheUnzip.cxx.
Initialization procedure common to all the constructors.
Definition at line 121 of file TTreeCacheUnzip.cxx.
Referenced by TTreeCacheUnzip().
Bool_t TTreeCacheUnzip::IsActiveThread | ( | ) |
This indicates if the thread is active in this moment...
this variable is very important because if we change it from true to false the thread will stop... ( see StopThreadTreeCacheUnzip() )
Definition at line 390 of file TTreeCacheUnzip.cxx.
Referenced by GetUnzipBuffer(), UnzipCache(), UnzipLoop(), and ~TTreeCacheUnzip().
|
static |
Static function that tells wether the multithreading unzipping is activated.
Definition at line 377 of file TTreeCacheUnzip.cxx.
Referenced by TTree::SetCacheSizeAux().
Bool_t TTreeCacheUnzip::IsQueueEmpty | ( | ) |
It says if the queue is empty... useful to see if we have to process it.
Definition at line 400 of file TTreeCacheUnzip.cxx.
|
private |
Print cache statistics.
Like:
Reimplemented from TTreeCache.
Definition at line 1243 of file TTreeCacheUnzip.cxx.
Reimplemented from TFileCacheRead.
Definition at line 1257 of file TTreeCacheUnzip.cxx.
Referenced by GetUnzipBuffer(), and UnzipCache().
|
virtual |
This will delete the list of buffers that are in the unzipping cache and will reset certain values in the cache.
This name is ambiguos because the method doesn't reset the whole cache, only the part related to the unzipping Note: This method is completely different from TTreeCache::ResetCache(), in that method we were cleaning the prefetching buffer while here we delete the information about the unzipped buffers
Reimplemented from TTreeCache.
Definition at line 641 of file TTreeCacheUnzip.cxx.
Referenced by FillBuffer(), SetBufferSize(), and ~TTreeCacheUnzip().
This will send the signal corresponfing to the queue...
normally used when we want to start processing the list of buffers.
Definition at line 422 of file TTreeCacheUnzip.cxx.
Referenced by GetUnzipBuffer(), ResetCache(), and StopThreadUnzip().
Change the underlying buffer size of the cache.
Returns:
Reimplemented from TTreeCache.
Definition at line 312 of file TTreeCacheUnzip.cxx.
Set the minimum and maximum entry number to be processed this information helps to optimize the number of baskets to read when prefetching the branch buffers.
Reimplemented from TTreeCache.
Definition at line 330 of file TTreeCacheUnzip.cxx.
|
static |
Static function that (de)activates multithreading unzipping.
The possible options are:
Returns 0 if there was an error, 1 otherwise.
Definition at line 445 of file TTreeCacheUnzip.cxx.
Referenced by TTree::SetParallelUnzip(), and TEventIterTree::TEventIterTree().
Sets the size for the unzipping cache...
by default it should be two times the size of the prefetching cache
Definition at line 929 of file TTreeCacheUnzip.cxx.
static function: Sets the unzip relatibe buffer size
Definition at line 920 of file TTreeCacheUnzip.cxx.
Referenced by TTree::SetParallelUnzip().
The Thread is only a part of the TTreeCache but it is the part that waits for info in the queue and process it...
unfortunatly, a Thread is not an object an we have to deal with it in the old C-Style way Returns 0 if the thread was initialized or 1 if it was already running
Definition at line 466 of file TTreeCacheUnzip.cxx.
Referenced by Init().
|
virtual |
It's the same as TTreeCache::StopLearningPhase but we guarantee that we start the unzipping just after getting the buffers.
Reimplemented from TTreeCache.
Definition at line 341 of file TTreeCacheUnzip.cxx.
|
private |
To stop the thread we only need to change the value of the variable fActiveThread to false and the loop will stop (of course, we will have) to do the cleaning after that.
Note: The syncronization part is important here or we will try to delete teh object while it's still processing the queue
Definition at line 509 of file TTreeCacheUnzip.cxx.
Referenced by ~TTreeCacheUnzip().
Int_t TTreeCacheUnzip::UnzipBuffer | ( | char ** | dest, |
char * | src | ||
) |
Unzips a ROOT specific buffer...
by reading the header at the beginning. returns the size of the inflated buffer or -1 if error Note!! : If *dest == 0 we will allocate the buffer and it will be the responsability of the caller to free it... it is useful for example to pass it to the creator of TBuffer src is the original buffer with the record (header+compressed data) *dest is the inflated buffer (including the header)
Definition at line 945 of file TTreeCacheUnzip.cxx.
Referenced by GetUnzipBuffer(), and UnzipCache().
This inflates all the buffers in the cache.
. passing the data to a new buffer that will only wait there to be read... We can not inflate all the buffers in the cache so we will try to do it until the cache gets full... there is a member called fUnzipBufferSize which will tell us the max size we can allocate for this cache.
note that we will unzip in the order they were put into the cache not the order of the transference so it has to be read in that order or the pre-unzipping will be useless.
startindex is used as start index to check for blks to be unzipped
returns 0 in normal conditions or -1 if error, 1 if it would like to sleep
This func is supposed to compete among an indefinite number of threads to get a chunk to inflate in order to accommodate multiple unzippers Since everything is so async, we cannot use a fixed buffer, we are forced to keep the individual chunks as separate blocks, whose summed size does not exceed the maximum allowed. The pointers are kept globally in the array fUnzipChunks
Definition at line 1058 of file TTreeCacheUnzip.cxx.
Referenced by UnzipLoop().
This is a static function.
This is the call that will be executed in the Thread generated by StartThreadTreeCacheUnzip... what we want to do is to inflate the next series of buffers leaving them in the second cache.
Returns 0 when it finishes
Definition at line 538 of file TTreeCacheUnzip.cxx.
Referenced by StartThreadUnzip().
update pointer to current Tree and recompute pointers to the branches in the cache
Reimplemented from TTreeCache.
Definition at line 352 of file TTreeCacheUnzip.cxx.
void TTreeCacheUnzip::WaitUnzipStartSignal | ( | ) |
Definition at line 410 of file TTreeCacheUnzip.cxx.
Referenced by UnzipLoop().
|
protected |
number of blocks that were not found in the cache and were unzipped
Definition at line 82 of file TTreeCacheUnzip.h.
Referenced by ResetCache(), and UnzipCache().
|
protected |
Definition at line 51 of file TTreeCacheUnzip.h.
Referenced by IsActiveThread(), StartThreadUnzip(), and StopThreadUnzip().
|
protected |
Definition at line 55 of file TTreeCacheUnzip.h.
Referenced by Init().
|
protected |
Definition at line 63 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), ResetCache(), and UnzipCache().
|
private |
Definition at line 88 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), and Init().
|
private |
Definition at line 89 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), and Init().
|
protected |
Definition at line 59 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), ResetCache(), UnzipCache(), and UnzipLoop().
|
staticprotected |
Definition at line 60 of file TTreeCacheUnzip.h.
Referenced by GetParallelUnzip(), Init(), IsParallelUnzip(), and SetParallelUnzip().
|
staticprotected |
Max Size for the ready unzipped blocks (default is 2*fBufferSize)
Definition at line 74 of file TTreeCacheUnzip.h.
Referenced by Init(), SetBufferSize(), and SetUnzipRelBufferSize().
|
protected |
Definition at line 57 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), Init(), ReadBufferExt(), and ~TTreeCacheUnzip().
|
protected |
Definition at line 62 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), ResetCache(), and UnzipLoop().
|
protected |
Definition at line 56 of file TTreeCacheUnzip.h.
Referenced by AddBranch(), FillBuffer(), GetUnzipBuffer(), Init(), IsActiveThread(), IsQueueEmpty(), ResetCache(), SetBufferSize(), SetEntryRange(), SetUnzipBufferSize(), StopLearningPhase(), UnzipCache(), UnzipLoop(), UpdateBranches(), and ~TTreeCacheUnzip().
|
protected |
number of blocks that were unzipped
Definition at line 78 of file TTreeCacheUnzip.h.
Referenced by GetNFound(), GetUnzipBuffer(), and Print().
|
protected |
number of hits which caused a stall
Definition at line 80 of file TTreeCacheUnzip.h.
Referenced by GetNMissed(), GetUnzipBuffer(), and Print().
|
protected |
The total sum of the currently unzipped blks.
Definition at line 71 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), and ResetCache().
|
protected |
number of blocks that were found in the cache
Definition at line 79 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), and Print().
|
protected |
Definition at line 77 of file TTreeCacheUnzip.h.
Referenced by GetNUnzip(), Print(), and UnzipCache().
|
protected |
Definition at line 54 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), and Init().
|
protected |
[fNSeek] For each blk, tells us if it's unzipped or pending
Definition at line 69 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), Init(), ResetCache(), and UnzipCache().
|
protected |
fNseek can change so we need to know its max size
Definition at line 72 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), Init(), Print(), SetBufferSize(), SetUnzipBufferSize(), and UnzipCache().
|
protected |
[fNseek] Length of the unzipped buffers
Definition at line 67 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), ResetCache(), UnzipCache(), and ~TTreeCacheUnzip().
|
protected |
Definition at line 53 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), Init(), UnzipCache(), and ~TTreeCacheUnzip().
|
protected |
Definition at line 66 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), ResetCache(), UnzipCache(), and ~TTreeCacheUnzip().
|
protected |
Definition at line 52 of file TTreeCacheUnzip.h.
Referenced by Init(), SendUnzipStartSignal(), WaitUnzipStartSignal(), and ~TTreeCacheUnzip().
|
protected |
[fNseek] Individual unzipped chunks. Their summed size is kept under control.
Definition at line 68 of file TTreeCacheUnzip.h.
Referenced by GetUnzipBuffer(), ResetCache(), UnzipCache(), and ~TTreeCacheUnzip().
|
protected |
Definition at line 50 of file TTreeCacheUnzip.h.
Referenced by Init(), StartThreadUnzip(), and StopThreadUnzip().