37 if (!instance) {
return;}
39 std::map<std::string, std::string> props;
40 for (
auto& stats : instance->
m_sites)
42 stats->recomputeProperties(props);
48 std::shared_ptr<XrdSiteStatistics>
51 std::lock_guard<std::mutex>
lock(m_mutex);
52 for (
auto& stats : m_sites)
68 if (m_instance.compare_exchange_strong(expected,
tmp.get()))
78 return m_instance.load(std::memory_order_relaxed);
84 desc.
setComment(
"Report Xrootd-related statistics centrally.");
86 ->setComment(
"True: Add per-site Xrootd statistics to the framework job report.\n" 87 "False: Collect no site-specific statistics.\n");
88 descriptions.
add(
"XrdAdaptor::XrdStatisticsService", desc);
104 std::shared_ptr<XrdReadStatistics>
107 std::shared_ptr<XrdReadStatistics> readStats(
new XrdReadStatistics(parent, req->getSize(), req->getCount()));
115 std::ostringstream formatter;
117 return formatter.str();
124 std::ostringstream formatter;
125 formatter << std::setw(4) <<
input;
126 return formatter.str();
137 props[
"readv-totalMegabytes"] =
d2str(static_cast<float>(
m_readvSize)/(1024.0*1024.0));
141 props[
"read-totalMegabytes"] =
d2str(static_cast<float>(
m_readSize)/(1024.0*1024.0));
142 props[
"read-totalMsecs"] =
d2str(static_cast<float>(
m_readNS)/1e6);
169 m_start(
std::chrono::high_resolution_clock::
now())
T getUntrackedParameter(std::string const &, T const &) const
void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
XrdReadStatistics(const XrdReadStatistics &)=delete
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
std::atomic< unsigned > m_readCount
static PFTauRenderPlugin instance
void finishRead(XrdReadStatistics const &)
std::atomic< uint64_t > m_readvSize
static std::string d2str(double input)
static std::string const input
void reportPerformanceForModule(std::string const &metricClass, std::string const &moduleName, std::map< std::string, std::string > const &metrics)
XrdSiteStatistics(std::string const &site)
void recomputeProperties(std::map< std::string, std::string > &props)
void setComment(std::string const &value)
static std::shared_ptr< XrdReadStatistics > startRead(std::shared_ptr< XrdSiteStatistics > parent, std::shared_ptr< ClientRequest > req)
std::atomic< unsigned > m_readvCount
XrdStatisticsService(const edm::ParameterSet &iPS, edm::ActivityRegistry &iRegistry)
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
std::atomic< uint64_t > m_readvNS
std::atomic< uint64_t > m_readNS
std::chrono::time_point< std::chrono::high_resolution_clock > m_start
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< std::vector< double > > tmp
static std::string i2str(int input)
std::atomic< uint64_t > m_readSize
friend class XrdReadStatistics
boost::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
std::atomic< unsigned > m_chunkCount