46 fNoCacheBytesRead = 0;
49 fNoCacheReadCalls = 0;
84 fEnablePrefetching =
kFALSE;
329 printf(
"Cached Reading.....................: %lld bytes in %d transactions\n",this->
GetBytesRead(), this->
GetReadCalls());
335 printf(
"Average transaction................: No read calls yet\n");
336 printf(
"Number of blocks in current cache..: %d, total size: %d\n",
fNseek,
fNtot);
350 printf (
"Number of long buffers = %d\n",
fNb);
352 printf(
"fPos[%d] = %lld, fLen = %d\n",j,
fPos[j],
fLen[j]);
414 if (cachew->ReadBuffer(buf,pos,len) == 0) {
483 if (cachew->ReadBuffer(buf,pos,len) == 0) {
519 Info(
"ReadBuffer",
"pos=%lld, len=%d, retval=%d, loc=%d, " 520 "fseekSort[loc]=%lld, fSeekLen[loc]=%d",
577 Int_t effectiveNseek = 0;
592 fNseek = effectiveNseek;
611 (
fLen[nb] > 16000000)) {
614 fLen[nb] = fSeekSortLen[i];
616 fLen[nb] += fSeekSortLen[i];
635 Int_t effectiveNseek = 0;
650 fBNseek = effectiveNseek;
669 (
fBLen[nb] > 16000000)) {
672 fBLen[nb] = fBSeekSortLen[i];
674 fBLen[nb] += fBSeekSortLen[i];
711 if (buffersize <= 0)
return -1;
712 if (buffersize <=10000) buffersize = 100000;
722 if (
fNtot > buffersize) {
726 if (
fBNtot > buffersize) {
741 np =
new char[buffersize];
743 memcpy(np, pres,
fNtot);
787 const char* cacheDir =
gEnv->
GetValue(
"Cache.Directory",
"");
788 if (strcmp(cacheDir,
""))
790 fprintf(stderr,
"Error while trying to set the cache directory: %s.\n", cacheDir);
792 fprintf(stderr,
"Error stating prefetching thread. Disabling prefetching.\n");
Int_t fNtot
Total size of prefetched blocks.
Long64_t * fBSeek
[fBNseek]
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
TFile * fFile
Pointer to file.
char * fBuffer
[fBufferSize] buffer of contiguous prefetched blocks
virtual void SetEnablePrefetching(Bool_t setPrefetching=kFALSE)
Set the prefetching mode of this file.
virtual Int_t GetNoCacheReadCalls() const
A cache when reading files over the network.
virtual void SecondSort()
Sort buffers to be prefetched in increasing order of positions.
void SetEnablePrefetchingImpl(Bool_t setPrefetching=kFALSE)
TFileCacheRead implementation of SetEnablePrefetching.
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=0, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
Int_t fBufferSize
Allocated size of fBuffer (at a given time)
const char * GetProtocol() const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
Long64_t fPrefetchedBlocks
Number of blocks prefetched.
Long64_t GetWaitTime()
Return the time spent wating for buffer to be read in microseconds.
virtual void Sort()
Sort buffers to be prefetched in increasing order of positions.
Bool_t fIsSorted
True if fSeek array is sorted.
void ToLower()
Change string to lower-case.
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.
virtual Long64_t GetBytesReadExtra() const
Int_t fReadCalls
Number of read calls for this cache.
Int_t ThreadStart()
Used to start the consumer thread.
virtual ~TFileCacheRead()
Destructor.
virtual TFilePrefetch * GetPrefetchObj()
virtual void SecondPrefetch(Long64_t, Int_t)
Int_t * fBSeekPos
[fBNseek]
virtual void Print(Option_t *option="") const
Print cache statistics.
Long64_t * fBSeekSort
[fBNseek]
Int_t * fSeekLen
[fNseek] Length of buffers to be prefetched
Bool_t fIsTransferred
True when fBuffer contains something valid.
Int_t fBufferLen
Current buffer length (<= fBufferSize)
virtual Int_t GetReadCalls() const
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Long64_t fBytesRead
Number of bytes read for this cache.
Int_t * fBSeekSortLen
[fBNseek]
virtual Int_t ReadBufferExt(char *buf, Long64_t pos, Int_t len, Int_t &loc)
Int_t * fBSeekIndex
[fBNseek]
TFileCacheRead()
Default Constructor.
virtual Int_t ReadBufferExtNormal(char *buf, Long64_t pos, Int_t len, Int_t &loc)
Base function for ReadBuffer.
Int_t fSeekSize
Allocated size of fSeek.
virtual Long64_t GetBytesRead() const
Int_t * fSeekIndex
[fNseek] sorted index table of fSeek
void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect)
Change the file.
void WaitFinishPrefetch()
Killing the async prefetching thread.
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
virtual void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect)
Set the file using this cache and reset the current blocks (if any).
Bool_t ReadBuffer(char *, Long64_t, Int_t)
Return a prefetched element.
Long64_t fBytesReadExtra
Number of extra bytes (overhead) read by the readahead buffer.
Long64_t fNoCacheBytesRead
Number of bytes read by basket to fill cached tree.
virtual Int_t SetBufferSize(Int_t buffersize)
Sets the buffer size.
Long64_t * fPos
[fNb] start of long buffers
virtual Long64_t GetBytesRead() const
Int_t * fBSeekLen
[fBNseek]
Int_t fNb
Number of long buffers.
virtual Long64_t GetNoCacheBytesRead() const
Int_t fBufferSizeMin
Original size of fBuffer.
static Int_t GetReadaheadSize()
Static function returning the readahead buffer size.
virtual void WaitFinishPrefetch()
TFileCacheWrite * GetCacheWrite() const
Return a pointer to the current write cache.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
The prefetching mechanism uses two classes (TFilePrefetch and TFPBlock) to prefetch in advance a bloc...
virtual Long64_t GetBytesReadExtra() const
Int_t * fSeekPos
[fNseek] Position of sorted blocks in fBuffer
Mother of all ROOT objects.
virtual const TUrl * GetEndpointUrl() const
Long64_t * fSeekSort
[fNseek] Position on file of buffers to be prefetched (sorted)
virtual Int_t ReadBufferExtPrefetch(char *buf, Long64_t pos, Int_t len, Int_t &loc)
prefetch the first block
Bool_t fEnablePrefetching
reading by prefetching asynchronously
TFilePrefetch * fPrefetch
! Object that does the asynchronous reading in another thread
Bool_t SetCache(const char *)
Set the path of the cache directory.
Int_t * fLen
[fNb] Length of long buffers
virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read the nbuf blocks described in arrays pos and len.
virtual Int_t GetReadCalls() const
Long64_t * fSeek
[fNseek] Position on file of buffers to be prefetched
void ReadBlock(Long64_t *, Int_t *, Int_t)
Create a TFPBlock object or recycle one and add it to the prefetchBlocks list.
virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len)
Read buffer at position pos.
virtual void Close(Option_t *option="")
Close out any threads or asynchronous fetches used by the underlying implementation.
Int_t * fSeekSortLen
[fNseek] Length of buffers to be prefetched (sorted)
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Int_t fNoCacheReadCalls
Number of read calls by basket to fill cached tree.
A cache when writing files over the network.
virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len)
Int_t fNseek
Number of blocks to be prefetched.
ECacheAction
TTreeCache flushing semantics.