1 #ifndef XRD_READCACHE_H 2 #define XRD_READCACHE_H 36 #include "XrdSys/XrdSysHeaders.hh" 63 long long end_offs,
long long ticksnow,
64 bool placeholder=
false);
72 return ( (end_offs >= begin_offs) &&
73 (fBeginOffset >= begin_offs) &&
74 (fEndOffset <= end_offs) );
79 return ( (end_offs > begin_offs) &&
80 (fBeginOffset <= begin_offs) && (fEndOffset >= end_offs) );
86 if ( (fBeginOffset >= begin_offs) && (fBeginOffset <= end_offs) )
return true;
92 return (fBeginOffset <= offs) && (fEndOffset >= offs);
98 inline bool GetInterval(
const void *buffer,
long long begin_offs,
102 memcpy((
void *)buffer, ((
char *)fData)+(begin_offs - fBeginOffset),
103 end_offs - begin_offs + 1);
110 long long end_offs) {
112 long long b = -1,
e,
l;
114 if (begin_offs > end_offs)
return 0;
117 if ( (begin_offs >= fBeginOffset) &&
118 (begin_offs <= fEndOffset) )
124 e =
xrdmin(end_offs, fEndOffset);
129 memcpy((
void *)buffer, ((
char *)fData)+(b - fBeginOffset), l);
138 long Size() {
return (fEndOffset - fBeginOffset + 1); }
140 inline void Touch(
long long ticksnow) { fTimestampTicks = ticksnow; }
177 long long GetTimestampTick();
178 bool MakeFreeSpace(
long long bytes);
181 bool RemoveLRUItem();
182 bool RemoveFirstItem();
185 if (fReadsCounter > 0)
186 fMissRate = (float)fMissCount / fReadsCounter;
187 if (fBytesSubmitted > 0)
188 fBytesUsefulness = (float)fBytesHit / fBytesSubmitted;
191 int FindInsertionApprox(
long long begin_offs);
192 int FindInsertionApprox_rec(
int startidx,
int endidx,
193 long long begin_offs);
206 long GetDataIfPresent(
const void *buffer,
long long begin_offs,
207 long long end_offs,
bool PerfCalc,
215 long long &bytessubmitted,
222 long long &misscount,
228 long long &readreqcnt,
231 float &bytesusefulness
236 return fTotalByteCount;
239 void PutPlaceholder(
long long begin_offs,
long long end_offs);
244 cout <<
"Low level caching info:" << endl;
245 cout <<
" StallsRate=" << fMissRate << endl;
246 cout <<
" StallsCount=" << fMissCount << endl;
247 cout <<
" ReadsCounter=" << fReadsCounter << endl;
248 cout <<
" BytesUsefulness=" << fBytesUsefulness << endl;
249 cout <<
" BytesSubmitted=" << fBytesSubmitted <<
" BytesHit=" <<
250 fBytesHit << endl << endl;
259 bool SubmitRawData(
const void *buffer,
long long begin_offs,
260 long long end_offs,
bool pinned=
false);
262 void RemoveItems(
bool leavepinned=
true);
263 void RemoveItems(
long long begin_offs,
long long end_offs,
bool remove_overlapped =
false);
264 void RemovePlaceholders();
275 void UnPinCacheBlk(
long long begin_offs,
long long end_offs);
276 void *FindBlk(
long long begin_offs,
long long end_offs);
281 return (bc < fMaxCacheSize);
XrdClientReadCacheItem(const void *buffer, long long begin_offs, long long end_offs, long long ticksnow, bool placeholder=false)
bool WillFit(long long bc)
bool ContainedInInterval(long long begin_offs, long long end_offs)
bool ContainsOffset(long long offs)
bool IntersectInterval(long long begin_offs, long long end_offs)
long GetPartialInterval(const void *buffer, long long begin_offs, long long end_offs)
void SetBlkRemovalPolicy(int p)
bool ContainsInterval(long long begin_offs, long long end_offs)
void Touch(long long ticksnow)
#define XrdSysMutexHelper
XrdClientVector< XrdClientReadCacheItem * > ItemVect
long long GetTimestampTicks()
long long GetTotalByteCount()
long long fTotalByteCount
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
long long fBytesSubmitted
XrdClientVector< XrdClientCacheInterval > XrdClientIntvList
void UpdatePerfCounters()
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
long long fTimestampTickCounter
bool GetInterval(const void *buffer, long long begin_offs, long long end_offs)
~XrdClientReadCacheItem()