12 #ifndef ROOT_TFilePrefetch 13 #define ROOT_TFilePrefetch 27 #include <condition_variable> void AddPendingBlock(TFPBlock *)
Safe method to add a block to the pendingList.
std::mutex fMutexReadList
void *(* VoidRtnFunc_t)(void *)
void ReadAsync(TFPBlock *, Bool_t &)
Read one block and insert it in prefetchBuffers list.
Bool_t BinarySearchReadList(TFPBlock *, Long64_t, Int_t, Int_t *)
Search for a requested element in a block and return the index.
Bool_t CheckBlockInCache(char *&, TFPBlock *)
Test if the block is in cache.
Bool_t IsPrefetchFinished() const
static TThread::VoidRtnFunc_t ThreadProc(void *)
Execution loop of the consumer thread.
std::condition_variable fNewBlockAdded
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Long64_t GetWaitTime()
Return the time spent wating for buffer to be read in microseconds.
std::mutex fMutexPendingList
Int_t ThreadStart()
Used to start the consumer thread.
void SaveBlockInCache(TFPBlock *)
Save the block content in cache.
TSemaphore * fSemChangeFile
#define ClassDef(name, id)
std::condition_variable & GetCondNewBlock()
This class represents the encapsulation of a block request.
void AddReadBlock(TFPBlock *)
Safe method to add a block to the readList.
void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect)
Change the file.
void WaitFinishPrefetch()
Killing the async prefetching thread.
Bool_t ReadBuffer(char *, Long64_t, Int_t)
Return a prefetched element.
Int_t SumHex(const char *)
Sum up individual hex values to obtain a decimal value.
void ReadListOfBlocks()
Get blocks specified in prefetchBlocks.
virtual ~TFilePrefetch()
Destructor.
TThread * GetThread() const
Return reference to the consumer thread.
std::condition_variable fReadBlockAdded
The prefetching mechanism uses two classes (TFilePrefetch and TFPBlock) to prefetch in advance a bloc...
Mother of all ROOT objects.
char * GetBlockFromCache(const char *, Int_t)
Return a buffer from cache.
std::atomic< Bool_t > fPrefetchFinished
Bool_t SetCache(const char *)
Set the path of the cache directory.
void ReadBlock(Long64_t *, Int_t *, Int_t)
Create a TFPBlock object or recycle one and add it to the prefetchBlocks list.
TFilePrefetch(TFile *)
Constructor.
TFPBlock * GetPendingBlock()
Safe method to remove a block from the pendingList.
TFPBlock * CreateBlockObj(Long64_t *, Int_t *, Int_t)
Create a new block or recycle an old one.
ECacheAction
TTreeCache flushing semantics.