Skip to content

Commit

Permalink
Cache prefetch score.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent ba39afd commit d6176c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -88,6 +88,7 @@ m_in_sync(false),
m_downloadCond(0),
m_prefetchReadCnt(0),
m_prefetchHitCnt(0),
m_prefetchScore(1),
m_prefetchCurrentCnt(0)
{
clLog()->Debug(XrdCl::AppMsg, "File::File() %s", m_input.Path());
Expand Down Expand Up @@ -805,7 +806,7 @@ void File::Prefetch()

if (cache()->RequestRAMBlock()) {
m_prefetchReadCnt++;

m_prefetchScore = m_prefetchHitCnt/m_prefetchReadCnt;
Block *b = RequestBlock(block_idx, true);
inc_ref_count(b);
}
Expand All @@ -820,8 +821,10 @@ void File::Prefetch()
void File::CheckPrefetchStatRAM(Block* b)
{
if (Factory::GetInstance().RefConfiguration().m_prefetch) {
if (b->m_prefetch)
if (b->m_prefetch) {
m_prefetchHitCnt++;
m_prefetchScore = m_prefetchHitCnt/m_prefetchReadCnt;
}
}
}

Expand All @@ -837,10 +840,7 @@ void File::CheckPrefetchStatDisk(int idx)
//______________________________________________________________________________
float File::GetPrefetchScore() const
{
if (m_prefetchReadCnt)
return m_prefetchHitCnt/m_prefetchReadCnt;

return 1; // AMT not sure if this should be 0.5 ... ????
return m_prefetchScore;
}

//______________________________________________________________________________
Expand Down
2 changes: 1 addition & 1 deletion src/XrdFileCache/XrdFileCacheFile.hh
Expand Up @@ -126,8 +126,8 @@ namespace XrdFileCache

int m_prefetchReadCnt;
int m_prefetchHitCnt;
int m_prefetchScore; //cached
int m_prefetchCurrentCnt;
// AMT should I cache prefetch score for optimization of Cache::getNextFileToPrefetch() ???

public:

Expand Down

0 comments on commit d6176c1

Please sign in to comment.