Skip to content

Commit

Permalink
Merge pull request #381 from alja/access-stat-bytes
Browse files Browse the repository at this point in the history
pfc-V2 Save and print access statistics in bytes
  • Loading branch information
abh3 committed Jun 20, 2016
2 parents 72605c1 + 8dfb6d8 commit 0d9117c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 27 deletions.
9 changes: 3 additions & 6 deletions src/XrdFileCache/XrdFileCacheFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,10 @@ int File::ReadBlocksFromDisk(std::list<int>& blocks,

total += rs;


CheckPrefetchStatDisk(*ii);
}

m_stats.m_BytesDisk += total;
return total;
}

Expand Down Expand Up @@ -468,14 +468,12 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize)
inc_ref_count(bi->second);
TRACEF(Dump, "File::Read() " << iUserBuff << "inc_ref_count for existing block << " << bi->second << " idx = " << block_idx);
blks_to_process.push_front(bi->second);
m_stats.m_BytesRam++; // AMT what if block fails
}
// On disk?
else if (m_cfi.TestBit(offsetIdx(block_idx)))
{
TRACEF(Dump, "File::Read() read from disk " << (void*)iUserBuff << " idx = " << block_idx);
blks_on_disk.push_back(block_idx);
m_stats.m_BytesDisk++;
}
// Then we have to get it ...
else
Expand All @@ -492,14 +490,12 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize)
}
inc_ref_count(b);
blks_to_process.push_back(b);
m_stats.m_BytesRam++;
}
// Nope ... read this directly without caching.
else
{
TRACEF(Dump, "File::Read() direct block " << block_idx);
blks_direct.push_back(block_idx);
m_stats.m_BytesMissed++;
}
}

Expand Down Expand Up @@ -604,7 +600,7 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize)
TRACEF(Dump, "File::Read() ub=" << (void*)iUserBuff << " from finished block " << (*bi)->m_offset/BS << " size " << size_to_copy);
memcpy(&iUserBuff[user_off], &((*bi)->m_buff[off_in_block]), size_to_copy);
bytes_read += size_to_copy;

m_stats.m_BytesRam += size_to_copy;
CheckPrefetchStatRAM(*bi);
}
else // it has failed ... krap up.
Expand Down Expand Up @@ -635,6 +631,7 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize)
if (direct_handler->m_errno == 0)
{
bytes_read += direct_size;
m_stats.m_BytesMissed += direct_size;
}
else
{
Expand Down
5 changes: 0 additions & 5 deletions src/XrdFileCache/XrdFileCacheIOEntireFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ XrdOucCacheIO *IOEntireFile::Detach()
return io;
}

void IOEntireFile::Read (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
{
iocb.Done(IOEntireFile::Read(buff, offs, rlen));
}

int IOEntireFile::Read (char *buff, long long off, int size)
{
TRACEIO(Dump, "IOEntireFile::Read() "<< this << " off: " << off << " size: " << size );
Expand Down
13 changes: 0 additions & 13 deletions src/XrdFileCache/XrdFileCacheIOEntireFile.hh
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ namespace XrdFileCache
//---------------------------------------------------------------------
virtual int Read(char *Buffer, long long Offset, int Length);

//---------------------------------------------------------------------
//! Asynchronous read.
//!
//! @param callback
//! @param Buffer
//! @param Offset
//! @param Length
//!
//! @return number of bytes read
//---------------------------------------------------------------------
virtual void Read (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen);


//---------------------------------------------------------------------
//! Pass ReadV request to the corresponding File object.
//!
Expand Down
4 changes: 1 addition & 3 deletions src/XrdFileCache/XrdFileCacheIOFileBlock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ IOFileBlock::IOFileBlock(XrdOucCacheIO2 *io, XrdOucCacheStats &statsGlobal, Cach
//______________________________________________________________________________
XrdOucCacheIO* IOFileBlock::Detach()
{
TRACEIO(Info, "IOFileBlock::Detach() " );
XrdOucCacheIO * io = GetInput();

XrdOucCacheIO * io = GetInput();

for (std::map<int, File*>::iterator it = m_blocks.begin(); it != m_blocks.end(); ++it)
{
Expand Down
5 changes: 5 additions & 0 deletions src/XrdFileCache/XrdFileCacheVRead.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ int File::ReadV (const XrdOucIOVec *readV, int n)
if (direct_handler->m_errno == 0)
{
for (std::vector<XrdOucIOVec>::iterator i = chunkVec.begin(); i != chunkVec.end(); ++i)
{
bytesRead += i->size;
m_stats.m_BytesMissed += i->size;
}
}
else
{
Expand Down Expand Up @@ -234,6 +237,7 @@ int File::VReadFromDisk(const XrdOucIOVec *readV, int n, ReadVBlockListDisk& blo
int rs = m_output->Read(readV[chunkIdx].data + off, blockIdx*m_cfi.GetBufferSize() + blk_off - m_offset, size);
if (rs >=0 ) {
bytes_read += rs;
m_stats.m_BytesDisk += rs;
}
else {
// ofs read should set the errno
Expand Down Expand Up @@ -295,6 +299,7 @@ int File::VReadProcessBlocks(const XrdOucIOVec *readV, int n,
overlap(block_idx, m_cfi.GetBufferSize(), readV[*chunkIt].offset, readV[*chunkIt].size, off, blk_off, size);
memcpy(readV[*chunkIt].data + off, &(bi->block->m_buff[blk_off]), size);
bytes_read += size;
m_stats.m_BytesRam += size;
}
}
else {
Expand Down

0 comments on commit 0d9117c

Please sign in to comment.