![]() |
XRootD
|
Status of cached file. Can be read from and written into a binary file. More...
#include <XrdPfcInfo.hh>
Classes | |
struct | AStat |
Access statistics. More... | |
struct | Status |
union | Status.__unnamed128__ |
struct | Status.__unnamed128__.__unnamed130__ |
struct | Store |
Public Member Functions | |
Info (XrdSysTrace *trace, bool prefetchBuffer=false) | |
Constructor. More... | |
~Info () | |
Destructor. More... | |
void | CalcCksumMd5 (unsigned char *buff, char *digest) |
uint32_t | CalcCksumStore () |
Get cksum, MD5 is for backward compatibility with V2 and V3. More... | |
uint32_t | CalcCksumSyncedAndAStats () |
void | CompactifyAccessRecords () |
Compactify access records to the configured maximum. More... | |
int | CountBlocksNotWrittenInRng (int firstIdx, int lastIdx) const |
Check download status in given block range. More... | |
void | DowngradeCkSumState (CkSumCheck_e css_ref) |
size_t | GetAccessCnt () const |
Get number of accesses. More... | |
int | GetBitvecSizeInBytes () const |
Get size of download-state bit-vector in bytes. More... | |
long long | GetBufferSize () const |
Get prefetch buffer size. More... | |
CkSumCheck_e | GetCkSumState () const |
const char * | GetCkSumStateAsText () const |
time_t | GetCreationTime () const |
Get file size. More... | |
long long | GetExpectedDataFileSize () const |
Get expected data file size. More... | |
long long | GetFileSize () const |
Get file size. More... | |
const AStat * | GetLastAccessStats () const |
Get latest access stats. More... | |
int | GetLastDownloadedBlock () const |
Get number of the last downloaded block. More... | |
bool | GetLatestDetachTime (time_t &t) const |
Get latest detach time. More... | |
int | GetNBlocks () const |
Get number of blocks represented in download-state bit-vector. More... | |
int | GetNDownloadedBlocks () const |
Get number of downloaded blocks. More... | |
long long | GetNDownloadedBytes () const |
Get number of downloaded bytes. More... | |
time_t | GetNoCkSumTime () const |
time_t | GetNoCkSumTimeForUVKeep () const |
XrdSysTrace * | GetTrace () const |
int | GetVersion () |
Get version. More... | |
bool | HasNoCkSumTime () const |
bool | IsCkSumAny () const |
bool | IsCkSumBoth () const |
bool | IsCkSumCache () const |
bool | IsCkSumNet () const |
bool | IsComplete () const |
Get complete status. More... | |
bool | Read (XrdOssDF *fp, const char *dname, const char *fname=0) |
Read content of cinfo file into this object. More... | |
const std::vector< AStat > & | RefAStats () const |
const Store & | RefStoredData () const |
Get stored data. More... | |
void | ResetAllAccessStats () |
Reset IO Stats. More... | |
void | ResetCkSumCache () |
void | ResetCkSumNet () |
void | ResetNoCkSumTime () |
void | ResizeBits () |
Reserve bit vectors for file_size / buffer_size bytes. More... | |
void | SetAllBitsSynced () |
Mark all blocks as synced to disk. More... | |
void | SetBitPrefetch (int i) |
Mark block as obtained through prefetch. More... | |
void | SetBitSynced (int i) |
Mark block as synced to disk. More... | |
void | SetBitWritten (int i) |
Mark block as written to disk. More... | |
void | SetBufferSizeFileSizeAndCreationTime (long long bs, long long fs) |
void | SetCkSumState (CkSumCheck_e css) |
bool | TestBitPrefetch (int i) const |
Test if block at the given index has been prefetched. More... | |
bool | TestBitWritten (int i) const |
Test if block at the given index is written to disk. More... | |
void | UpdateDownloadCompleteStatus () |
Update complete status. More... | |
bool | Write (XrdOssDF *fp, const char *dname, const char *fname=0) |
void | WriteIOStat (Stats &s) |
Write bytes missed, hits, and disk. More... | |
void | WriteIOStatAttach () |
Write open time in the last entry of access statistics. More... | |
void | WriteIOStatDetach (Stats &s) |
Write close time together with bytes missed, hits, and disk. More... | |
void | WriteIOStatSingle (long long bytes_disk) |
Write single open/close time for given bytes read from disk. More... | |
void | WriteIOStatSingle (long long bytes_disk, time_t att, time_t dtc) |
Write open/close with given time and bytes read from disk. More... | |
Static Public Attributes | |
static const char * | m_traceID = "CInfo" |
static const int | s_defaultVersion = 4 |
static const char * | s_infoExtension = ".cinfo" |
static const size_t | s_infoExtensionLen = strlen(Info::s_infoExtension) |
static size_t | s_maxNumAccess = 20 |
Protected Attributes | |
std::vector< AStat > | m_astats |
access records More... | |
int | m_bitvecSizeInBits |
cached More... | |
unsigned char * | m_buff_prefetch |
prefetch statistics More... | |
unsigned char * | m_buff_synced |
disk written state vector More... | |
unsigned char * | m_buff_written |
download state vector More... | |
bool | m_complete |
cached; if false, set to true when missingBlocks hit zero More... | |
bool | m_hasPrefetchBuffer |
constains current prefetch score More... | |
int | m_missingBlocks |
cached, updated in SetBitWritten() More... | |
Store | m_store |
XrdSysTrace * | m_trace |
int | m_version |
Status of cached file. Can be read from and written into a binary file.
Definition at line 44 of file XrdPfcInfo.hh.
union XrdPfc::Info::Status.__unnamed128__ |
Definition at line 48 of file XrdPfcInfo.hh.
Class Members | ||
---|---|---|
__unnamed128__ | __unnamed__ | |
unsigned int | _raw_ |
struct XrdPfc::Info::Status.__unnamed128__.__unnamed130__ |
Definition at line 49 of file XrdPfcInfo.hh.
Class Members | ||
---|---|---|
int | _free_bits_: 29 | |
int | f_cksum_check: 3 | as in enum CkSumCheck_e |
Info::Info | ( | XrdSysTrace * | trace, |
bool | prefetchBuffer = false |
||
) |
Constructor.
Definition at line 125 of file XrdPfcInfo.cc.
Info::~Info | ( | ) |
Destructor.
Definition at line 136 of file XrdPfcInfo.cc.
References m_buff_prefetch, m_buff_synced, and m_buff_written.
void Info::CalcCksumMd5 | ( | unsigned char * | buff, |
char * | digest | ||
) |
Definition at line 240 of file XrdPfcInfo.cc.
References XrdCksCalc::Final(), GetBitvecSizeInBytes(), XrdCksCalc::Init(), and XrdCksCalc::Update().
uint32_t Info::CalcCksumStore | ( | ) |
uint32_t Info::CalcCksumSyncedAndAStats | ( | ) |
Definition at line 234 of file XrdPfcInfo.cc.
References crc32c(), GetBitvecSizeInBytes(), m_astats, and m_buff_synced.
Referenced by Read(), and Write().
void Info::CompactifyAccessRecords | ( | ) |
Compactify access records to the configured maximum.
Definition at line 381 of file XrdPfcInfo.cc.
References XrdPfc::Info::AStat::DetachTime, m_astats, and s_maxNumAccess.
Referenced by Write().
|
inline |
Check download status in given block range.
Definition at line 456 of file XrdPfcInfo.hh.
References TestBitWritten().
Referenced by UpdateDownloadCompleteStatus().
|
inline |
Definition at line 299 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_status, and m_store.
|
inline |
Get number of accesses.
Definition at line 265 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_accessCnt, and m_store.
Referenced by XrdPfc::File::GetAccessCnt().
|
inline |
Get size of download-state bit-vector in bytes.
Definition at line 433 of file XrdPfcInfo.hh.
References m_bitvecSizeInBits.
Referenced by CalcCksumMd5(), CalcCksumSyncedAndAStats(), Read(), ResizeBits(), SetAllBitsSynced(), SetBitPrefetch(), SetBitSynced(), SetBitWritten(), TestBitPrefetch(), TestBitWritten(), and Write().
|
inline |
Get prefetch buffer size.
Definition at line 473 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_buffer_size, and m_store.
Referenced by XrdPfc::File::GetBlockSize().
|
inline |
Definition at line 290 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_status, and m_store.
Referenced by XrdPfc::FPurgeState::CheckFile().
const char * Info::GetCkSumStateAsText | ( | ) | const |
Definition at line 251 of file XrdPfcInfo.cc.
References XrdPfc::CSChk_Both, XrdPfc::CSChk_Cache, XrdPfc::CSChk_Net, XrdPfc::CSChk_None, XrdPfc::Info::Store::m_status, and m_store.
|
inline |
Get file size.
Definition at line 281 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_creationTime, and m_store.
|
inline |
Get expected data file size.
Definition at line 424 of file XrdPfcInfo.hh.
References GetLastDownloadedBlock(), m_bitvecSizeInBits, XrdPfc::Info::Store::m_buffer_size, XrdPfc::Info::Store::m_file_size, and m_store.
|
inline |
Get file size.
Definition at line 446 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_file_size, and m_store.
Referenced by XrdPfc::Cache::ConsiderCached(), XrdPfc::Cache::LocalFilePath(), and XrdPfc::Cache::Stat().
const Info::AStat * Info::GetLastAccessStats | ( | ) | const |
Get latest access stats.
Definition at line 491 of file XrdPfcInfo.cc.
References m_astats.
Referenced by XrdPfc::File::GetLastAccessStats().
|
inline |
Get number of the last downloaded block.
Definition at line 416 of file XrdPfcInfo.hh.
References m_bitvecSizeInBits, and TestBitWritten().
Referenced by GetExpectedDataFileSize().
bool Info::GetLatestDetachTime | ( | time_t & | t | ) | const |
Get latest detach time.
Definition at line 472 of file XrdPfcInfo.cc.
References XrdPfc::Info::AStat::AttachTime, XrdPfc::Info::AStat::DetachTime, XrdPfc::Info::AStat::Duration, m_astats, XrdPfc::Info::Store::m_creationTime, and m_store.
Referenced by XrdPfc::FPurgeState::CheckFile().
|
inline |
Get number of blocks represented in download-state bit-vector.
Definition at line 441 of file XrdPfcInfo.hh.
References m_bitvecSizeInBits.
Referenced by XrdPfc::File::GetNBlocks().
|
inline |
Get number of downloaded blocks.
Definition at line 402 of file XrdPfcInfo.hh.
References m_bitvecSizeInBits, and TestBitWritten().
Referenced by XrdPfc::File::GetNDownloadedBlocks(), and GetNDownloadedBytes().
|
inline |
Get number of downloaded bytes.
Definition at line 411 of file XrdPfcInfo.hh.
References GetNDownloadedBlocks(), XrdPfc::Info::Store::m_buffer_size, and m_store.
Referenced by XrdPfc::FPurgeState::CheckFile(), and XrdPfc::Cache::ConsiderCached().
|
inline |
Definition at line 304 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_noCkSumTime, and m_store.
|
inline |
Definition at line 305 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_creationTime, XrdPfc::Info::Store::m_noCkSumTime, and m_store.
Referenced by XrdPfc::FPurgeState::CheckFile().
|
inline |
|
inline |
|
inline |
Definition at line 303 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_noCkSumTime, and m_store.
Referenced by ResetCkSumCache(), and ResetCkSumNet().
|
inline |
Definition at line 295 of file XrdPfcInfo.hh.
References XrdPfc::CSChk_Both, XrdPfc::Info::Store::m_status, and m_store.
|
inline |
Definition at line 296 of file XrdPfcInfo.hh.
References XrdPfc::CSChk_Both, XrdPfc::Info::Store::m_status, and m_store.
|
inline |
Definition at line 293 of file XrdPfcInfo.hh.
References XrdPfc::CSChk_Cache, XrdPfc::Info::Store::m_status, and m_store.
Referenced by ResetCkSumCache(), and XrdPfc::File::WriteBlockToDisk().
|
inline |
Definition at line 294 of file XrdPfcInfo.hh.
References XrdPfc::CSChk_Net, XrdPfc::Info::Store::m_status, and m_store.
Referenced by ResetCkSumNet(), and XrdPfc::File::WriteBlockToDisk().
|
inline |
Get complete status.
Definition at line 451 of file XrdPfcInfo.hh.
References m_complete.
Referenced by XrdPfc::Cache::ConsiderCached(), XrdPfc::Cache::LocalFilePath(), XrdPfc::File::Read(), XrdPfc::File::ReadV(), XrdPfc::File::Sync(), and XrdPfc::File::WriteBlockToDisk().
bool Info::Read | ( | XrdOssDF * | fp, |
const char * | dname, | ||
const char * | fname = 0 |
||
) |
Read content of cinfo file into this object.
fp | file handle |
dname | directory name for trace output |
fname | optional file name for trace output (can be included in dname) |
Definition at line 296 of file XrdPfcInfo.cc.
References CalcCksumStore(), CalcCksumSyncedAndAStats(), Error, GetBitvecSizeInBytes(), m_astats, XrdPfc::Info::Store::m_astatSize, m_buff_synced, m_buff_written, m_store, m_trace, m_traceID, m_version, ResizeBits(), s_defaultVersion, TRACE, UpdateDownloadCompleteStatus(), and Macaroons::Warning.
Referenced by XrdPfc::Cache::ConsiderCached(), XrdPfc::Cache::LocalFilePath(), XrdPfc::Cache::Stat(), and XrdPfc::FPurgeState::TraverseNamespace().
|
inline |
|
inline |
void Info::ResetAllAccessStats | ( | ) |
Definition at line 361 of file XrdPfcInfo.cc.
References XrdPfc::Info::Store::m_accessCnt, m_astats, XrdPfc::Info::Store::m_astatSize, and m_store.
void Info::ResetCkSumCache | ( | ) |
Definition at line 205 of file XrdPfcInfo.cc.
References XrdPfc::CSChk_Cache, HasNoCkSumTime(), IsCkSumCache(), XrdPfc::Info::Store::m_noCkSumTime, XrdPfc::Info::Store::m_status, and m_store.
void Info::ResetCkSumNet | ( | ) |
Definition at line 215 of file XrdPfcInfo.cc.
References XrdPfc::CSChk_Net, HasNoCkSumTime(), IsCkSumNet(), XrdPfc::Info::Store::m_noCkSumTime, XrdPfc::Info::Store::m_status, and m_store.
Referenced by XrdPfc::File::WriteBlockToDisk().
|
inline |
Definition at line 306 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_noCkSumTime, and m_store.
void Info::ResizeBits | ( | ) |
Reserve bit vectors for file_size / buffer_size bytes.
Definition at line 174 of file XrdPfcInfo.cc.
References GetBitvecSizeInBytes(), m_bitvecSizeInBits, m_buff_prefetch, m_buff_synced, m_buff_written, XrdPfc::Info::Store::m_buffer_size, m_complete, XrdPfc::Info::Store::m_file_size, m_hasPrefetchBuffer, m_missingBlocks, and m_store.
Referenced by Read(), and SetBufferSizeFileSizeAndCreationTime().
void Info::SetAllBitsSynced | ( | ) |
Mark all blocks as synced to disk.
Definition at line 146 of file XrdPfcInfo.cc.
References GetBitvecSizeInBytes(), m_buff_synced, and m_complete.
Referenced by XrdPfc::Cache::ExecuteCommandUrl().
|
inline |
Mark block as obtained through prefetch.
Definition at line 369 of file XrdPfcInfo.hh.
References GetBitvecSizeInBytes(), and m_buff_prefetch.
Referenced by XrdPfc::File::WriteBlockToDisk().
|
inline |
Mark block as synced to disk.
Definition at line 391 of file XrdPfcInfo.hh.
References GetBitvecSizeInBytes(), and m_buff_synced.
Referenced by XrdPfc::File::Sync(), and XrdPfc::File::WriteBlockToDisk().
|
inline |
Mark block as written to disk.
Definition at line 356 of file XrdPfcInfo.hh.
References GetBitvecSizeInBytes(), m_buff_written, m_complete, and m_missingBlocks.
Referenced by XrdPfc::File::WriteBlockToDisk().
void Info::SetBufferSizeFileSizeAndCreationTime | ( | long long | bs, |
long long | fs | ||
) |
Definition at line 163 of file XrdPfcInfo.cc.
References XrdPfc::Info::Store::m_buffer_size, XrdPfc::Info::Store::m_creationTime, XrdPfc::Info::Store::m_file_size, m_store, and ResizeBits().
Referenced by XrdPfc::Cache::ExecuteCommandUrl().
|
inline |
Definition at line 298 of file XrdPfcInfo.hh.
References XrdPfc::Info::Store::m_status, and m_store.
|
inline |
Test if block at the given index has been prefetched.
Definition at line 380 of file XrdPfcInfo.hh.
References GetBitvecSizeInBytes(), and m_buff_prefetch.
|
inline |
Test if block at the given index is written to disk.
Definition at line 347 of file XrdPfcInfo.hh.
References GetBitvecSizeInBytes(), and m_buff_written.
Referenced by CountBlocksNotWrittenInRng(), GetLastDownloadedBlock(), GetNDownloadedBlocks(), and XrdPfc::File::Prefetch().
|
inline |
Update complete status.
Definition at line 467 of file XrdPfcInfo.hh.
References CountBlocksNotWrittenInRng(), m_bitvecSizeInBits, m_complete, and m_missingBlocks.
Referenced by Read().
bool Info::Write | ( | XrdOssDF * | fp, |
const char * | dname, | ||
const char * | fname = 0 |
||
) |
Write number of blocks and read buffer size
fp | file handle |
dname | directory name for trace output |
fname | optional file name for trace output (can be included in dname) |
Definition at line 268 of file XrdPfcInfo.cc.
References CalcCksumStore(), CalcCksumSyncedAndAStats(), CompactifyAccessRecords(), GetBitvecSizeInBytes(), m_astats, XrdPfc::Info::Store::m_astatSize, m_buff_synced, m_store, m_trace, m_traceID, s_defaultVersion, and s_maxNumAccess.
Referenced by XrdPfc::Cache::ExecuteCommandUrl(), XrdPfc::Cache::LocalFilePath(), and XrdPfc::File::Sync().
void Info::WriteIOStat | ( | Stats & | s | ) |
Write bytes missed, hits, and disk.
Definition at line 431 of file XrdPfcInfo.cc.
References m_astats, XrdPfc::Stats::m_BytesBypassed, XrdPfc::Stats::m_BytesHit, XrdPfc::Stats::m_BytesMissed, XrdPfc::Stats::m_Duration, and XrdPfc::Stats::m_NumIos.
Referenced by XrdPfc::File::Sync(), and WriteIOStatDetach().
void Info::WriteIOStatAttach | ( | ) |
Write open time in the last entry of access statistics.
Definition at line 422 of file XrdPfcInfo.cc.
References XrdPfc::Info::AStat::AttachTime, XrdPfc::Info::Store::m_accessCnt, m_astats, and m_store.
void Info::WriteIOStatDetach | ( | Stats & | s | ) |
Write close time together with bytes missed, hits, and disk.
Definition at line 440 of file XrdPfcInfo.cc.
References m_astats, and WriteIOStat().
Referenced by XrdPfc::File::FinalizeSyncBeforeExit().
void Info::WriteIOStatSingle | ( | long long | bytes_disk | ) |
Write single open/close time for given bytes read from disk.
Definition at line 446 of file XrdPfcInfo.cc.
References XrdPfc::Info::AStat::AttachTime, XrdPfc::Info::AStat::BytesHit, XrdPfc::Info::AStat::DetachTime, XrdPfc::Info::Store::m_accessCnt, m_astats, m_store, and XrdPfc::Info::AStat::NumIos.
Referenced by XrdPfc::Cache::ExecuteCommandUrl(), and XrdPfc::Cache::LocalFilePath().
void Info::WriteIOStatSingle | ( | long long | bytes_disk, |
time_t | att, | ||
time_t | dtc | ||
) |
Write open/close with given time and bytes read from disk.
Definition at line 457 of file XrdPfcInfo.cc.
References XrdPfc::Info::AStat::AttachTime, XrdPfc::Info::AStat::BytesHit, XrdPfc::Info::AStat::DetachTime, XrdPfc::Info::AStat::Duration, XrdPfc::Info::Store::m_accessCnt, m_astats, m_store, and XrdPfc::Info::AStat::NumIos.
|
protected |
access records
Definition at line 327 of file XrdPfcInfo.hh.
Referenced by CalcCksumSyncedAndAStats(), CompactifyAccessRecords(), GetLastAccessStats(), GetLatestDetachTime(), Read(), RefAStats(), ResetAllAccessStats(), Write(), WriteIOStat(), WriteIOStatAttach(), WriteIOStatDetach(), and WriteIOStatSingle().
|
protected |
cached
Definition at line 330 of file XrdPfcInfo.hh.
Referenced by GetBitvecSizeInBytes(), GetExpectedDataFileSize(), GetLastDownloadedBlock(), GetNBlocks(), GetNDownloadedBlocks(), ResizeBits(), and UpdateDownloadCompleteStatus().
|
protected |
prefetch statistics
Definition at line 326 of file XrdPfcInfo.hh.
Referenced by ~Info(), ResizeBits(), SetBitPrefetch(), and TestBitPrefetch().
|
protected |
disk written state vector
Definition at line 324 of file XrdPfcInfo.hh.
Referenced by ~Info(), CalcCksumSyncedAndAStats(), Read(), ResizeBits(), SetAllBitsSynced(), SetBitSynced(), and Write().
|
protected |
download state vector
Definition at line 325 of file XrdPfcInfo.hh.
Referenced by ~Info(), Read(), ResizeBits(), SetBitWritten(), and TestBitWritten().
|
protected |
cached; if false, set to true when missingBlocks hit zero
Definition at line 332 of file XrdPfcInfo.hh.
Referenced by IsComplete(), ResizeBits(), SetAllBitsSynced(), SetBitWritten(), and UpdateDownloadCompleteStatus().
|
protected |
constains current prefetch score
Definition at line 333 of file XrdPfcInfo.hh.
Referenced by ResizeBits().
|
protected |
cached, updated in SetBitWritten()
Definition at line 331 of file XrdPfcInfo.hh.
Referenced by ResizeBits(), SetBitWritten(), and UpdateDownloadCompleteStatus().
|
protected |
Definition at line 323 of file XrdPfcInfo.hh.
Referenced by CalcCksumStore(), DowngradeCkSumState(), GetAccessCnt(), GetBufferSize(), GetCkSumState(), GetCkSumStateAsText(), GetCreationTime(), GetExpectedDataFileSize(), GetFileSize(), GetLatestDetachTime(), GetNDownloadedBytes(), GetNoCkSumTime(), GetNoCkSumTimeForUVKeep(), HasNoCkSumTime(), IsCkSumAny(), IsCkSumBoth(), IsCkSumCache(), IsCkSumNet(), Read(), RefStoredData(), ResetAllAccessStats(), ResetCkSumCache(), ResetCkSumNet(), ResetNoCkSumTime(), ResizeBits(), SetBufferSizeFileSizeAndCreationTime(), SetCkSumState(), Write(), WriteIOStatAttach(), and WriteIOStatSingle().
|
protected |
Definition at line 321 of file XrdPfcInfo.hh.
Referenced by GetTrace(), Read(), and Write().
|
static |
Definition at line 312 of file XrdPfcInfo.hh.
|
protected |
Definition at line 329 of file XrdPfcInfo.hh.
Referenced by GetVersion(), and Read().
|
static |
Definition at line 316 of file XrdPfcInfo.hh.
|
static |
Definition at line 313 of file XrdPfcInfo.hh.
Referenced by XrdPfc::Cache::ConsiderCached(), XrdPfc::Cache::ExecuteCommandUrl(), XrdPfc::Cache::LocalFilePath(), XrdPfc::Cache::Prepare(), XrdPfc::Cache::Purge(), XrdPfc::Cache::Stat(), and XrdPfc::Cache::UnlinkFile().
|
static |
Definition at line 314 of file XrdPfcInfo.hh.
|
static |
Definition at line 315 of file XrdPfcInfo.hh.
Referenced by CompactifyAccessRecords(), XrdPfc::Cache::Config(), and Write().