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",
551 if (
file &&
file->ReadBufferAsync(0, 0)) {
577 Int_t effectiveNseek = 0;
611 (
fLen[nb] > 16000000)) {
635 Int_t effectiveNseek = 0;
669 (
fBLen[nb] > 16000000)) {
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");
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
A cache when reading files over the network.
virtual Long64_t GetBytesRead() const
Long64_t fBytesReadExtra
Number of extra bytes (overhead) read by the readahead buffer.
virtual Long64_t GetBytesReadExtra() const
virtual Long64_t GetNoCacheBytesRead() const
Int_t fBufferSize
Allocated size of fBuffer (at a given time)
char * fBuffer
[fBufferSize] buffer of contiguous prefetched blocks
Long64_t * fBSeekSort
[fBNseek]
Long64_t * fPos
[fNb] start of long buffers
virtual Int_t SetBufferSize(Int_t buffersize)
Sets the buffer size.
Bool_t fIsSorted
True if fSeek array is sorted.
virtual Int_t GetReadCalls() const
Int_t * fSeekIndex
[fNseek] sorted index table of fSeek
virtual Int_t ReadBufferExt(char *buf, Long64_t pos, Int_t len, Int_t &loc)
Long64_t * fSeekSort
[fNseek] Position on file of buffers to be prefetched (sorted)
virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len)
Read buffer at position pos.
TFilePrefetch * fPrefetch
! Object that does the asynchronous reading in another thread
Int_t * fBSeekPos
[fBNseek]
virtual void SecondPrefetch(Long64_t, Int_t)
virtual void Print(Option_t *option="") const
Print cache statistics.
Long64_t fBytesRead
Number of bytes read for this cache.
virtual void SecondSort()
Sort buffers to be prefetched in increasing order of positions.
virtual TFilePrefetch * GetPrefetchObj()
virtual Int_t ReadBufferExtPrefetch(char *buf, Long64_t pos, Int_t len, Int_t &loc)
prefetch the first block
virtual void Sort()
Sort buffers to be prefetched in increasing order of positions.
virtual Int_t ReadBufferExtNormal(char *buf, Long64_t pos, Int_t len, Int_t &loc)
Base function for ReadBuffer.
TFileCacheRead()
Default Constructor.
virtual ~TFileCacheRead()
Destructor.
void SetEnablePrefetchingImpl(Bool_t setPrefetching=kFALSE)
TFileCacheRead implementation of SetEnablePrefetching.
Bool_t fEnablePrefetching
reading by prefetching asynchronously
Int_t * fSeekLen
[fNseek] Length of buffers to be prefetched
Int_t fNtot
Total size of prefetched blocks.
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.
Int_t * fSeekSortLen
[fNseek] Length of buffers to be prefetched (sorted)
virtual void SetEnablePrefetching(Bool_t setPrefetching=kFALSE)
Set the prefetching mode of this file.
Int_t fBufferSizeMin
Original size of fBuffer.
Int_t * fBSeekIndex
[fBNseek]
virtual void Close(Option_t *option="")
Close out any threads or asynchronous fetches used by the underlying implementation.
Int_t fNb
Number of long buffers.
Int_t fReadCalls
Number of read calls for this cache.
Int_t fBufferLen
Current buffer length (<= fBufferSize)
Long64_t fPrefetchedBlocks
Number of blocks prefetched.
Long64_t fNoCacheBytesRead
Number of bytes read by basket to fill cached tree.
Long64_t * fSeek
[fNseek] Position on file of buffers to be prefetched
virtual Int_t GetNoCacheReadCalls() const
Bool_t fIsTransferred
True when fBuffer contains something valid.
TFile * fFile
Pointer to file.
virtual void WaitFinishPrefetch()
Int_t * fBSeekLen
[fBNseek]
Int_t fNseek
Number of blocks to be prefetched.
Int_t * fLen
[fNb] Length of long buffers
Int_t * fBSeekSortLen
[fBNseek]
Int_t fNoCacheReadCalls
Number of read calls by basket to fill cached tree.
Int_t * fSeekPos
[fNseek] Position of sorted blocks in fBuffer
Int_t fSeekSize
Allocated size of fSeek.
Long64_t * fBSeek
[fBNseek]
virtual void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect)
Set the file using this cache and reset the current blocks (if any).
A cache when writing files over the network.
The prefetching mechanism uses two classes (TFilePrefetch and TFPBlock) to prefetch in advance a bloc...
void ReadBlock(Long64_t *, Int_t *, Int_t)
Create a TFPBlock object or recycle one and add it to the prefetchBlocks list.
Long64_t GetWaitTime()
Return the time spent wating for buffer to be read in microseconds.
Bool_t SetCache(const char *)
Set the path of the cache directory.
Int_t ThreadStart()
Used to start the consumer thread.
Bool_t ReadBuffer(char *, Long64_t, Int_t)
Return a prefetched element.
void WaitFinishPrefetch()
Killing the async prefetching thread.
void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect)
Change the file.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
TFileCacheWrite * GetCacheWrite() const
Return a pointer to the current write cache.
static Int_t GetReadaheadSize()
Static function returning the readahead buffer size.
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
virtual Long64_t GetBytesRead() const
virtual Long64_t GetBytesReadExtra() const
ECacheAction
TTreeCache flushing semantics.
virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len)
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
Mother of all ROOT objects.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
void ToLower()
Change string to lower-case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Long64_t BinarySearch(Long64_t n, const T *array, T value)