1 #ifndef __XRDFILECACHE_INFO_HH__ 2 #define __XRDFILECACHE_INFO_HH__ 26 #include "XrdCl/XrdClLog.hh" 47 static unsigned char cfiBIT(
int n) {
return 1 << n; }
62 Info(
long long bufferSize);
74 void SetBitFetched(
int i);
80 void SetBitWriteCalled(
int i);
87 void ResizeBits(
int n);
111 bool IsAnythingEmptyInRng(
int firstIdx,
int lastIdx)
const;
116 int GetSizeInBytes()
const;
121 int GetSizeInBits()
const;
126 int GetHeaderSize()
const;
131 bool GetLatestDetachTime(time_t& t,
XrdOssDF* fp)
const;
136 long long GetBufferSize()
const;
141 bool TestBit(
int i)
const;
146 bool IsComplete()
const;
151 int GetNDownloadedBlocks()
const;
156 long long GetNDownloadedBytes()
const;
161 void CheckComplete();
193 inline bool Info::TestBit(
int i)
const 196 assert(cn < GetSizeInBytes());
199 return (m_buff_fetched[cn] & cfiBIT(off)) == cfiBIT(off);
203 inline int Info::GetNDownloadedBlocks()
const 206 for (
int i = 0; i < m_sizeInBits; ++i)
207 if (TestBit(i)) cntd++;
212 inline long long Info::GetNDownloadedBytes()
const 214 return m_bufferSize * GetNDownloadedBlocks();
217 inline int Info::GetSizeInBytes()
const 219 return ((m_sizeInBits -1)/8 + 1);
222 inline int Info::GetSizeInBits()
const 227 inline bool Info::IsComplete()
const 232 inline bool Info::IsAnythingEmptyInRng(
int firstIdx,
int lastIdx)
const 234 for (
int i = firstIdx; i <= lastIdx; ++i)
235 if (!TestBit(i))
return true;
240 inline void Info::CheckComplete()
242 m_complete = !IsAnythingEmptyInRng(0, m_sizeInBits-1);
245 inline void Info::SetBitWriteCalled(
int i)
248 assert(cn < GetSizeInBytes());
251 m_buff_write_called[cn] |= cfiBIT(off);
254 inline void Info::SetBitFetched(
int i)
257 assert(cn < GetSizeInBytes());
260 m_buff_fetched[cn] |= cfiBIT(off);
263 inline long long Info::GetBufferSize()
const Definition: XrdFileCache.hh:30
int GetVersion()
Get version.
Definition: XrdFileCacheInfo.hh:171
static const char * m_infoExtension
Definition: XrdFileCacheInfo.hh:174
time_t DetachTime
Definition: XrdFileCacheInfo.hh:53
long long BytesDisk
close time
Definition: XrdFileCacheInfo.hh:54
Status of cached file. Can be read from and written into a binary file.
Definition: XrdFileCacheInfo.hh:44
int m_version
Cache statistics and time of access.
Definition: XrdFileCacheInfo.hh:184
static unsigned char cfiBIT(int n)
Definition: XrdFileCacheInfo.hh:47
static Log * GetLog()
Get default log.
unsigned char * m_buff_fetched
download state vector
Definition: XrdFileCacheInfo.hh:187
unsigned char * m_buff_write_called
disk written state vector
Definition: XrdFileCacheInfo.hh:188
Definition: XrdFileCacheInfo.hh:51
Definition: XrdClEnv.hh:28
bool m_complete
cached
Definition: XrdFileCacheInfo.hh:190
int GetAccessCnt()
Get number of accesses.
Definition: XrdFileCacheInfo.hh:166
int m_sizeInBits
number of file blocks
Definition: XrdFileCacheInfo.hh:186
long long BytesMissed
read from ram
Definition: XrdFileCacheInfo.hh:56
long long BytesRam
read from disk
Definition: XrdFileCacheInfo.hh:55
XrdCl::Log * clLog() const
Definition: XrdFileCacheInfo.hh:178
long long m_bufferSize
prefetch buffer size
Definition: XrdFileCacheInfo.hh:185
int m_accessCnt
number of written AStat structs
Definition: XrdFileCacheInfo.hh:189