Skip to content

Commit

Permalink
[Pfc] Add num bytes written to disk and bytes prefetched to the gstre…
Browse files Browse the repository at this point in the history
…am record.
  • Loading branch information
osschar committed Nov 20, 2024
1 parent 82a3fc0 commit 67699bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/XrdPfc/XrdPfc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,14 @@ void Cache::dec_ref_cnt(File* f, bool high_debug)
int len = snprintf(buf, 4096, "{\"event\":\"file_close\","
"\"lfn\":\"%s\",\"size\":%lld,\"blk_size\":%d,\"n_blks\":%d,\"n_blks_done\":%d,"
"\"access_cnt\":%lu,\"attach_t\":%lld,\"detach_t\":%lld,\"remotes\":%s,"
"\"b_hit\":%lld,\"b_miss\":%lld,\"b_bypass\":%lld,\"n_cks_errs\":%d}",
"\"b_hit\":%lld,\"b_miss\":%lld,\"b_bypass\":%lld,"
"\"b_todisk\":%lld,\"b_prefetch\":%lld,\"n_cks_errs\":%d}",
f->GetLocalPath().c_str(), f->GetFileSize(), f->GetBlockSize(),
f->GetNBlocks(), f->GetNDownloadedBlocks(),
(unsigned long) f->GetAccessCnt(), (long long) as->AttachTime, (long long) as->DetachTime,
f->GetRemoteLocations().c_str(),
as->BytesHit, as->BytesMissed, as->BytesBypassed, st.m_NCksumErrors
as->BytesHit, as->BytesMissed, as->BytesBypassed,
st.m_BytesWritten, f->GetPrefetchedBytes(), st.m_NCksumErrors
);
bool suc = false;
if (len < 4096)
Expand Down
2 changes: 2 additions & 0 deletions src/XrdPfc/XrdPfcFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ File::File(const std::string& path, long long iOffset, long long iFileSize) :
m_block_size(0),
m_num_blocks(0),
m_prefetch_state(kOff),
m_prefetch_bytes(0),
m_prefetch_read_cnt(0),
m_prefetch_hit_cnt(0),
m_prefetch_score(0)
Expand Down Expand Up @@ -1320,6 +1321,7 @@ void File::ProcessBlockResponse(Block *b, int res)
m_state_cond.UnLock();
return;
}
m_prefetch_bytes += b->get_size();
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/XrdPfc/XrdPfcFile.hh
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ public:
int GetBlockSize() const { return m_cfi.GetBufferSize(); }
int GetNBlocks() const { return m_cfi.GetNBlocks(); }
int GetNDownloadedBlocks() const { return m_cfi.GetNDownloadedBlocks(); }
long long GetPrefetchedBytes() const { return m_prefetch_bytes; }
const Stats& RefStats() const { return m_stats; }

// These three methods are called under Cache's m_active lock
Expand Down Expand Up @@ -364,6 +365,7 @@ private:

PrefetchState_e m_prefetch_state;

long long m_prefetch_bytes;
int m_prefetch_read_cnt;
int m_prefetch_hit_cnt;
float m_prefetch_score; // cached
Expand Down

0 comments on commit 67699bb

Please sign in to comment.