CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Friends
XrdAdaptor::XrdSiteStatistics Class Reference

#include <XrdStatistics.h>

Public Member Functions

void finishRead (XrdReadStatistics const &)
 
uint64_t getTotalBytes () const
 
std::chrono::nanoseconds getTotalReadTime ()
 
XrdSiteStatisticsoperator= (const XrdSiteStatistics &)=delete
 
void recomputeProperties (std::map< std::string, std::string > &props)
 
std::string const & site () const
 
 XrdSiteStatistics (std::string const &site)
 
 XrdSiteStatistics (const XrdSiteStatistics &)=delete
 

Static Public Member Functions

static std::shared_ptr< XrdReadStatisticsstartRead (std::shared_ptr< XrdSiteStatistics > parent, std::shared_ptr< ClientRequest > req)
 

Private Attributes

std::atomic< unsigned > m_chunkCount
 
std::atomic< unsigned > m_readCount
 
std::atomic< uint64_t > m_readNS
 
std::atomic< uint64_t > m_readSize
 
std::atomic< unsigned > m_readvCount
 
std::atomic< uint64_t > m_readvNS
 
std::atomic< uint64_t > m_readvSize
 
const std::string m_site = "Unknown"
 

Friends

class XrdReadStatistics
 

Detailed Description

Definition at line 67 of file XrdStatistics.h.

Constructor & Destructor Documentation

◆ XrdSiteStatistics() [1/2]

XrdSiteStatistics::XrdSiteStatistics ( std::string const &  site)

Definition at line 106 of file XrdStatistics.cc.

107  : m_site(site),
108  m_readvCount(0),
109  m_chunkCount(0),
110  m_readvSize(0),
111  m_readvNS(0.0),
112  m_readCount(0),
113  m_readSize(0),
114  m_readNS(0) {}
std::string const & site() const
Definition: XrdStatistics.h:75
std::atomic< unsigned > m_readCount
Definition: XrdStatistics.h:98
std::atomic< uint64_t > m_readvSize
Definition: XrdStatistics.h:96
std::atomic< unsigned > m_readvCount
Definition: XrdStatistics.h:94
std::atomic< uint64_t > m_readvNS
Definition: XrdStatistics.h:97
std::atomic< uint64_t > m_readNS
std::atomic< uint64_t > m_readSize
Definition: XrdStatistics.h:99
std::atomic< unsigned > m_chunkCount
Definition: XrdStatistics.h:95

◆ XrdSiteStatistics() [2/2]

XrdAdaptor::XrdSiteStatistics::XrdSiteStatistics ( const XrdSiteStatistics )
delete

Member Function Documentation

◆ finishRead()

void XrdSiteStatistics::finishRead ( XrdReadStatistics const &  readStats)

Definition at line 147 of file XrdStatistics.cc.

References XrdAdaptor::XrdReadStatistics::elapsedNS(), m_chunkCount, m_readCount, m_readNS, m_readSize, m_readvCount, m_readvNS, m_readvSize, XrdAdaptor::XrdReadStatistics::readCount(), and XrdAdaptor::XrdReadStatistics::size().

147  {
148  if (readStats.readCount() > 1) {
149  m_readvCount++;
150  m_chunkCount += readStats.readCount();
151  m_readvSize += readStats.size();
152  m_readvNS += readStats.elapsedNS();
153  } else {
154  m_readCount++;
155  m_readSize += readStats.size();
156  m_readNS += readStats.elapsedNS();
157  }
158 }
std::atomic< unsigned > m_readCount
Definition: XrdStatistics.h:98
std::atomic< uint64_t > m_readvSize
Definition: XrdStatistics.h:96
std::atomic< unsigned > m_readvCount
Definition: XrdStatistics.h:94
std::atomic< uint64_t > m_readvNS
Definition: XrdStatistics.h:97
std::atomic< uint64_t > m_readNS
std::atomic< uint64_t > m_readSize
Definition: XrdStatistics.h:99
std::atomic< unsigned > m_chunkCount
Definition: XrdStatistics.h:95

◆ getTotalBytes()

uint64_t XrdAdaptor::XrdSiteStatistics::getTotalBytes ( ) const
inline

Definition at line 86 of file XrdStatistics.h.

References m_readSize, and m_readvSize.

86 { return m_readvSize + m_readSize; }
std::atomic< uint64_t > m_readvSize
Definition: XrdStatistics.h:96
std::atomic< uint64_t > m_readSize
Definition: XrdStatistics.h:99

◆ getTotalReadTime()

std::chrono::nanoseconds XrdAdaptor::XrdSiteStatistics::getTotalReadTime ( )
inline

Definition at line 87 of file XrdStatistics.h.

References m_readNS, and m_readvNS.

