12 #ifndef ROOT_TTreeCache 13 #define ROOT_TTreeCache Bool_t CheckMissCache(char *buf, Long64_t pos, int len)
Check the miss cache for a particular buffer, fetching if deemed necessary.
std::vector< char > fData
! Actual data in the cache.
Long64_t fEntryMax
! last entry in the cache
Double_t GetMissEfficiencyRel() const
Relative efficiency of the 'miss cache' - ratio of the reads found in cache to the number of reads so...
Int_t fNReadOk
Number of blocks read and found in the cache.
const TObjArray * GetCachedBranches() const
std::vector< Entry > fEntries
! Description of buffers in the miss cache.
TObjArray * fBranches
! List of branches to be stored in the cache
A cache when reading files over the network.
Long64_t fLastMiss
! set to the event # of the last miss.
Bool_t fOneTime
! used in the learning phase
Int_t fNMissReadMiss
Number of blocks read and not found in either cache.
virtual EPrefillType GetLearnPrefill() const
virtual void SetLearnPrefill(EPrefillType type=kNoPrefill)
Set whether the learning period is started with a prefilling of the cache and which type of prefillin...
A specialized TFileCacheRead object for a TTree.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Long64_t fEntryMin
! first entry in the cache
virtual void StopLearningPhase()
This is the counterpart of StartLearningPhase() and can be used to stop the learning phase...
virtual void LearnPrefill()
Perform an initial prefetch, attempting to read as much of the learning phase baskets for all branche...
void SetAutoCreated(Bool_t val)
void StartLearningPhase()
The name should be enough to explain the method.
Bool_t CalculateMissCache()
Calculate the appropriate miss cache to fetch; helper function for FillMissCache. ...
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::Ge...
Bool_t fAutoCreated
! true if cache was automatically created
Int_t fNMissReadPref
Number of blocks read into the secondary ("miss") cache.
Long64_t fNextClusterStart
! End+1 of the cluster(s) where the current content was picked out
virtual Int_t ReadBufferNormal(char *buf, Long64_t pos, Int_t len)
Old method ReadBuffer before the addition of the prefetch mechanism.
Bool_t FillMissCache()
Fill the miss cache from the current set of active branches.
IOPos FindBranchBasketPos(TBranch &, Long64_t entry)
Given a branch and an entry, determine the file location (offset / size) of the corresponding basket...
#define ClassDef(name, id)
Bool_t IsAutoCreated() const
Bool_t fOptimizeMisses
! true if we should optimize cache misses.
Bool_t GetOptimizeMisses() const
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...
virtual void ResetCache()
This will simply clear the cache.
Bool_t fEnabled
! cache enabled for cached reading
TBranch * CalculateMissEntries(Long64_t, int, bool)
Given an file read, try to determine the corresponding branch.
Double_t GetEfficiencyRel() const
This will indicate a sort of relative efficiency...
TTree * fTree
! pointer to the current Tree
EPrefillType GetConfiguredPrefillType() const
Return the desired prefill type from the environment or resource variable.
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 numbe...
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:...
virtual Bool_t IsEnabled() const
virtual Int_t ReadBufferPrefetch(char *buf, Long64_t pos, Int_t len)
Used to read a chunk from a block previously fetched.
virtual ~TTreeCache()
Destructor. (in general called by the TFile destructor)
Bool_t fReadDirectionSet
! read direction established
Int_t fNReadMiss
Number of blocks read and not found in the cache.
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 1...
std::unique_ptr< MissCache > fMissCache
! Cache contents for misses
Long64_t fCurrentClusterStart
! Start of the cluster(s) where the current content was picked out
virtual Bool_t FillBuffer()
Fill the cache buffer with the branches in the cache.
Int_t fNReadPref
Number of blocks that were prefetched.
void SetOptimizeMisses(Bool_t opt)
Start of methods for the miss cache.
friend bool operator<(const Entry &a, const Entry &b)
Bool_t fReverseRead
! reading in reverse mode
Bool_t fFirstTime
! save the fact that we processes the first entry
Long64_t fEntryCurrent
! current lowest entry number in the cache
TTreeCache()
Default Constructor.
virtual void Print(Option_t *option="") const
Print cache statistics.
Bool_t fIsLearning
! true if cache is in learning mode
virtual Int_t GetEntryMax() const
unsigned long long ULong64_t
void ResetMissCache()
Reset all the miss cache training.
virtual void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect)
Overload to make sure that the object specific.
IOPos(Long64_t pos, Int_t len)
Int_t fNMissReadOk
Number of blocks read, not found in the primary cache, and found in the secondary cache...
EPrefillType fPrefillType
Whether a pre-filling is enabled (and if applicable which type)
Long64_t fFirstMiss
! set to the event # of the first miss.
Int_t fFillTimes
! how many times we can fill the current buffer
virtual Int_t SetBufferSize(Int_t buffersize)
Change the underlying buffer size of the cache.
virtual Bool_t IsLearning() const
Int_t fNbranches
! Number of branches in the cache
Bool_t ProcessMiss(Long64_t pos, int len)
! Given a file read not in the miss cache, handle (possibly) loading the data.
Long64_t fFirstEntry
! save the value of the first entry
Int_t fLen
Position in file of cache entry.
TList * fBrNames
! list of branch names in the cache
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Bool_t fFirstBuffer
! true if first buffer is used for prefetching
static Int_t fgLearnEntries
number of entries used for learning mode
Double_t GetMissEfficiency() const
The total efficiency of the 'miss cache' - defined as the ratio of blocks found in the cache versus t...
A TTree object has a header with a name and a title.
Bool_t fIsManual
! true if cache is StopLearningPhase was used
A TTree is a list of TBranches.
Long64_t fEntryNext
! next entry number where cache must be filled
std::vector< TBranch * > fBranches
! list of branches that we read on misses.
virtual Int_t GetEntryMin() const
virtual void UpdateBranches(TTree *tree)
Update pointer to current Tree and recompute pointers to the branches in the cache.
TTreeCache & operator=(const TTreeCache &)=delete
Double_t GetEfficiency() const
Give the total efficiency of the primary cache...
static Int_t GetLearnEntries()
Static function returning the number of entries used to train the cache see SetLearnEntries.
ECacheAction
TTreeCache flushing semantics.