37 if (!instance) {
return;}
39 std::map<std::string, std::string> props;
40 for (
auto& stats : instance->
m_sites)
42 stats->recomputeProperties(props);
47 std::vector<std::pair<std::string, XrdStatisticsService::CondorIOStats>>
50 std::vector<std::pair<std::string, XrdStatisticsService::CondorIOStats>>
result;
52 if (!instance) {
return result;}
54 std::lock_guard<std::mutex>
lock(instance->
m_mutex);
55 result.reserve(instance->
m_sites.size());
56 for (
auto& stats : instance->
m_sites)
63 result.emplace_back(ss->site(),
cs);
69 std::shared_ptr<XrdSiteStatistics>
72 std::lock_guard<std::mutex>
lock(m_mutex);
73 for (
auto& stats : m_sites)
89 if (m_instance.compare_exchange_strong(expected,
tmp.get()))
99 return m_instance.load(std::memory_order_relaxed);
105 desc.
setComment(
"Report Xrootd-related statistics centrally.");
107 ->setComment(
"True: Add per-site Xrootd statistics to the framework job report.\n" 108 "False: Collect no site-specific statistics.\n");
109 descriptions.
add(
"XrdAdaptor::XrdStatisticsService", desc);
125 std::shared_ptr<XrdReadStatistics>
128 std::shared_ptr<XrdReadStatistics> readStats(
new XrdReadStatistics(parent, req->getSize(), req->getCount()));
136 std::ostringstream formatter;
138 return formatter.str();
145 std::ostringstream formatter;
146 formatter << std::setw(4) <<
input;
147 return formatter.str();
158 props[
"readv-totalMegabytes"] =
d2str(static_cast<float>(
m_readvSize)/(1024.0*1024.0));
162 props[
"read-totalMegabytes"] =
d2str(static_cast<float>(
m_readSize)/(1024.0*1024.0));
163 props[
"read-totalMsecs"] =
d2str(static_cast<float>(
m_readNS)/1e6);
190 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
unique_ptr< ClusterSequence > cs
void finishRead(XrdReadStatistics const &)
std::atomic< uint64_t > m_readvSize
static std::string d2str(double input)
std::vector< std::pair< std::string, CondorIOStats > > condorUpdate()
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)
uint64_t elapsedNS() const
std::atomic< uint64_t > m_readvNS
std::atomic< uint64_t > m_readNS
std::chrono::time_point< std::chrono::high_resolution_clock > m_start
unsigned long long uint64_t
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::chrono::nanoseconds transferTime
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