87  {
89  }
boost::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
std::atomic< uint64_t > m_readvNS
Definition: XrdStatistics.h:97
std::atomic< uint64_t > m_readNS

◆ operator=()

XrdSiteStatistics& XrdAdaptor::XrdSiteStatistics::operator= ( const XrdSiteStatistics )
delete

◆ recomputeProperties()

void XrdSiteStatistics::recomputeProperties ( std::map< std::string, std::string > &  props)

Definition at line 134 of file XrdStatistics.cc.

References d2str(), i2str(), m_chunkCount, m_readCount, m_readNS, m_readSize, m_readvCount, m_readvNS, and m_readvSize.

134  {
135  props.clear();
136 
137  props["readv-numOperations"] = i2str(m_readvCount);
138  props["readv-numChunks"] = i2str(m_chunkCount);
139  props["readv-totalMegabytes"] = d2str(static_cast<float>(m_readvSize) / (1024.0 * 1024.0));
140  props["readv-totalMsecs"] = d2str(m_readvNS / 1e6);
141 
142  props["read-numOperations"] = i2str(m_readCount);
143  props["read-totalMegabytes"] = d2str(static_cast<float>(m_readSize) / (1024.0 * 1024.0));
144  props["read-totalMsecs"] = d2str(static_cast<float>(m_readNS) / 1e6);
145 }
std::atomic< unsigned > m_readCount
Definition: XrdStatistics.h:98
std::atomic< uint64_t > m_readvSize
Definition: XrdStatistics.h:96
static std::string d2str(double input)
std::atomic< unsigned > m_readvCount
Definition: XrdStatistics.h:94
std::atomic< uint64_t > m_readvNS
Definition: XrdStatistics.h:97
std::atomic< uint64_t > m_readNS
static std::string i2str(int input)
std::atomic< uint64_t > m_readSize
Definition: XrdStatistics.h:99
std::atomic< unsigned > m_chunkCount
Definition: XrdStatistics.h:95

◆ site()

std::string const& XrdAdaptor::XrdSiteStatistics::site ( ) const
inline

Definition at line 75 of file XrdStatistics.h.

References m_site.

75 { return m_site; }

◆ startRead()

std::shared_ptr< XrdReadStatistics > XrdSiteStatistics::startRead ( std::shared_ptr< XrdSiteStatistics parent,
std::shared_ptr< ClientRequest req 
)
static

Definition at line 116 of file XrdStatistics.cc.

References class-composition::parent, and XrdReadStatistics.

Referenced by XrdAdaptor::Source::handle().

117  {
118  std::shared_ptr<XrdReadStatistics> readStats(new XrdReadStatistics(parent, req->getSize(), req->getCount()));
119  return readStats;
120 }

Friends And Related Function Documentation

◆ XrdReadStatistics

friend class XrdReadStatistics
friend

Definition at line 68 of file XrdStatistics.h.

Referenced by startRead().

Member Data Documentation

◆ m_chunkCount

std::atomic<unsigned> XrdAdaptor::XrdSiteStatistics::m_chunkCount
private

Definition at line 95 of file XrdStatistics.h.

Referenced by finishRead(), and recomputeProperties().

◆ m_readCount

std::atomic<unsigned> XrdAdaptor::XrdSiteStatistics::m_readCount
private

Definition at line 98 of file XrdStatistics.h.

Referenced by finishRead(), and recomputeProperties().

◆ m_readNS

std::atomic<uint64_t> XrdAdaptor::XrdSiteStatistics::m_readNS
private

Definition at line 100 of file XrdStatistics.h.

Referenced by finishRead(), getTotalReadTime(), and recomputeProperties().

◆ m_readSize

std::atomic<uint64_t> XrdAdaptor::XrdSiteStatistics::m_readSize
private

Definition at line 99 of file XrdStatistics.h.

Referenced by finishRead(), getTotalBytes(), and recomputeProperties().

◆ m_readvCount

std::atomic<unsigned> XrdAdaptor::XrdSiteStatistics::m_readvCount
private

Definition at line 94 of file XrdStatistics.h.

Referenced by finishRead(), and recomputeProperties().

◆ m_readvNS

std::atomic<uint64_t> XrdAdaptor::XrdSiteStatistics::m_readvNS
private

Definition at line 97 of file XrdStatistics.h.

Referenced by finishRead(), getTotalReadTime(), and recomputeProperties().

◆ m_readvSize

std::atomic<uint64_t> XrdAdaptor::XrdSiteStatistics::m_readvSize
private

Definition at line 96 of file XrdStatistics.h.

Referenced by finishRead(), getTotalBytes(), and recomputeProperties().

◆ m_site

const std::string XrdAdaptor::XrdSiteStatistics::m_site = "Unknown"
private

Definition at line 92 of file XrdStatistics.h.

Referenced by site().