ROOT
6.07/01
Reference Guide
|
A specialized TFileCacheRead object for a TTree.
This class acts as a file cache, registering automatically the baskets from the branches being processed (TTree::Draw or TTree::Process and TSelectors) when in the learning phase. The learning phase is by default 100 entries. It can be changed via TTreeCache::SetLearnEntries.
This cache speeds-up considerably the performance, in particular when the Tree is accessed remotely via a high latency network.
The default cache size (10 Mbytes) may be changed via the function TTree::SetCacheSize
Only the baskets for the requested entry range are put in the cache
For each Tree being processed a TTreeCache object is created. This object is automatically deleted when the Tree is deleted or when the file is deleted.
The learning period is started or restarted when:
The learning period is stopped (and prefetching is actually started) when:
When writing a TTree, the branch buffers are kept in memory. A typical branch buffersize (before compression) is typically 32 KBytes. After compression, the zipped buffer may be just a few Kbytes. The branch buffers cannot be much larger in case of Trees with several hundred or thousand branches.
When writing, this does not generate a performance problem because branch buffers are always written sequentially and the OS is in general clever enough to flush the data to the output file when a few MBytes of data have to be written. When reading at the contrary, one may hit a performance problem when reading across a network (LAN or WAN) and the network latency is high. For example in a WAN with 10ms latency, reading 1000 buffers of 10 KBytes each with no cache will imply 10s penalty where a local read of the 10 MBytes would take about 1 second.
The TreeCache will try to prefetch all the buffers for the selected branches such that instead of transfering 1000 buffers of 10 Kbytes, it will be able to transfer one single large buffer of 10 Mbytes in one single transaction. Not only the TreeCache minimizes the number of transfers, but in addition it can sort the blocks to be read in increasing order such that the file is read sequentially.
Systems like xrootd, dCache or httpd take advantage of the TreeCache in reading ahead as much data as they can and return to the application the maximum data specified in the cache and have the next chunk of data ready when the next request comes.
A few use cases are discussed below. A cache may be created with automatic sizing when a TTree is used:
Caches are created and automatically sized for TTrees when TTreeCache.Size or the environment variable ROOT_TTREECACHE_SIZE is set to a sizing factor.
But there are many possible configurations where manual control may be wanted. In some applications you know a priori the list of branches to read. In other applications the analysis loop calls several layers of user functions where it is impossible to predict a priori which branches will be used. This is probably the most frequent case. In this case ROOT I/O will flag used branches automatically when a branch buffer is read during the learning phase. The TreeCache interface provides functions to instruct the cache about the used branches if they are known a priori. In the examples below, portions of analysis code are shown. The few statements involving the TreeCache are marked with //<<<
the TreeCache is automatically used by TTree::Draw. The function knows which branches are used in the query and it puts automatically these branches in the cache. The entry range is also known automatically.
You must enable the cache and tell the system which branches to cache and also specify the entry range. It is important to specify the entry range in case you process only a subset of the events, otherwise you run the risk to store in the cache entries that you do not need.
in the Process function we read a subset of the branches. Only the branches used in the first entry will be put in the cache
in your analysis loop, you always use 2 branches. You want to prefetch the branch buffers for these 2 branches only.
in your analysis loop, you always use 2 branches in the main loop. you also call some analysis functions where a few more branches will be read. but you do not know a priori which ones. There is no point in prefetching branches that will be used very rarely.
When reading only a small fraction of all entries such that not all branch buffers are read, it might be faster to run without a cache.
Once your analysis loop has terminated, you can access/print the number of effective system reads for a given file with a code like (where TFile* f is a pointer to your file)
Definition at line 34 of file TTreeCache.h.
Public Types | |
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 | |
TTreeCache () | |
TTreeCache (TTree *tree, Int_t buffersize=0) | |
Constructor. More... | |
virtual | ~TTreeCache () |
Destructor. (in general called by the TFile destructor) More... | |
virtual Int_t | AddBranch (TBranch *b, Bool_t subgbranches=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 is to be used by user (thats why we pass the name of the branch). 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 Bool_t | FillBuffer () |
Fill the cache buffer with the branches in the cache. More... | |
virtual void | LearnPrefill () |
Perform an initial prefetch, attempting to read as much of the learning phase baskets for all branches at once. More... | |
virtual void | Print (Option_t *option="") const |
Print cache statistics. 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... | |
virtual void | ResetCache () |
This will simply clear the cache. More... | |
void | SetAutoCreated (Bool_t val) |
virtual Int_t | SetBufferSize (Int_t buffersize) |
Change the underlying buffer size of the cache. More... | |
virtual 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 | 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... | |
virtual void | StopLearningPhase () |
This is the counterpart of StartLearningPhase() and can be used to stop the learning phase. More... | |
virtual void | UpdateBranches (TTree *tree) |
Update pointer to current Tree and recompute pointers to the branches in the cache. 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 |
virtual Int_t | GetUnzipBuffer (char **, Long64_t, Int_t, Bool_t *) |
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 | ReadBufferExt (char *buf, Long64_t pos, Int_t len, Int_t &loc) |
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 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 | |
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 Int_t | fgLearnEntries = 100 |
Private Member Functions | |
TTreeCache (const TTreeCache &) | |
true if cache was automatically created More... | |
TTreeCache & | operator= (const TTreeCache &) |
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 <TTreeCache.h>
Enumerator | |
---|---|
kNoPrefill | |
kAllBranches |
Definition at line 37 of file TTreeCache.h.
|
private |
true if cache was automatically created
TTreeCache::TTreeCache | ( | ) |
Constructor.
Definition at line 280 of file TTreeCache.cxx.
|
virtual |
Destructor. (in general called by the TFile destructor)
Definition at line 313 of file TTreeCache.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 TFileCacheRead.
Reimplemented in TTreeCacheUnzip.
Definition at line 330 of file TTreeCache.cxx.
Referenced by AddBranch(), TTreeCacheUnzip::AddBranch(), TTree::AddBranchToCache(), and LearnPrefill().
Add 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).
It works in exactly the same way as TTree::SetBranchStatus so you probably want to look over ther for details about the use of bname with regular expressions. The branches are taken with respect to the Owner of this TTreeCache (i.e. the original Tree) NB: if bname="*" all branches are put in the cache and the learning phase stopped Returns:
Reimplemented from TFileCacheRead.
Reimplemented in TTreeCacheUnzip.
Definition at line 387 of file TTreeCache.cxx.
|
inlinevirtual |
Definition at line 78 of file TTreeCache.h.
Referenced by TBasket::LoadBasketBuffers(), and TBasket::ReadBasketBuffers().
Remove a branch to the list of branches to be stored in the cache this function is called by TBranch::GetBasket.
Returns:
Definition at line 482 of file TTreeCache.cxx.
Referenced by DropBranch(), TTree::DropBranchFromCache(), and LearnPrefill().
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).
It works in exactly the same way as TTree::SetBranchStatus so you probably want to look over ther for details about the use of bname with regular expresions. The branches are taken with respect to the Owner of this TTreeCache (i.e. the original Tree) NB: if bname="*" all branches are put in the cache and the learning phase stopped Returns:
Definition at line 527 of file TTreeCache.cxx.
|
inlinevirtual |
Definition at line 79 of file TTreeCache.h.
Referenced by TBasket::LoadBasketBuffers(), and TBasket::ReadBasketBuffers().
|
virtual |
Fill the cache buffer with the branches in the cache.
Reimplemented in TTreeCacheUnzip.
Definition at line 617 of file TTreeCache.cxx.
Referenced by LearnPrefill(), ReadBufferNormal(), ReadBufferPrefetch(), and StopLearningPhase().
|
inline |
Definition at line 80 of file TTreeCache.h.
Referenced by Print().
TTreeCache::EPrefillType TTreeCache::GetConfiguredPrefillType | ( | ) | const |
Return the desired prefill type from the environment or resource variable.
Definition at line 922 of file TTreeCache.cxx.
Double_t TTreeCache::GetEfficiency | ( | ) | const |
Give the total efficiency of the cache...
defined as the ratio of blocks found in the cache vs. the number of blocks prefetched ( it could be more than 1 if we read the same block from the cache more than once )
Note: This should eb used at the end of the processing or we will get uncomplete stats
Definition at line 945 of file TTreeCache.cxx.
Referenced by Print().
Double_t TTreeCache::GetEfficiencyRel | ( | ) | const |
This will indicate a sort of relative efficiency...
a ratio of the reads found in the cache to the number of reads so far
Definition at line 957 of file TTreeCache.cxx.
Referenced by Print().
|
inlinevirtual |
Definition at line 85 of file TTreeCache.h.
|
inlinevirtual |
Definition at line 84 of file TTreeCache.h.
|
static |
Static function returning the number of entries used to train the cache see SetLearnEntries.
Definition at line 969 of file TTreeCache.cxx.
Referenced by TEventIterTree::GetLearnEntries(), and Print().
|
inlinevirtual |
Definition at line 87 of file TTreeCache.h.
|
inline |
Definition at line 88 of file TTreeCache.h.
Referenced by FillBuffer(), TTreeCacheUnzip::FillBuffer(), and TTree::GetReadCache().
|
inline |
Definition at line 89 of file TTreeCache.h.
Referenced by TTree::SetCacheSizeAux().
|
inlinevirtual |
Definition at line 90 of file TTreeCache.h.
|
inlinevirtual |
Reimplemented from TFileCacheRead.
Definition at line 91 of file TTreeCache.h.
Referenced by TEventIterTree::GetTrees(), and TEventIterTree::PreProcessEvent().
|
virtual |
Perform an initial prefetch, attempting to read as much of the learning phase baskets for all branches at once.
Definition at line 1291 of file TTreeCache.cxx.
Referenced by AddBranch().
|
private |
Print cache statistics.
Like:
Reimplemented from TFileCacheRead.
Reimplemented in TTreeCacheUnzip.
Definition at line 994 of file TTreeCache.cxx.
Referenced by TTreeCacheUnzip::Print(), and TTree::PrintCacheStats().
Read buffer at position pos if the request is in the list of prefetched blocks read from fBuffer.
Otherwise try to fill the cache from the list of selected branches, and recheck if pos is now in the list. Returns:
Reimplemented from TFileCacheRead.
Definition at line 1089 of file TTreeCache.cxx.
Old method ReadBuffer before the addition of the prefetch mechanism.
Definition at line 1020 of file TTreeCache.cxx.
Referenced by ReadBuffer().
Used to read a chunk from a block previously fetched.
It will call FillBuffer even if the cache lookup succeeds, because it will try to prefetch the next block as soon as we start reading from the current block.
Definition at line 1049 of file TTreeCache.cxx.
Referenced by ReadBuffer().
|
virtual |
This will simply clear the cache.
Reimplemented in TTreeCacheUnzip.
Definition at line 1102 of file TTreeCache.cxx.
Referenced by TChain::LoadTree().
Definition at line 101 of file TTreeCache.h.
Referenced by TTree::SetCacheSizeAux().
Change the underlying buffer size of the cache.
If the change of size means some cache content is lost, or if the buffer is now larger, setup for a cache refill the next time there is a read Returns:
Reimplemented from TFileCacheRead.
Reimplemented in TTreeCacheUnzip.
Definition at line 1121 of file TTreeCache.cxx.
Referenced by TTreeCacheUnzip::SetBufferSize(), and TTree::SetCacheSizeAux().
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 in TTreeCacheUnzip.
Definition at line 1154 of file TTreeCache.cxx.
Referenced by TEventIterTree::GetNextEvent(), TEventIterTree::GetNextPacket(), TTreePlayer::Process(), TTree::SetCacheEntryRange(), and TTreeCacheUnzip::SetEntryRange().
|
virtual |
Overload to make sure that the object specific.
Reimplemented from TFileCacheRead.
Definition at line 1176 of file TTreeCache.cxx.
Static function to set the number of entries to be used in learning mode The default value for n is 10.
n must be >= 1
Definition at line 1193 of file TTreeCache.cxx.
Referenced by TTree::SetCacheLearnEntries().
|
virtual |
Set whether the learning period is started with a prefilling of the cache and which type of prefilling is used.
The two value currently supported are:
Definition at line 1208 of file TTreeCache.cxx.
void TTreeCache::StartLearningPhase | ( | ) |
The name should be enough to explain the method.
The only additional comments is that the cache is cleaned before the new learning phase.
Definition at line 1218 of file TTreeCache.cxx.
Referenced by SetEntryRange().
|
virtual |
This is the counterpart of StartLearningPhase() and can be used to stop the learning phase.
It's useful when the user knows exactly what branches they are going to use. For the moment it's just a call to FillBuffer() since that method will create the buffer lists from the specified branches.
Reimplemented in TTreeCacheUnzip.
Definition at line 1235 of file TTreeCache.cxx.
Referenced by AddBranch(), FillBuffer(), TTree::StopCacheLearningPhase(), and TTreeCacheUnzip::StopLearningPhase().
Update pointer to current Tree and recompute pointers to the branches in the cache.
Reimplemented in TTreeCacheUnzip.
Definition at line 1255 of file TTreeCache.cxx.
Referenced by TEventIterTree::GetTrees(), TChain::LoadTree(), and TTreeCacheUnzip::UpdateBranches().
|
protected |
Definition at line 63 of file TTreeCache.h.
Referenced by IsAutoCreated(), and SetAutoCreated().
|
protected |
Definition at line 48 of file TTreeCache.h.
Referenced by AddBranch(), DropBranch(), FillBuffer(), TTreeCacheUnzip::FillBuffer(), GetCachedBranches(), TTreeCache(), TTreeCacheUnzip::UnzipBuffer(), UpdateBranches(), and ~TTreeCache().
|
protected |
List of branches to be stored in the cache.
Definition at line 49 of file TTreeCache.h.
Referenced by AddBranch(), DropBranch(), StartLearningPhase(), UpdateBranches(), and ~TTreeCache().
|
protected |
read direction established
Definition at line 60 of file TTreeCache.h.
Referenced by Disable(), Enable(), IsEnabled(), and ReadBuffer().
|
protected |
last entry in the cache
Definition at line 42 of file TTreeCache.h.
Referenced by FillBuffer(), TTreeCacheUnzip::FillBuffer(), LearnPrefill(), SetBufferSize(), StartLearningPhase(), and UpdateBranches().
|
protected |
first entry in the cache
Definition at line 41 of file TTreeCache.h.
Referenced by FillBuffer(), TTreeCacheUnzip::FillBuffer(), GetEntryMax(), LearnPrefill(), SetEntryRange(), and UpdateBranches().
|
protected |
Definition at line 40 of file TTreeCache.h.
Referenced by AddBranch(), FillBuffer(), TTreeCacheUnzip::FillBuffer(), GetEntryMin(), LearnPrefill(), SetEntryRange(), TTreeCache(), and UpdateBranches().
|
protected |
current lowest entry number in the cache
Definition at line 43 of file TTreeCache.h.
Referenced by AddBranch(), DropBranch(), FillBuffer(), TTreeCacheUnzip::FillBuffer(), LearnPrefill(), SetBufferSize(), SetEntryRange(), StopLearningPhase(), TTreeCache(), and UpdateBranches().
|
protected |
|
protected |
true if cache is StopLearningPhase was used
Definition at line 53 of file TTreeCache.h.
Referenced by FillBuffer().
|
protected |
save the fact that we processes the first entry
Definition at line 58 of file TTreeCache.h.
Referenced by FillBuffer().
|
protected |
how many times we can fill the current buffer
Definition at line 57 of file TTreeCache.h.
Referenced by FillBuffer(), and ResetCache().
|
staticprotected |
Definition at line 62 of file TTreeCache.h.
Referenced by GetLearnEntries(), SetEntryRange(), SetLearnEntries(), TTreeCache(), and UpdateBranches().
|
protected |
pointer to the current Tree
Definition at line 51 of file TTreeCache.h.
Referenced by AddBranch(), DropBranch(), FillBuffer(), TTreeCacheUnzip::FillBuffer(), TTreeCacheUnzip::GetUnzipBuffer(), IsLearning(), TTreeCacheUnzip::IsQueueEmpty(), LearnPrefill(), SetBufferSize(), SetEntryRange(), StartLearningPhase(), StopLearningPhase(), TTreeCacheUnzip::UnzipCache(), and UpdateBranches().
|
protected |
true if cache is in learning mode
Definition at line 52 of file TTreeCache.h.
Referenced by FillBuffer(), LearnPrefill(), SetEntryRange(), StartLearningPhase(), and StopLearningPhase().
|
protected |
next entry number where cache must be filled
Definition at line 44 of file TTreeCache.h.
Referenced by AddBranch(), DropBranch(), FillBuffer(), TTreeCacheUnzip::FillBuffer(), LearnPrefill(), Print(), StartLearningPhase(), and UpdateBranches().
|
protected |
Definition at line 46 of file TTreeCache.h.
Referenced by GetEfficiencyRel(), ReadBufferNormal(), and ReadBufferPrefetch().
|
protected |
Number of branches in the cache.
Definition at line 45 of file TTreeCache.h.
Referenced by GetEfficiency(), GetEfficiencyRel(), ReadBufferNormal(), and ReadBufferPrefetch().
|
protected |
Definition at line 47 of file TTreeCache.h.
Referenced by FillBuffer(), TTreeCacheUnzip::FillBuffer(), and GetEfficiency().
|
protected |
true if first buffer is used for prefetching
Definition at line 54 of file TTreeCache.h.
Referenced by StopLearningPhase().
|
protected |
cache enabled for cached reading
Definition at line 61 of file TTreeCache.h.
Referenced by GetLearnPrefill(), LearnPrefill(), and SetLearnPrefill().
|
protected |
save the value of the first entry
Definition at line 59 of file TTreeCache.h.
Referenced by FillBuffer().
|
protected |
|
protected |
list of branch names in the cache
Definition at line 50 of file TTreeCache.h.
Referenced by AddBranch(), DropBranch(), FillBuffer(), TTreeCacheUnzip::FillBuffer(), GetTree(), Print(), SetFile(), UpdateBranches(), and ~TTreeCache().