Skip to content

Commit

Permalink
Initiate buffer for prefetch score statistics.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent fe9294c commit 54b57b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -74,7 +74,7 @@ File::File(XrdOucCacheIO2 *inputIO, std::string& disk_file_path, long long iOffs
m_input(inputIO),
m_output(NULL),
m_infoFile(NULL),
m_cfi(Cache::GetInstance().RefConfiguration().m_bufferSize),
m_cfi(Cache::GetInstance().RefConfiguration().m_bufferSize, Cache::GetInstance().RefConfiguration().m_prefetch),
m_temp_filename(disk_file_path),
m_offset(iOffset),
m_fileSize(iFileSize),
Expand Down
7 changes: 4 additions & 3 deletions src/XrdFileCache/XrdFileCacheInfo.cc
Expand Up @@ -36,9 +36,10 @@ const char* XrdFileCache::Info::m_infoExtension = ".cinfo";
using namespace XrdFileCache;


Info::Info(long long iBufferSize) :
Info::Info(long long iBufferSize, bool prefetchBuffer) :
m_version(1),
m_bufferSize(iBufferSize),
m_hasPrefetchBuffer(prefetchBuffer),
m_sizeInBits(0),
m_buff_fetched(0), m_buff_write_called(0), m_buff_prefetch(0),
m_accessCnt(0),
Expand All @@ -63,14 +64,14 @@ void Info::SetFileSize(long long fs)
//______________________________________________________________________________


void Info::ResizeBits(int s, bool init_prefetch_buff)
void Info::ResizeBits(int s)
{
m_sizeInBits = s;
m_buff_fetched = (unsigned char*)malloc(GetSizeInBytes());
m_buff_write_called = (unsigned char*)malloc(GetSizeInBytes());
memset(m_buff_fetched, 0, GetSizeInBytes());
memset(m_buff_write_called, 0, GetSizeInBytes());
if (init_prefetch_buff) {
if (m_hasPrefetchBuffer) {
m_buff_prefetch = (unsigned char*)malloc(GetSizeInBytes());
memset(m_buff_prefetch, 0, GetSizeInBytes());
}
Expand Down
5 changes: 3 additions & 2 deletions src/XrdFileCache/XrdFileCacheInfo.hh
Expand Up @@ -59,7 +59,7 @@ namespace XrdFileCache
//------------------------------------------------------------------------
//! Constructor.
//------------------------------------------------------------------------
Info(long long bufferSize);
Info(long long bufferSize, bool prefetchBuffer = false);

//------------------------------------------------------------------------
//! Destructor.
Expand Down Expand Up @@ -92,7 +92,7 @@ namespace XrdFileCache
//!
//! @param n number of file blocks
//---------------------------------------------------------------------
void ResizeBits(int n, bool prefetch_stat = false);
void ResizeBits(int n);

//---------------------------------------------------------------------
//! \brief Rea load content from cinfo file into this object
Expand Down Expand Up @@ -201,6 +201,7 @@ namespace XrdFileCache

int m_version; //!< info version
long long m_bufferSize; //!< prefetch buffer size
bool m_hasPrefetchBuffer; //!< constains current prefetch score
long long m_fileSize; //!< number of file blocks
int m_sizeInBits; //!< number of file blocks
unsigned char *m_buff_fetched; //!< download state vector
Expand Down

0 comments on commit 54b57b5

Please sign in to comment.